/**
 * CSS Global de la Navbar - IA COSINUS
 * À inclure dans toutes les pages pour une navbar cohérente
 */

/* Body padding pour compenser la navbar fixed */
body {
    padding-top: 70px !important;
}

/* Navbar principale */
.global-navbar {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 1600px;
    width: 100%;
    height: 56px;
    background: linear-gradient(135deg,
        rgba(10, 14, 26, 0.85) 0%,
        rgba(14, 18, 30, 0.9) 50%,
        rgba(10, 14, 26, 0.85) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 212, 255, 0.3) 20%,
        rgba(0, 212, 255, 0.5) 50%,
        rgba(0, 212, 255, 0.3) 80%,
        transparent 100%) 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(0, 212, 255, 0.05),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

.global-navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 212, 255, 0.4) 50%,
        transparent 100%);
    pointer-events: none;
}

/* Logo / Brand */
.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: #00d4ff;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.navbar-brand:hover {
    color: #00ffff;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.6);
    transform: translateY(-1px);
}

/* Navigation Links Container */
.navbar-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Navigation Links */
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(0, 212, 255, 0.05),
        rgba(0, 212, 255, 0.1));
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-link:hover {
    color: #00d4ff;
    transform: translateY(-2px);
}

.nav-link:hover::before {
    opacity: 1;
}

.nav-link.active {
    color: #00d4ff;
    background: linear-gradient(135deg,
        rgba(0, 212, 255, 0.15),
        rgba(0, 212, 255, 0.05));
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

/* Search Trigger */
.search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.search-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.5);
    color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.search-trigger kbd {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 11px;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.5);
    color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    transform: rotate(15deg);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-menu-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff, #0066ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
    transition: all 0.3s ease;
}

.user-menu-trigger:hover .user-avatar {
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.5);
    transform: scale(1.05);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.2;
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.2;
}

.user-role.admin {
    color: #ff6b6b;
}

.user-role.archiviste {
    color: #f59e0b;
}

.user-role.utilisateur {
    color: #10b981;
}

/* User Menu Dropdown */
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: rgba(20, 24, 36, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 212, 255, 0.1);
    z-index: 1001;
    display: none; /* Caché par défaut */
}

.user-menu.open.show-user-menu .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block; /* Visible uniquement avec classe show-user-menu */
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.user-menu-item:hover {
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
}

.user-menu-item.logout {
    color: rgba(255, 107, 107, 0.8);
}

.user-menu-item.logout:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

/* Profile Icon Button (Non connecté) */
.profile-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
}

.profile-icon-button:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.5);
    color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
}

.profile-icon-button svg {
    transition: all 0.3s ease;
}

.profile-icon-button:hover svg {
    transform: scale(1.1);
}

/* Login Menu Dropdown */
.login-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: rgba(20, 24, 36, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 212, 255, 0.1);
    z-index: 1002;
    pointer-events: none;
    display: none; /* Caché par défaut */
}

.user-menu.open.show-login-menu .login-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    display: block; /* Visible uniquement avec classe show-login-menu */
}

/* Thème clair */
[data-theme="light"] .global-navbar {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(248, 250, 252, 0.98) 50%,
        rgba(255, 255, 255, 0.95) 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-image: none;
    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .global-navbar::before {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 102, 204, 0.15) 50%,
        transparent 100%);
}

[data-theme="light"] .navbar-brand {
    color: #0066cc;
    text-shadow: 0 0 20px rgba(0, 102, 204, 0.2);
}

[data-theme="light"] .nav-link {
    color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-link.active {
    color: #0066cc;
}

[data-theme="light"] .theme-toggle {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 102, 204, 0.08);
    border-color: rgba(0, 102, 204, 0.3);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.1),
        0 0 12px rgba(0, 102, 204, 0.15);
}

[data-theme="light"] .profile-icon-button {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .profile-icon-button:hover {
    background: rgba(0, 102, 204, 0.08);
    border-color: rgba(0, 102, 204, 0.3);
    color: #0066cc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 12px rgba(0, 102, 204, 0.15);
}

[data-theme="light"] .login-menu-dropdown {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.15),
        0 0 20px rgba(0, 102, 204, 0.1);
}

[data-theme="light"] .user-menu-dropdown {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.15),
        0 0 20px rgba(0, 102, 204, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .global-navbar {
        padding: 0 12px;
        height: 48px;
    }

    .navbar-nav {
        gap: 4px;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 13px;
    }

    .search-trigger span {
        display: none;
    }

    .search-trigger kbd {
        display: none;
    }
}
