/**
 * Navigation Moderne v7.0
 * Mega-menu avec effets visuels avancés
 */

/* === VARIABLES === */
:root {
    --nav-height: 70px;
    --nav-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --nav-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --mega-menu-width: 900px;
    --transition-speed: 0.3s;
    --hover-lift: -2px;
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === NAVBAR PRINCIPALE === */
.navbar-modern {
    background: var(--nav-bg);
    box-shadow: var(--nav-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar-modern .container-fluid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
}

/* === BRAND === */
.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: white;
    transition: transform var(--transition-speed) ease;
}

.brand:hover {
    transform: scale(1.05);
}

.brand-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-tagline {
    font-size: 0.7rem;
    opacity: 0.9;
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* === NAVIGATION CONTENT === */
.nav-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
    margin-left: 3rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left var(--transition-speed) ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    color: white;
}

.nav-link:hover::before {
    left: 0;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.chevron-icon {
    font-size: 0.7rem;
    transition: transform var(--transition-speed) ease;
}

.nav-link.active .chevron-icon {
    transform: rotate(180deg);
}

/* === MEGA MENU === */
.mega-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    transform: translateY(-10px);
    width: var(--mega-menu-width);
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed) cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
    /* Pont invisible pour faciliter le survol */
    padding-top: 20px;
    margin-top: -20px;
    /* Empêcher le débordement à gauche */
    margin-left: 0;
}

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

/* Ajuster la position pour éviter le débordement à droite */
.mega-menu-trigger:last-child .mega-menu {
    left: auto;
    right: 0;
}

.mega-menu::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 30px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 8px solid white;
}

/* Flèche pour le dernier élément (aligné à droite) */
.mega-menu-trigger:last-child .mega-menu::before {
    left: auto;
    right: 30px;
}

.mega-menu-header {
    padding: 1.25rem 1.5rem;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.mega-menu-body {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

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

.mega-menu-subcategory-header {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left: 3px solid #667eea;
    border-radius: 8px;
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mega-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all var(--transition-speed) ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.mega-menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s ease;
}

.mega-menu-item:hover::before {
    left: 100%;
}

.mega-menu-item:hover {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.mega-menu-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    transition: all var(--transition-speed) ease;
}

.mega-menu-item:hover .mega-menu-icon {
    transform: scale(1.1) rotate(5deg);
}

.mega-menu-content {
    flex: 1;
}

.mega-menu-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
}

.mega-menu-desc {
    font-size: 0.85rem;
    color: #6c757d;
}

/* === OVERLAY === */
.mega-menu-overlay {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed) ease;
    z-index: 999;
}

.mega-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* === USER DROPDOWN === */
.user-dropdown {
    position: relative;
}

.user-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    color: white;
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
}

.user-trigger:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.avatar-initials {
    font-size: 1rem;
    color: white;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.75rem;
    opacity: 0.9;
}

.user-menu {
    min-width: 280px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin-top: 0.75rem;
}

.user-profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.avatar-large {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.25rem;
}

.user-menu .dropdown-item {
    padding: 0.75rem 1.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.user-menu .dropdown-item:hover {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    transform: translateX(5px);
}

.user-menu .dropdown-item i {
    width: 20px;
}

/* === NAV ACTIONS === */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.nav-actions .btn {
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.nav-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* === MOBILE TOGGLE === */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all var(--transition-speed) ease;
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translateY(8px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-8px);
}

/* === BADGES === */
.badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
}

/* === SCROLLBAR STYLING === */
.mega-menu-body::-webkit-scrollbar {
    width: 8px;
}

.mega-menu-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.mega-menu-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.mega-menu-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
    .mega-menu {
        width: 90vw;
        max-width: 700px;
    }

    .mega-menu-body {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: flex;
    }

    .nav-content {
        position: fixed;
        top: var(--nav-height);
        left: -100%;
        width: 80vw;
        max-width: 300px;
        height: calc(100vh - var(--nav-height));
        background: white;
        flex-direction: column;
        align-items: stretch;
        margin: 0;
        padding: 1rem;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
        transition: left var(--transition-speed) ease;
        overflow-y: auto;
    }

    .nav-content.active {
        left: 0;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
    }

    .nav-link {
        color: #333;
    }

    .nav-link:hover {
        background: #f5f7fa;
    }

    .mega-menu {
        position: static;
        transform: none;
        width: 100%;
        margin-top: 0.5rem;
        border-radius: 8px;
    }

    .mega-menu.active {
        transform: none;
    }

    .mega-menu-body {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .mega-menu-overlay {
        display: none;
    }

    .nav-actions {
        width: 100%;
        flex-direction: column;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #e9ecef;
    }

    .brand-tagline {
        display: none;
    }
}

/* === ANIMATIONS === */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mega-menu-item {
    animation: slideIn 0.3s ease forwards;
}

.mega-menu-item:nth-child(1) { animation-delay: 0.05s; }
.mega-menu-item:nth-child(2) { animation-delay: 0.1s; }
.mega-menu-item:nth-child(3) { animation-delay: 0.15s; }
.mega-menu-item:nth-child(4) { animation-delay: 0.2s; }
.mega-menu-item:nth-child(5) { animation-delay: 0.25s; }
