/* ========================================
   GLOSSAIRE SIDEBAR NAVIGATION - VERSION 1.0
   Système de navigation latérale moderne pour le glossaire
   Cohérent avec outils.html et bibliotheque.html
   ======================================== */

/* ========================================
   LAYOUT GLOBAL AVEC SIDEBAR
   ======================================== */

.glossary-layout {
    display: flex;
    gap: 3rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
}

/* ========================================
   SIDEBAR - Structure principale
   ======================================== */

.glossary-sidebar {
    width: 320px;
    min-width: 320px;
    background: #fef8f3; /* Beige orangé doux */
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 100px;
    transition: all 0.3s ease;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* Scrollbar styling pour la sidebar */
.glossary-sidebar::-webkit-scrollbar {
    width: 6px;
}

.glossary-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.glossary-sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* ========================================
   EN-TÊTE DE LA SIDEBAR
   ======================================== */

.sidebar-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0d5b8;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-title i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.sidebar-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

/* ========================================
   BARRE DE RECHERCHE DANS LA SIDEBAR
   ======================================== */

.sidebar-search {
    position: relative;
    margin-bottom: 1.5rem;
}

.sidebar-search input {
    width: 100%;
    padding: 0.7rem 2.5rem 0.7rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.sidebar-search i {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

/* ========================================
   NAVIGATION PAR CATÉGORIES
   ======================================== */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    background: white;
    text-decoration: none;
}

.sidebar-nav-item i {
    font-size: 1.1rem;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.sidebar-nav-item:hover {
    background: #f0d5b8;
    color: #2d3748;
    transform: translateX(4px);
}

.sidebar-nav-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.sidebar-nav-item.active i {
    color: white;
}

/* Badge avec compteur de termes */
.sidebar-nav-item .term-count {
    margin-left: auto;
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.sidebar-nav-item.active .term-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ========================================
   BOUTON MOBILE (Menu flottant)
   ======================================== */

.sidebar-toggle-mobile {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
}

.sidebar-toggle-mobile:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.5);
}

/* Overlay pour mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ========================================
   CONTENU PRINCIPAL (GLOSSARY TERMS)
   ======================================== */

.glossary-content {
    flex: 1;
    min-width: 0;
}

/* ========================================
   RESPONSIVE - VERSION MOBILE
   ======================================== */

@media screen and (max-width: 1200px) {
    .glossary-layout {
        padding: 1.5rem 1rem;
        gap: 2rem;
    }
    
    .glossary-sidebar {
        width: 280px;
        min-width: 280px;
    }
}

@media screen and (max-width: 768px) {
    .glossary-layout {
        flex-direction: column;
        padding: 1rem;
    }
    
    /* Sidebar devient un menu coulissant sur mobile */
    .glossary-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        max-height: 100vh;
        z-index: 999;
        transition: left 0.3s ease;
        border-radius: 0;
        padding-top: 4rem;
    }
    
    .glossary-sidebar.mobile-open {
        left: 0;
    }
    
    /* Bouton de fermeture pour mobile */
    .sidebar-close-mobile {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: transparent;
        border: none;
        font-size: 1.5rem;
        color: #64748b;
        cursor: pointer;
        padding: 0.5rem;
        line-height: 1;
    }
    
    /* Afficher le bouton flottant sur mobile */
    .sidebar-toggle-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Overlay visible sur mobile */
    .sidebar-overlay {
        display: block;
    }
    
    .glossary-content {
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .glossary-sidebar {
        width: 90%;
    }
    
    .sidebar-toggle-mobile {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        bottom: 15px;
        right: 15px;
    }
}

/* ========================================
   ANIMATIONS & MICRO-INTERACTIONS
   ======================================== */

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-nav-item {
    animation: slideInRight 0.3s ease forwards;
}

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