/* ==========================================================================
   OHDB SIDEBAR : MAYFLY TACTICAL INTERFACE (V4 FINAL - NEON EDITION)
   Theme: Stardust / High-Tech / Gritty
   ========================================================================== */

/* --- CONTENEUR PRINCIPAL --- */
.side-nav {
    height: 100%;
    width: 85px; /* Largeur fermée */
    position: fixed;
    top: 0;
    left: 0;
    
    /* --- FOND & TEXTURE STARDUST --- */
    /* 1. Couleur de base sombre */
    background-color: rgba(9, 11, 16, 0.50);
    
    /* 2. Texture de bruit numérique (Noise) pour l'aspect "Gritty/Réaliste" */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
    
    /* 3. Fusion de la couleur et de la texture (Vital pour l'effet Breathe) */
    background-blend-mode: overlay;
    
    /* --- EFFET VERRE (GLASSMORPHISM) --- */
    backdrop-filter: blur(12px) saturate(110%);
    -webkit-backdrop-filter: blur(12px) saturate(110%);
    
    /* Bordures et Ombres */
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 
        5px 0 30px rgba(0, 0, 0, 0.5),
        inset 1px 0 0 rgba(255, 255, 255, 0.05);
    
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;

    /* ANIMATION PAR DÉFAUT (Fermé = Respiration calme et transparente) */
    animation: livingInterfaceClosed 6s ease-in-out infinite;
}

/* --- ANIMATIONS DE RESPIRATION (BREATHE) --- */

/* État Fermé : Plus transparent pour voir le fond étoilé */
@keyframes livingInterfaceClosed {
    0%, 100% { 
        border-right-color: rgba(255, 255, 255, 0.05);
        background-color: rgba(9, 11, 16, 0.50);
    }
    50% { 
        border-right-color: rgba(104, 253, 214, 0.35); 
        background-color: rgba(15, 35, 40, 0.65); /* Teinte Cyan sombre */
        box-shadow: 5px 0 40px rgba(104, 253, 214, 0.15);
    }
}

/* État Ouvert : Plus opaque pour la lisibilité du texte */
@keyframes livingInterfaceOpen {
    0%, 100% { 
        border-right-color: rgba(255, 255, 255, 0.05);
        background-color: rgba(5, 7, 10, 0.85); /* Fond lisible */
    }
    50% { 
        border-right-color: rgba(104, 253, 214, 0.35); 
        background-color: rgba(10, 20, 25, 0.92); /* Variation subtile */
        box-shadow: 5px 0 40px rgba(104, 253, 214, 0.15);
    }
}

/* --- EFFET "DATA STREAM" (Bordure Énergétique Verticale) --- */
.side-nav::after {
    content: '';
    position: absolute;
    top: 0;
    right: -1px; 
    width: 2px;
    height: 100%;
    
    /* Rayon laser qui monte et descend */
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(104, 253, 214, 0) 30%,
        rgba(104, 253, 214, 1) 50%, /* Coeur brillant */
        rgba(104, 253, 214, 0) 70%,
        transparent 100%
    );
    
    background-size: 100% 200%;
    animation: dataStream 5s ease-in-out infinite;
    z-index: 1004;
    pointer-events: none;
}

@keyframes dataStream {
    0% { background-position: 0% 0%; }    /* Haut */
    50% { background-position: 0% 100%; }  /* Bas */
    100% { background-position: 0% 0%; }   /* Haut */
}

/* --- ÉTAT OUVERT (Expanded / Locked) --- */
.side-nav.menu-expanded, 
.side-nav.locked {
    width: 360px;
    backdrop-filter: blur(15px); /* Flou plus fort */
    
    /* Changement d'animation pour garantir la lisibilité */
    animation: livingInterfaceOpen 6s ease-in-out infinite; 
}


/* ==========================================================================
   ELEMENTS D'INTERFACE
   ========================================================================== */

/* --- BOUTON ÉPINGLER --- */
.pin-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #4a6fa5;
    cursor: pointer;
    opacity: 0; 
    transition: all 0.3s ease;
    z-index: 1003; 
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.pin-btn svg {
    width: 18px;
    height: 18px;
}

/* Visible uniquement si menu ouvert */
.side-nav.menu-expanded .pin-btn,
.side-nav.locked .pin-btn {
    opacity: 1;
}

.pin-btn:hover {
    color: #68fdd6;
    filter: drop-shadow(0 0 5px #68fdd6);
}

.side-nav.locked .pin-btn {
    color: #68fdd6;
    transform: rotate(45deg); 
}


/* --- EN-TÊTE --- */
.side-nav-header {
    height: 80px;
    min-height: 80px;
    max-height: 80px;
    padding: 0 20px; /* Supprime le padding haut/bas de 20px qui faisait passer la hauteur à 90px */
    background: transparent; 
    border-bottom: none;
    display: flex;
    justify-content: center; 
    position: relative;
    align-items: center;
    white-space: nowrap;
    z-index: 1003;
    flex-shrink: 0;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(104, 253, 214, 0.1);
    flex-shrink: 0;
}

.side-nav.menu-expanded .side-nav-header,
.side-nav.locked .side-nav-header {
    justify-content: flex-start; 
}


/* --- ITEMS DE MENU (Global) --- */
.nav-item-header {
    display: flex;
    align-items: center;
    padding: 15px 0; 
    justify-content: center; 
    text-decoration: none;
    color: #d0d0d0; 
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02); /* Séparateur ultra-fin */
    cursor: pointer;
    white-space: nowrap;
    position: relative; /* Important pour les crochets */
    z-index: 1003; 
}

.side-nav.menu-expanded .nav-item-header,
.side-nav.locked .nav-item-header {
    justify-content: flex-start;
    padding: 15px 20px;
}

/* --- ICÔNES --- */
.icone-menu {
    width: 28px;
    height: 28px;
    min-width: 28px;
    object-fit: contain;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.8));
    margin: 0;
    transition: margin 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.side-nav.menu-expanded .icone-menu,
.side-nav.locked .icone-menu {
    margin-right: 15px;
}

/* --- TITRES --- */
.nav-item-title {
    font-size: 14px;
    font-weight: bold;
    display: none; 
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #e0e0e0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.side-nav.menu-expanded .nav-item-title,
.side-nav.locked .nav-item-title {
    display: block;
    animation: fadeIn 0.3s ease forwards;
}


/* ==========================================================================
   EFFETS TACTIQUES HUD [ ]
   ========================================================================== */

/* 1. CONFIGURATION DE BASE (Invisible par défaut) */
/* Cible : a.nav-item-header (Liens) ET .sub-nav li a (Sous-menus) */
a.nav-item-header::before,
a.nav-item-header::after,
.sub-nav li a::before,
.sub-nav li a::after {
    content: '';
    position: absolute;
    opacity: 0;
    border: 2px solid #68fdd6; /* Cyan Mayfly */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 10;
}

/* Sécurisation du positionnement */
.sub-nav li a {
    position: relative; 
    display: flex;
}

/* 2. STYLE & POSITION - ITEMS PRINCIPAUX */
a.nav-item-header::before,
a.nav-item-header::after {
    width: 8px;
    height: 8px;
}

/* Haut Gauche */
a.nav-item-header::before {
    top: 10px;
    left: 8px;
    border-right: none;
    border-bottom: none;
    transform: translate(6px, 6px);
}
/* Bas Droite */
a.nav-item-header::after {
    bottom: 10px;
    right: 8px;
    border-left: none;
    border-top: none;
    transform: translate(-6px, -6px);
}

/* 3. STYLE & POSITION - SOUS-MENUS (Plus fins) */
.sub-nav li a::before,
.sub-nav li a::after {
    width: 6px; 
    height: 6px;
    border-width: 1px;
}

/* Haut Gauche (Sous-menu) */
.sub-nav li a::before {
    top: 50%;
    left: 10px;
    margin-top: -10px;
    border-right: none;
    border-bottom: none;
    transform: translate(4px, 4px);
}
/* Bas Droite (Sous-menu) */
.sub-nav li a::after {
    top: 50%;
    right: 10px; 
    margin-top: 4px;
    border-left: none;
    border-top: none;
    transform: translate(-4px, -4px);
}

/* 4. DÉCLENCHEURS (HOVER) */
/* Activation uniquement si menu ouvert/locké pour les items principaux */
.side-nav.menu-expanded a.nav-item-header:hover::before,
.side-nav.locked a.nav-item-header:hover::before,
.side-nav.menu-expanded a.nav-item-header:hover::after,
.side-nav.locked a.nav-item-header:hover::after,
.sub-nav li a:hover::before,
.sub-nav li a:hover::after {
    opacity: 1;
    transform: translate(0, 0);
}

/* Empêcher les crochets de s'afficher sur l'élément actif (pour éviter surcharge avec le nouveau style) */
a.nav-item-header.active::before,
a.nav-item-header.active::after,
.sub-nav li a.active::before,
.sub-nav li a.active::after {
    display: none !important;
}


/* ==========================================================================
   ETATS ACTIFS & MICRO-INTERACTIONS (+ GLITCH)
   ========================================================================== */

/* --- KEYFRAMES GLITCH --- */
@keyframes glitchText {
    0% { text-shadow: 0 0 0 transparent; }
    20% { text-shadow: -2px 0 #ff00c1, 2px 0 #00fff9; } /* Magenta / Cyan */
    40% { text-shadow: -1px 0 #ff00c1, 1px 0 #00fff9; }
    60% { text-shadow: 0 0 0 transparent; }
    80% { text-shadow: 1px 0 #ff00c1, -1px 0 #00fff9; }
    100% { text-shadow: 0 0 0 transparent; }
}

/* --- HOVER GLOBAL --- */
.nav-item-header:hover {
    background: rgba(104, 253, 214, 0.05);
    color: #ffffff;
}

/* Effet Glitch sur le Titre Principal */
.nav-item-header:hover .nav-item-title {
    animation: glitchText 0.3s cubic-bezier(.25, .46, .45, .94) both infinite;
    color: #ffffff;
}

/* Zoom de l'icône */
.nav-item-header:hover .icone-menu {
    transform: scale(1.1); 
    filter: drop-shadow(0 0 8px rgba(104, 253, 214, 0.6));
}

/* --- HOVER SOUS-MENUS (AVEC GLITCH) --- */
.sub-nav li a:hover {
    color: #ffffff; 
    background-color: rgba(104, 253, 214, 0.05);
    border-left: 3px solid #68fdd6;
    padding-left: 30px; 
    /* Application du Glitch sur le texte du sous-menu */
    animation: glitchText 0.3s cubic-bezier(.25, .46, .45, .94) both infinite;
}


/* --- ÉLÉMENT ACTIF (PAGE COURANTE) - NOUVEAU STYLE NEON --- */

/* 1. Le conteneur du lien actif (Menu principal) */
.nav-item-header.active {
    /* Fond : Dégradé subtil partant de la gauche (Cyan transparent -> Transparent) */
    background: linear-gradient(90deg, rgba(104, 253, 214, 0.15) 0%, rgba(104, 253, 214, 0) 100%);
    
    /* Barre latérale : Ligne franche couleur Cyan */
    border-left: 3px solid #68fdd6;
    
    /* Texte : Blanc pur pour le contraste */
    color: #ffffff;
    
    /* Lueur : Très légère ambiance autour de l'élément */
    box-shadow: inset 10px 0 20px -10px rgba(104, 253, 214, 0.2);
    
    padding-left: 18px; /* Ajustement pour compenser la bordure */
    font-weight: 600;
}

/* 2. Le conteneur du lien actif (Sous-menu) */
.sub-nav li a.active {
    background: linear-gradient(90deg, rgba(104, 253, 214, 0.15) 0%, rgba(104, 253, 214, 0) 100%);
    border-left: 3px solid #68fdd6;
    color: #ffffff;
    box-shadow: inset 10px 0 20px -10px rgba(104, 253, 214, 0.2);
    font-weight: 600;
}

/* 3. L'icône active (Menu principal & Sous-menu) */
.nav-item-header.active .icone-menu,
.sub-nav li a.active .sub-nav-icon {
    /* L'icône brille légèrement */
    filter: drop-shadow(0 0 4px rgba(104, 253, 214, 0.6));
    transform: scale(1.05);
    transition: all 0.3s ease;
}


/* --- PARENT D'UNE RUBRIQUE ACTIVE --- */
.nav-bloc .nav-item-header.active { 
    color: #ffffff;
    background: linear-gradient(90deg, rgba(104, 253, 214, 0.08) 0%, transparent 100%);
    border-left: 3px solid rgba(104, 253, 214, 0.6);
}


/* ==========================================================================
   SOUS-MENUS (STRUCTURE)
   ========================================================================== */
.sub-nav {
    list-style-type: none;
    padding: 0;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.3); 
    display: block;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease-out, opacity 0.3s ease;
    position: relative;
    z-index: 1003;
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.3);
}

.side-nav.menu-expanded .nav-bloc:hover .sub-nav,
.side-nav.locked .nav-bloc:hover .sub-nav {
    max-height: 600px; 
    opacity: 1;
    border-bottom: 1px solid rgba(104, 253, 214, 0.1);
    border-top: 1px solid rgba(104, 253, 214, 0.05);
}

.sub-nav li a {
    display: flex;
    align-items: center;
    padding: 12px 15px 12px 25px; 
    text-decoration: none;
    color: #b0b0b0;
    font-size: 13px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sub-nav-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    flex-shrink: 0;
    margin-right: 12px;
    opacity: 0.85;
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.25));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
}

.sub-nav li a:hover .sub-nav-icon {
    opacity: 1;
    transform: scale(1.1);
}

.sub-nav li a.active .sub-nav-icon {
    opacity: 1;
    filter: drop-shadow(0 0 4px #68fdd6);
}

/* Séparateurs de Blocs */
.nav-bloc {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03); 
}


/* ==========================================================================
   FOOTER & SCROLLBAR
   ========================================================================== */

/* --- FOOTER --- */
.side-nav-footer {
    margin-top: auto;
    flex-shrink: 0;
    border-top: 1px solid rgba(104, 253, 214, 0.1);
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1003;
}

/* Animation Discord "Incoming Transmission" */
.discord-icon {
    animation: discordShake 5s infinite;
}

@keyframes discordShake {
    0%, 90% { transform: rotate(0deg); }
    91% { transform: rotate(-10deg); filter: drop-shadow(0 0 5px #7289da); }
    93% { transform: rotate(10deg); }
    95% { transform: rotate(-10deg); }
    97% { transform: rotate(10deg); }
    100% { transform: rotate(0deg); }
}

.side-nav-footer a:hover .discord-icon {
    filter: drop-shadow(0 0 8px #5865F2) brightness(1.2);
    animation: none;
}

/* Animation de base */
@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.side-nav-scroll-wrapper {
    position: relative;
    flex: 1 1 auto;
    min-height: 0; /* Indispensable pour que le flex-child puisse défiler */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-nav-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    /* Masquage total de la scrollbar sur Firefox et IE/Edge */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Masquage total de la scrollbar sur Chrome, Safari, Opera, Edge */
.side-nav-content::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}

/* Fondu progressif (mask-image) indiquant que la liste continue */
.side-nav-scroll-wrapper.can-scroll-bottom .side-nav-content {
    -webkit-mask-image: linear-gradient(to bottom, #000 84%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 84%, transparent 100%);
}

.side-nav-scroll-wrapper.can-scroll-top .side-nav-content {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 16%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 16%);
}

.side-nav-scroll-wrapper.can-scroll-top.can-scroll-bottom .side-nav-content {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 14%, #000 86%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 14%, #000 86%, transparent 100%);
}

/* Chevrons lumineux HUD en haut et en bas de la zone de défilement */
.nav-scroll-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #68fdd6;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 1005;
}

.nav-scroll-indicator svg {
    width: 16px;
    height: 16px;
    filter: drop-shadow(0 0 6px rgba(104, 253, 214, 0.8));
}

.nav-scroll-indicator--top {
    top: 0;
    background: linear-gradient(to bottom, rgba(9, 11, 16, 0.85), transparent);
}

.nav-scroll-indicator--top svg {
    animation: navChevronUp 1.6s ease-in-out infinite;
}

.nav-scroll-indicator--bottom {
    bottom: 0;
    background: linear-gradient(to top, rgba(9, 11, 16, 0.85), transparent);
}

.nav-scroll-indicator--bottom svg {
    animation: navChevronDown 1.6s ease-in-out infinite;
}

.side-nav-scroll-wrapper.can-scroll-top .nav-scroll-indicator--top,
.side-nav-scroll-wrapper.can-scroll-bottom .nav-scroll-indicator--bottom {
    opacity: 0.9;
}

@keyframes navChevronDown {
    0%, 100% { transform: translateY(-2px); opacity: 0.5; }
    50% { transform: translateY(2px); opacity: 1; }
}

@keyframes navChevronUp {
    0%, 100% { transform: translateY(2px); opacity: 0.5; }
    50% { transform: translateY(-2px); opacity: 1; }
}