/* ============================================
   SIDEBAR NAVIGATION - BIBLIOTHÈQUE
   Design moderne avec navigation par sections
   ============================================ */

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

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

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

.bibliotheque-sidebar {
    width: 320px;
    min-width: 320px;
    background: #fef8f3; /* Fond orangé très doux */
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    padding: 1.75rem;
    height: fit-content;
    position: sticky;
    top: 100px;
    transition: all 0.3s ease;
}

/* Sidebar Scrollable si trop haute */
.bibliotheque-sidebar {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.bibliotheque-sidebar::-webkit-scrollbar {
    width: 6px;
}

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

/* ========================================
   SIDEBAR HEADER
   ======================================== */

.sidebar-nav-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.sidebar-nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #3d3229;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav-title i {
    color: var(--primary-color);
}

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

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

.sidebar-search input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
    color: #3d3229;
}

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

.sidebar-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

/* ========================================
   NAVIGATION PAR SECTIONS
   ======================================== */

.sidebar-nav-section {
    margin-bottom: 1.5rem;
}

.sidebar-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    margin-bottom: 0.5rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    text-decoration: none;
    color: #6b5d4f;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

.sidebar-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--primary-color);
    border-color: rgba(124, 58, 237, 0.2);
}

.sidebar-nav-link:hover i {
    transform: scale(1.1);
}

.sidebar-nav-link.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
}

.sidebar-nav-link.active i {
    transform: scale(1.15);
}

/* Compteur de ressources */
.resource-count {
    margin-left: auto;
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}

.sidebar-nav-link.active .resource-count {
    background: var(--primary-color);
    color: white;
}

/* ========================================
   CONTENU PRINCIPAL
   ======================================== */

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

/* Ajustement des sections */
.library-section {
    scroll-margin-top: 120px; /* Compensation pour navbar sticky */
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media screen and (max-width: 1024px) {
    .bibliotheque-layout {
        flex-direction: column;
        padding: 1.5rem 1rem;
    }

    .bibliotheque-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 320px;
        height: 100vh;
        max-height: 100vh;
        z-index: 10000;
        transition: left 0.3s ease;
        border-radius: 0;
        box-shadow: none;
    }

    .bibliotheque-sidebar.active {
        left: 0;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.2);
    }

    .bibliotheque-content {
        width: 100%;
    }
}

/* ========================================
   BOUTON MOBILE D'OUVERTURE SIDEBAR
   ======================================== */

.mobile-nav-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
    cursor: pointer;
    z-index: 9999;
    font-weight: 700;
    font-size: 0.95rem;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.mobile-nav-toggle:hover {
    background: var(--primary-dark);
    box-shadow: 0 12px 32px rgba(124, 58, 237, 0.5);
    transform: translateY(-2px);
}

.mobile-nav-toggle i {
    font-size: 1.1rem;
}

@media screen and (max-width: 1024px) {
    .mobile-nav-toggle {
        display: flex;
    }
}

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

.sidebar-nav-overlay.active {
    display: block;
    opacity: 1;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@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; }
