/* GuardSync - Modern Compact Navbar */

:root {
    --navbar-height: 3.5rem;
    --navbar-bg: #ffffff;
    --navbar-border: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-red: #ef4444;
    --dropdown-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* === BASE NAVBAR === */
.modern-navbar {
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--navbar-border);
    height: var(--navbar-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.navbar-container {
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

/* === LEFT SECTION === */
.navbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
}

/* Brand */
.brand-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.025em;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.brand-link:hover {
    opacity: 0.8;
}

.brand-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--accent-blue);
}

.brand-name {
    font-size: 1.125rem;
    color: var(--text-primary);
}

/* Main Navigation */
.main-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.2s;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
    background: transparent;
    border: none;
    cursor: pointer;
}

.nav-link:hover {
    color: var(--text-primary);
    background: #f3f4f6;
}

.nav-link.active {
    color: var(--accent-blue);
    background: #eff6ff;
}

.nav-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    background: var(--accent-red);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    margin-left: 0.25rem;
}

/* Dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.nav-dropdown-toggle i {
    font-size: 0.625rem;
    transition: transform 0.2s;
}

.nav-dropdown.active .nav-dropdown-toggle i {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 12rem;
    background: white;
    border: 1px solid var(--navbar-border);
    border-radius: 0.5rem;
    box-shadow: var(--dropdown-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all 0.2s;
}

.nav-dropdown.active .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s;
}

.dropdown-item:hover {
    background: #f9fafb;
    color: var(--text-primary);
}

.dropdown-item i {
    width: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* === MEGA MENU === */
.mega-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background: white;
    border: 1px solid var(--navbar-border);
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1002;
}

.mega-menu-trigger.active .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 1.5rem;
    min-width: 28rem;
}

.mega-menu-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mega-menu-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 0 0 0.5rem;
    padding: 0 0.75rem;
}

.mega-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.mega-menu-item:hover {
    background: #f9fafb;
    color: var(--text-primary);
    transform: translateX(2px);
}

.mega-menu-item i {
    width: 1.25rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--accent-blue);
    transition: all 0.2s;
}

.mega-menu-item:hover i {
    color: var(--accent-blue-hover);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .mega-menu-content {
        grid-template-columns: 1fr;
        min-width: 18rem;
        gap: 1rem;
        padding: 1rem;
    }
}

/* === RIGHT SECTION === */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

/* Icon Buttons */
.icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.icon-btn:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}

.icon-btn--primary {
    background: var(--accent-blue);
    color: white;
}

.icon-btn--primary:hover {
    background: var(--accent-blue-hover);
}

/* Theme Toggle Button */
.theme-toggle {
    position: relative;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: #f3f4f6 !important;
}

.theme-toggle--auto {
    background: rgba(59, 130, 246, 0.1) !important;
    border-radius: 50% !important;
}

.theme-toggle--auto::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    border-radius: 50%;
    border: 2px solid white;
}

.icon-badge {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    width: 0.5rem;
    height: 0.5rem;
    background: var(--accent-red);
    border-radius: 50%;
    border: 2px solid white;
}

/* Divider */
.nav-divider {
    width: 1px;
    height: 1.5rem;
    background: var(--navbar-border);
    margin: 0 0.25rem;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem 0.375rem 0.375rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu:hover {
    background: #f3f4f6;
}

.user-avatar {
    width: 1.75rem;
    height: 1.75rem;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.user-menu i {
    font-size: 0.625rem;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.user-menu:hover i {
    transform: rotate(180deg);
}

/* === USER DROPDOWN === */
.user-dropdown {
    position: absolute;
    top: calc(var(--navbar-height) + 0.5rem);
    right: 1.5rem;
    width: 14rem;
    background: white;
    border: 1px solid var(--navbar-border);
    border-radius: 0.5rem;
    box-shadow: var(--dropdown-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all 0.2s;
    z-index: 1001;
}

.user-dropdown--active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 0.875rem;
    border-bottom: 1px solid var(--navbar-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dropdown-user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.dropdown-user-info strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.dropdown-user-info small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.dropdown-user-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: #e5e7eb;
    color: var(--text-secondary);
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.user-dropdown-content {
    padding: 0.5rem;
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.625rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    transition: all 0.15s;
}

.dropdown-link:hover {
    background: #f9fafb;
    color: var(--text-primary);
}

.dropdown-link i {
    width: 1rem;
    text-align: center;
    font-size: 0.875rem;
}

.dropdown-link--danger {
    color: var(--accent-red);
}

.dropdown-link--danger:hover {
    background: #fef2f2;
}

.dropdown-divider {
    height: 1px;
    background: var(--navbar-border);
    margin: 0.25rem 0;
}

/* === NOTIFICATIONS PANEL === */
.notifications-panel {
    position: absolute;
    top: calc(var(--navbar-height) + 0.5rem);
    right: 5rem;
    width: 20rem;
    max-height: 24rem;
    background: white;
    border: 1px solid var(--navbar-border);
    border-radius: 0.5rem;
    box-shadow: var(--dropdown-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all 0.2s;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.notifications-panel--active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notifications-header {
    padding: 0.875rem;
    border-bottom: 1px solid var(--navbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notifications-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notifications-close {
    width: 1.5rem;
    height: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifications-close:hover {
    background: #f3f4f6;
}

.notifications-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.625rem;
    border-radius: 0.375rem;
    transition: all 0.15s;
    cursor: pointer;
}

.notification-item:hover {
    background: #f9fafb;
}

.notification-item--unread {
    background: #f0f9ff;
    border-left: 2px solid var(--accent-blue);
}

.notification-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.notification-icon--info {
    background: #dbeafe;
    color: var(--accent-blue);
}

.notification-icon--success {
    background: #d1fae5;
    color: #10b981;
}

.notification-icon--warning {
    background: #fef3c7;
    color: #f59e0b;
}

.notification-icon--error {
    background: #fee2e2;
    color: #ef4444;
}

.notifications-loading,
.notifications-empty {
    padding: 1rem;
    text-align: center;
}

.notifications-loading .fa-spinner {
    font-size: 1.25rem;
}

.notification-body {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary);
    margin: 0 0 0.125rem;
}

.notification-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 0.25rem;
}

.notification-time {
    font-size: 0.6875rem;
    color: #9ca3af;
}

.notifications-footer {
    padding: 0.625rem;
    border-top: 1px solid var(--navbar-border);
    text-align: center;
}

.notifications-footer a {
    color: var(--accent-blue);
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
}

.notifications-footer a:hover {
    text-decoration: underline;
}

/* === QUICK ADD MENU === */
.quick-add-menu {
    position: absolute;
    top: calc(var(--navbar-height) + 0.5rem);
    right: 8rem;
    width: 18rem;
    background: white;
    border: 1px solid var(--navbar-border);
    border-radius: 0.5rem;
    box-shadow: var(--dropdown-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all 0.2s;
    z-index: 1001;
}

.quick-add-menu--active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quick-add-header {
    padding: 0.875rem;
    border-bottom: 1px solid var(--navbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quick-add-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.quick-add-close {
    width: 1.5rem;
    height: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-add-close:hover {
    background: #f3f4f6;
}

/* Fix pour le bouton de fermeture */
.quick-add-close {
    font-size: 0.75rem;
}

.quick-add-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
}

.quick-add-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.875rem 0.5rem;
    background: #f9fafb;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.15s;
    text-align: center;
}

.quick-add-item:hover {
    background: #eff6ff;
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.quick-add-item i {
    font-size: 1.25rem;
}

/* === MOBILE NAVIGATION === */
.mobile-menu-toggle {
    display: none;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--navbar-border);
    border-radius: 0.375rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.mobile-menu-toggle:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .main-nav,
    .icon-btn:not(.icon-btn--primary),
    .nav-divider {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .navbar-left {
        flex: 0;
    }
    
    .navbar-right {
        gap: 0.5rem;
    }
    
    .navbar-container {
        padding: 0 1rem;
    }
    
    .brand-name {
        font-size: 1rem;
    }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Appliquer l'animation aux dropdowns */
.nav-dropdown-menu,
.user-dropdown,
.notifications-panel,
.quick-add-menu {
    animation: slideDown 0.2s ease-out;
}

/* === FOCUS STATES === */
.nav-link:focus,
.icon-btn:focus,
.user-menu:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* === LOADING STATES === */
.nav-link.loading {
    opacity: 0.6;
    pointer-events: none;
}

.nav-link.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0.5rem;
    width: 0.75rem;
    height: 0.75rem;
    border: 1px solid var(--accent-blue);
    border-top: 1px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === MOBILE NAVIGATION MENU === */
.mobile-nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: white;
    border-right: 1px solid var(--navbar-border);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1002;
    overflow-y: auto;
}

.mobile-nav-menu--active {
    transform: translateX(0);
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1001;
}

.mobile-nav-overlay--active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--navbar-border);
    background: #f8fafc;
}

.mobile-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.125rem;
}

.mobile-nav-brand i {
    color: var(--accent-blue);
    font-size: 1.25rem;
}

.mobile-nav-close {
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: 1px solid var(--navbar-border);
    border-radius: 0.375rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mobile-nav-close:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}

.mobile-nav-content {
    padding: 1rem 0;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    margin-left: 1rem;
    margin-right: 1rem;
}

.mobile-user-avatar {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.mobile-user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.mobile-user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.mobile-nav-section {
    margin-bottom: 1.5rem;
}

.mobile-nav-title {
    padding: 0 1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: all 0.2s;
    position: relative;
}

.mobile-nav-link:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.mobile-nav-link i {
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
}

.mobile-nav-link--danger {
    color: var(--accent-red);
}

.mobile-nav-link--danger:hover {
    background: #fef2f2;
}

.mobile-nav-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    min-width: 1.25rem;
    text-align: center;
}

/* Prevent body scroll when mobile menu is open */
body.mobile-nav-open {
    overflow: hidden;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .navbar-container {
        padding: 0 1rem;
    }
}

@media (max-width: 640px) {
    .navbar-container {
        padding: 0 0.75rem;
    }
    
    .brand-name {
        font-size: 1rem;
    }
    
    /* Ajuster les panels pour mobile */
    .user-dropdown {
        right: 0.75rem;
        width: calc(100vw - 1.5rem);
        max-width: 20rem;
    }
    
    .notifications-panel {
        right: 0.75rem;
        width: calc(100vw - 1.5rem);
        max-width: 24rem;
    }
    
    .quick-add-menu {
        right: 0.75rem;
        width: calc(100vw - 1.5rem);
        max-width: 20rem;
    }
}