/**
 * Notification Bell Styles
 * Styles for the notification bell icon in the navigation header
 */

.notification-bell-wrapper {
    display: flex;
    align-items: center;
    margin-left: 0.75rem;
    margin-right: 0.5rem;
    height: 100%;
}

#notification-bell,
#notification-bell-mobile {
    border: none;
    background: none;
    color: inherit;
    transition: color 0.2s ease;
    overflow: visible;
}

#notification-bell:hover,
#notification-bell-mobile:hover {
    color: var(--bs-primary) !important;
}

#notification-bell:focus,
#notification-bell-mobile:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.25);
    border-radius: 4px;
}

#notification-bell.has-notifications .fas.fa-bell,
#notification-bell-mobile.has-notifications .fas.fa-bell {
    color: var(--bs-warning) !important;
}

#notification-bell.has-critical-notifications .fas.fa-bell,
#notification-bell-mobile.has-critical-notifications .fas.fa-bell {
    color: var(--bs-danger) !important;
    animation: criticalPulse 1.5s ease-in-out infinite;
}

#notification-bell.notification-error .fas.fa-bell,
#notification-bell-mobile.notification-error .fas.fa-bell {
    color: var(--bs-secondary) !important;
    opacity: 0.6;
}

#notification-bell.new-notification-pulse .fas.fa-bell,
#notification-bell-mobile.new-notification-pulse .fas.fa-bell {
    animation: newNotificationPulse 2s ease-in-out;
}

#notification-badge,
#notification-badge-mobile {
    font-size: 0.65rem;
    min-width: 1.35em;
    height: 1.35em;
    line-height: 1.2;
    transition: opacity 0.3s ease, transform 0.2s ease;
    transform-origin: center;
}

/* Prevent layout jumping by reserving space for the badge */
#notification-bell,
#notification-bell-mobile {
    position: relative;
    min-width: 24px; /* Reserve space for icon + badge */
    min-height: 24px;
}

/* Smooth badge appearance */
#notification-badge[style*="opacity: 1"],
#notification-badge-mobile[style*="opacity: 1"] {
    transform: scale(1);
}

#notification-badge[style*="opacity: 0"],
#notification-badge-mobile[style*="opacity: 0"] {
    transform: scale(0.8);
}

/* Bell shake animation for new notifications */
@keyframes bellShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Critical notification pulse animation */
@keyframes criticalPulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* New notification pulse animation */
@keyframes newNotificationPulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    25% { 
        transform: scale(1.2);
        opacity: 0.8;
    }
    50% { 
        transform: scale(1.1);
        opacity: 0.9;
    }
    75% { 
        transform: scale(1.15);
        opacity: 0.85;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .notification-bell-wrapper {
        margin-right: 0.5rem !important;
    }
    
    #notification-bell .fas.fa-bell,
    #notification-bell-mobile .fas.fa-bell {
        font-size: 1.1rem;
    }
}

/* Dark mode support */
[data-ea-default-color-scheme="dark"] #notification-bell,
[data-ea-default-color-scheme="dark"] #notification-bell-mobile {
    color: var(--bs-gray-300);
}

[data-ea-default-color-scheme="dark"] #notification-bell:hover,
[data-ea-default-color-scheme="dark"] #notification-bell-mobile:hover {
    color: var(--bs-primary) !important;
}

/* Integration with EasyAdmin user menu styling */
.navbar-custom-menu {
    align-items: center !important;
    gap: 0.5rem;
}

@media (min-width: 992px) {
    .navbar-custom-menu {
        display: flex !important;
    }
}

.navbar-custom-menu .notification-bell-wrapper {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Ensure proper alignment with user menu */
.user-menu-wrapper {
    display: flex;
    align-items: center;
}

/* EasyAdmin header integration */
.header-custom-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-custom-menu .notification-bell-wrapper {
    order: 2; /* Position after user menu */
}

/* EasyAdmin navbar menu alignment fixes */
.navbar-nav {
    display: flex !important;
    align-items: center !important;
}

.navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

/* Ensure all navbar elements are vertically centered */
.navbar .navbar-nav,
.navbar .navbar-nav .nav-item,
.navbar .navbar-nav .nav-link {
    display: flex;
    align-items: center;
}

/* Fix for EasyAdmin's user menu dropdown */
.navbar .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive header adjustments */
#responsive-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
}

#responsive-header .notification-bell-wrapper {
    order: -1; /* Position before user menu on mobile */
    margin-left: 0;
    margin-right: 0.75rem;
}

/* EasyAdmin specific header fixes */
.header .navbar-nav {
    display: flex !important;
    align-items: center !important;
    height: 100%;
}

.header .navbar-nav > li {
    display: flex;
    align-items: center;
    height: 100%;
}

.header .navbar-nav > li > a,
.header .navbar-nav > li > button {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0.5rem 0.75rem;
}

/* Ensure notification bell aligns with other header elements */
.header .notification-bell-wrapper {
    height: 100%;
    display: flex;
    align-items: center;
}

.header .notification-bell-wrapper button {
    height: auto;
    padding: 0.5rem;
}

/* Error state styling */
#notification-bell.notification-error,
#notification-bell-mobile.notification-error {
    position: relative;
}

#notification-bell.notification-error::after,
#notification-bell-mobile.notification-error::after {
    content: '!';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background-color: var(--bs-warning);
    color: var(--bs-dark);
    border-radius: 50%;
    font-size: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Critical notification badge styling */
#notification-bell.has-critical-notifications #notification-badge,
#notification-bell-mobile.has-critical-notifications #notification-badge-mobile {
    background-color: var(--bs-danger) !important;
    animation: criticalBadgePulse 2s ease-in-out infinite;
}

@keyframes criticalBadgePulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--bs-danger-rgb), 0.7);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 4px rgba(var(--bs-danger-rgb), 0);
    }
}

/* Accessibility improvements */
#notification-bell:focus-visible,
#notification-bell-mobile:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Progress circle and loading state improvements */
.mercure-progress-component {
    margin: 0 !important;
    padding: 0 !important;
}

.mercure-progress-component .card {
    margin-bottom: 0 !important;
}

/* Prevent UI jumping from progress components */
.progress {
    height: 0.5rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    background-color: var(--bs-gray-200);
    border-radius: 0.25rem;
}

.progress-bar {
    transition: width 0.3s ease;
}

/* Smooth transitions for all notification elements */
.notification-bell-wrapper * {
    transition: all 0.2s ease;
}

/* Prevent layout shifts from dynamic content */
.notification-bell-wrapper {
    contain: layout style;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #notification-bell.has-critical-notifications .fas.fa-bell,
    #notification-bell-mobile.has-critical-notifications .fas.fa-bell,
    #notification-bell.new-notification-pulse .fas.fa-bell,
    #notification-bell-mobile.new-notification-pulse .fas.fa-bell,
    #notification-bell.has-critical-notifications #notification-badge,
    #notification-bell-mobile.has-critical-notifications #notification-badge-mobile {
        animation: none;
    }
    
    #notification-badge,
    #notification-badge-mobile,
    .notification-bell-wrapper * {
        transition: none !important;
    }
}