:root {
    --header-height: 80px;
    --neon-green: #00ff88;
    --dark-green: #006b3b;
    --bg-dark: #1a1a2e;
    --white: #ffffff;
    --bg-white: #ffffff;
    --bg-light: #fafafa;
    --bg-lighter: #f8f9fa;
    --text-dark: #2d3748;
    --text-gray: #718096;
    --text-light: #a0aec0;
    --border-light: #e2e8f0;
    --border-lighter: #edf2f7;
    --primary: #4a5568;
    --accent: #718096;
    --primary-color: #4a90e2;
    --soft-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    --glow: 0 0 20px;
}

html,
body {
    height: 100%;
}



/* Header élégant */
.header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    border-bottom: 1px solid var(--border-lighter);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.dark .header {
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--neon-green);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 60px;
    opacity: 0.9;
}

.dark .logo-img {
    filter: drop-shadow(0 0 5px var(--neon-green));
}

.logo-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

.dark .logo-text {
    background: linear-gradient(90deg, var(--neon-green), #00ffcc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-links a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
}

.dark .nav-links a {
    color: var(--white);
    position: relative;
    padding: 5px 0;
}

.nav-links a:hover {
    color: var(--text-dark);
}

.dark .nav-links a:hover {
    color: var(--white);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--text-dark);
    transition: width 0.3s ease;
}

.dark .nav-links a:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background: var(--neon-green);
    bottom: 0;
    left: 0;
    transition: all 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Bouton Dark Mode amélioré */

.header-dark-toggle {
    /* 1. TAILLE COMPACTE */
    width: 56px;
    height: 28px;

    /* --- A. FOND PLUS CLAIR (Mode Jour) --- */
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 99px;

    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    box-sizing: border-box;

    transition: background-color 0.4s ease, border-color 0.4s ease;
}

/* 2. LA BILLE (Le bouton blanc) */
.header-dark-toggle::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;

    background: #ffffff;

    /* Ombre portée douce */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.5s cubic-bezier(0.34, 1.3, 0.64, 1), background-color 0.3s ease, box-shadow 0.3s ease;
    z-index: 2;
}

/* 3. LES ICÔNES  */
.header-dark-toggle span {
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    transition: all 0.3s ease;
}

/* Soleil (Agrandi) */
.header-dark-toggle .sun-icon {
    font-size: 14px;
    color: #f59e0b;
    opacity: 1;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

/* Lune (Gris clair argenté) */
.header-dark-toggle .moon-icon {
    font-size: 14px;
    color: #94a3b8;
    opacity: 1;
    margin-top: -1px;
}


/* ==================================================
   MODE SOMBRE : LE RAFFINEMENT
   ================================================== */

.dark .header-dark-toggle {
    /* Fond sombre transparent */
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(110, 231, 183, 0.2);
}

.dark .header-dark-toggle::before {
    transform: translateX(28px);

    /* --- B. ROND MOINS PRONONCÉ --- */
    background: #6ee7b7;

    /* --- C. GLOW RÉDUIT --- */
    box-shadow: 0 0 4px rgba(110, 231, 183, 0.3);
}

/* Icônes en Dark Mode */
.dark .header-dark-toggle .sun-icon {
    color: #64748b;
    opacity: 0.5;
    filter: none;
}

.dark .header-dark-toggle .moon-icon {
    color: #ffffff;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
    /* Halo réduit aussi */
    transform: scale(1);
}

/* Hover Effect */
.header-dark-toggle:hover::before {
    transform: scale(1.05);
}

.dark .header-dark-toggle:hover::before {
    transform: translateX(28px) scale(1.05);
}


/* Styles pour le menu profil */
.profile-menu {
    position: relative;
    display: inline-block;
    margin-left: 20px;
}

/* --- STYLE DE BASE (MODE CLAIR) --- */
/* --- STYLE DE BASE (MODE CLAIR) --- */
.profile-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;

    /* CORRECTION : On enlève la bordure externe qui ne sert à rien */
    border: none;

    /* L'ARME ABSOLUE CONTRE LES PIXELS : */
    /* On dessine un trait de 1px VERS L'INTÉRIEUR (inset) */
    /* Couleur : Noir à 10% d'opacité (invisible à l'œil, mais lisse le bord) */
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);

    /* On garde vos optimisations, elles sont bonnes */
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;

    /* Transition sur l'ombre au lieu de la bordure */
    transition: box-shadow 0.3s ease;
}

/* --- STYLE MODE SOMBRE --- */
.dark .profile-avatar {
    /* En mode sombre, on passe l'ombre interne en BLANC léger (15%) */
    /* Cela permet de détourer proprement le rond sur le fond noir */
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.profile-avatar:hover {
    border-color: var(--text-gray);
}

.profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1rem;
    width: 200px;
    z-index: 1000;
    box-shadow: var(--soft-shadow);
    transition: all 0.3s ease;
}

/* =================================================================
   CORRECTIF ISOLATION DROPDOWN & BOUTONS
   ================================================================= */

/* 1. ISOLATION DU CONTENEUR (Fond stable garanti) */
.dark .profile-dropdown {
    /* On force le code couleur HEX pour éviter que la variable --bg-dark 
       ne change selon la page ou qu'une transparence laisse passer le fond */
    background-color: #1a1a2e !important;

    /* On s'assure que la bordure et l'ombre sont "pop" et constantes */
    border: 1px solid #00ff88 !important;
    /* Force le vert néon */
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.15) !important;
}

/* 2. UNIFICATION DES 3 BOUTONS (Normal & Hover) */
/* On cible TOUS les boutons du menu avec une seule liste pour être sûr qu'ils sont identiques */
.dark #changeAvatarBtn,
.dark #logoutBtn,
.dark .profile-action-btn,
.dark .profile-dropdown button,
/* Sécurité supplémentaire */
.dark .profile-dropdown a {
    /* Sécurité si un bouton devient un lien */
    background: rgba(0, 255, 136, 0.05) !important;
    /* Fond vert très léger */
    border: 1px solid rgba(0, 255, 136, 0.5) !important;
    /* Bordure semi-transparente */
    color: #ffffff !important;
    transition: all 0.3s ease;
    text-shadow: none;
    box-shadow: none;
}

/* 3. LE HOVER PARFAIT (Glow identique pour tous) */
.dark #changeAvatarBtn:hover,
.dark #logoutBtn:hover,
.dark .profile-action-btn:hover,
.dark .profile-dropdown button:hover,
.dark .profile-dropdown a:hover {
    background: rgba(0, 255, 136, 0.2) !important;
    /* Le vert s'intensifie */
    border-color: #00ff88 !important;
    /* La bordure devient 100% visible */
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.25) !important;
    /* Petit effet néon */
    color: #ffffff !important;
    transform: translateY(-1px);
    /* Petit effet de levier premium */
}



.profile-menu:hover .profile-dropdown {
    display: block;
}

.profile-info span {
    display: block;
    color: var(--text-dark);
}

.dark .profile-info span {
    color: white;
}

#profileName {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Sécurisation du Nom (Jojo Mehdi) */
.dark #profileName {
    color: #ffffff !important;
    /* Force le blanc pur partout */
    font-weight: 600;
    /* Garde le texte bien gras */
    text-decoration: none;
    /* Sécurité anti-soulignement */
}

#profileEmail {
    font-size: 0.8rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.dark #profileEmail {
    /* On force la couleur en gris très clair pour qu'il ressorte sur le fond sombre */
    color: #cbd5e0 !important;

    font-size: 0.8rem;
    margin-bottom: 1rem;
    opacity: 1 !important;
    /* On gère la couleur directement, donc on remet l'opacité à 100% pour la netteté */
}

#changeAvatarBtn,
#logoutBtn {
    width: 100%;
    padding: 0.7rem;
    margin: 0.3rem 0;
    background: transparent;
    color: var(--text-dark);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}



#changeAvatarBtn:hover,
#logoutBtn:hover {
    background: var(--bg-lighter);
    border-color: var(--border-light);
}

.profile-action-btn {
    display: block;
    width: 100%;
    padding: 0.7rem;
    margin: 0.3rem 0;
    background: transparent;
    color: var(--text-dark) !important;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}



.profile-action-btn:hover {
    background: var(--bg-lighter);
}


/* Lien accueil logo */
.logo-link {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.dark .logo-link:hover .logo-text {
    text-shadow: 0 0 10px var(--neon-green);
}

/* =================================================================
   RESPONSIVE : CORRECTION "INTEGORA VISIBLE"
   ================================================================= */

@media (max-width: 768px) {
    .header {
        padding: 0 20px;
    }
}

@media (max-width: 600px) {

    /* 1. CONTENEUR GLOBAL */
    .header {
        height: auto !important;
        min-height: 100px;
        padding: 15px 20px !important;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    /* 2. LOGO + TEXTE INTEGORA */
    .logo-container {
        order: 1;
        margin-right: auto;
        /* Pousse le reste à droite */
        margin-bottom: 10px;
        display: flex !important;
        /* Force l'alignement horizontal */
        align-items: center !important;
        max-width: 70%;
        /* Laisse de la place pour le bouton dark mode */
    }

    .logo-img {
        height: 32px !important;
        width: auto;
        /* Garde les proportions */
    }

    /* C'est ici que la magie opère pour INTEGORA */
    .logo-text {
        display: block !important;
        /* On force l'affichage */
        font-size: 1rem !important;
        /* Légèrement plus petit pour tenir */
        margin-left: 8px;
        /* Espace entre logo et texte */
        white-space: nowrap;
        /* Empêche le texte de passer à la ligne */
    }

    /* 3. BOUTONS (Dark Mode + Profil) */
    .header-dark-toggle,
    .profile-menu {
        order: 2;
        margin-bottom: 10px !important;
        margin-left: 10px;
        transform: scale(0.9);
        /* Un peu plus petits sur mobile */
    }

    /* 4. LIGNE DE SÉPARATION */
    .header::after {
        content: '';
        display: block;
        width: 100%;
        height: 1px;
        background: var(--border-light);
        opacity: 0.5;
        margin-bottom: 15px;
        order: 3;
    }

    .dark .header::after {
        background: var(--border-dark);
        opacity: 0.3;
    }

    /* 5. NAVIGATION EN BAS */
    .nav-links {
        order: 4;
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 15px !important;
        /* Un peu moins d'écart pour éviter le débordement */
        margin: 0 !important;
        padding: 0 !important;
    }

    .nav-links a {
        font-size: 0.9rem !important;
        font-weight: 600 !important;
        color: var(--text-dark) !important;
        text-decoration: none !important;
        padding: 5px 0 !important;
    }

    .dark .nav-links a {
        color: white !important;
    }
}

/* Cas extrême (Très petits écrans < 360px) */
@media (max-width: 360px) {
    .nav-links {
        gap: 10px !important;
    }

    .logo-text {
        font-size: 0.9rem !important;
        /* On réduit la taille au lieu de cacher */
        display: block !important;
        /* IMPORTANT : On ne cache plus le texte ! */
    }
}


/* On fixe le line-height pour tout le header pour éviter les différences entre pages */
.header,
.header * {
    line-height: 1.3;
}

/* [file name]: header.css - AJOUTS OPTIONNELS */
/* Ces styles améliorent la stabilité mais ne modifient pas le design existant */

/* Empêche les avatars de causer des shifts de layout */
.profile-avatar {
    display: block;
    aspect-ratio: 1/1;
    min-width: 45px;
    min-height: 45px;
}

/* Assure que le placeholder est toujours visible pendant le chargement */
.js-avatar[src*="data:image/svg+xml"] {
    background: transparent;
}

/* Optimisation du chargement des images */
.logo-img,
.profile-avatar {
    content-visibility: auto;
    contain-intrinsic-size: 60px 60px;
}

/* Transition douce pour les changements d'avatar */
.profile-avatar {
    transition: opacity 0.3s ease;
}