/* =============================================
   INA1000 - NAVIGATION GLOBALE
   Header fixe responsive avec sidebar mobile
   ============================================= */

/* Variables CSS */
:root {
    --nav-height: 70px;
    --nav-bg: #ffffff;
    --nav-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --nav-text: #1f2937;
    --nav-accent: #a578e8;
    --sidebar-width: 280px;
}

[data-theme="dark"] {
    --nav-bg: #1e293b;
    --nav-text: #e2e8f0;
}

/* Header principal */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--nav-bg);
    box-shadow: var(--nav-shadow);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--nav-accent);
}

.nav-logo img {
    height: 40px;
    margin-right: 0.5rem;
}

/* Navigation desktop */
.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--nav-text);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(165, 120, 232, 0.1);
    color: var(--nav-accent);
}

.nav-link.active {
    background: var(--nav-accent);
    color: white;
}

/* Actions (langue + dark mode) */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lang-selector {
    padding: 0.5rem;
    border: 1px solid var(--clr-border);
    border-radius: 8px;
    background: var(--nav-bg);
    color: var(--nav-text);
    cursor: pointer;
    font-size: 0.9rem;
}

.dark-mode-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--clr-border);
    background: var(--nav-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.dark-mode-toggle:hover {
    background: rgba(165, 120, 232, 0.1);
}

.dark-icon { display: none; }
[data-theme="dark"] .light-icon { display: none; }
[data-theme="dark"] .dark-icon { display: block; }

/* Menu burger mobile */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
}

.burger-line {
    width: 24px;
    height: 3px;
    background: var(--nav-text);
    position: absolute;
    left: 8px;
    transition: all 0.3s ease;
}

.burger-line:nth-child(1) { top: 10px; }
.burger-line:nth-child(2) { top: 19px; }
.burger-line:nth-child(3) { top: 28px; }

.mobile-menu-toggle.active .burger-line:nth-child(1) {
    transform: rotate(45deg);
    top: 19px;
}

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

.mobile-menu-toggle.active .burger-line:nth-child(3) {
    transform: rotate(-45deg);
    top: 19px;
}

/* Sidebar mobile */
.mobile-sidebar {
    position: fixed;
    top: var(--nav-height);
    left: -100% !important; /* Force fermeture au chargement */
    width: var(--sidebar-width);
    height: calc(100vh - var(--nav-height));
    background: var(--nav-bg);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    overflow-y: auto;
    z-index: 999;
}

.mobile-sidebar.active {
    left: 0 !important;
}

.mobile-sidebar-overlay {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 998;
}

.mobile-sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.mobile-nav-links {
    padding: 2rem 0;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    color: var(--nav-text);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10;
    cursor: pointer;
}

.mobile-nav-link:hover {
    background: rgba(165, 120, 232, 0.1);
}

.mobile-nav-link.active {
    background: var(--nav-accent);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
        flex-direction: row-reverse; /* Inverse l'ordre : logo à droite, menu à gauche */
    }
    
    .nav-links {
        display: none;
    }
    
    .nav-actions {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
        order: -1; /* Force le menu burger à gauche */
    }
    
    .nav-logo {
        font-size: 1.2rem;
        margin-left: auto; /* Pousse le logo à droite */
    }
}

/* Ajuster le contenu pour le header fixe */
body {
    padding-top: calc(var(--nav-height) + 2rem);
    margin: 0;
}

/* Ajustement spécifique pour les sections hero */
.hero-gradient {
    margin-top: 0;
    padding-top: calc(var(--nav-height) + 3rem);
}

/* Ajustement pour les conteneurs principaux */
.main-container {
    margin-top: 2rem;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.mobile-sidebar.active {
    animation: slideIn 0.3s ease;
}

/* Fix blocage écran */
body.sidebar-open {
    overflow: hidden;
}

body:not(.sidebar-open) {
    overflow: auto !important;
}

/* Forcer la fermeture au chargement */
.mobile-sidebar:not(.active) {
    left: -100% !important;
}

.mobile-sidebar-overlay:not(.active) {
    display: none !important;
}
