/* ============================================
   SIDEBAR FILTERS - Le Hub du Formateur 4.0
   Sidebar gauche avec filtres enrichis
   ============================================ */

/* ========================================
   LAYOUT PRINCIPAL - SIDEBAR + CONTENT
   ======================================== */

.page-layout-with-sidebar {
    display: flex;
    gap: 3rem; /* Plus d'espace entre sidebar et contenu */
    max-width: 1600px; /* Layout plus large et moderne */
    margin: 0 auto;
    padding: 2rem 2rem; /* Padding réduit pour utiliser plus l'espace */
    position: relative;
}

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

.filters-sidebar {
    width: 320px; /* Sidebar plus large pour plus de confort */
    min-width: 320px;
    background: #fef8f3; /* Fond orangé très doux (proche de #f0d5b8 mais plus clair) */
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    padding: 1.75rem; /* Légèrement plus de padding */
    height: fit-content;
    position: sticky;
    top: 100px; /* Sous la navbar */
    transition: all 0.3s ease;
}

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

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

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

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

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-lightest);
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Bouton Reset */
.reset-filters-btn {
    background: transparent;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.reset-filters-btn:hover {
    background: var(--gray-lightest);
    color: var(--primary-color);
}

.reset-filters-btn i {
    font-size: 1rem;
}

/* ========================================
   SEARCH BAR DANS SIDEBAR
   ======================================== */

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

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--gray);
    pointer-events: none;
}

.sidebar-search input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 2px solid var(--gray-lightest);
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: var(--white);
}

.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 input::placeholder {
    color: var(--gray-light);
}

/* ========================================
   FILTER SECTIONS
   ======================================== */

.filter-section {
    margin-bottom: 1.75rem;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-section-title i {
    font-size: 0.9rem;
}

/* ========================================
   FILTER OPTIONS (Checkboxes)
   ======================================== */

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.filter-option:hover {
    background: var(--gray-lightest);
}

/* Checkbox personnalisée */
.filter-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--gray-light);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.filter-option input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.filter-option input[type="checkbox"]:checked::after {
    content: '\f00c'; /* FontAwesome check icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 11px;
}

.filter-option input[type="checkbox"]:hover {
    border-color: var(--primary-color);
}

/* Label du filtre */
.filter-label {
    flex: 1;
    font-size: 0.95rem;
    color: var(--dark);
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.filter-option:hover .filter-label {
    color: var(--primary-color);
}

/* Compteur de résultats */
.filter-count {
    background: var(--gray-lightest);
    color: var(--gray);
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}

.filter-option input[type="checkbox"]:checked ~ .filter-count {
    background: var(--primary-color);
    color: white;
}

/* ========================================
   CONTENT AREA (zone principale)
   ======================================== */

.content-with-sidebar {
    flex: 1;
    min-width: 0; /* Important pour le responsive */
}

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

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

    .filters-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;
    }

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

    .content-with-sidebar {
        width: 100%;
    }
}

/* ========================================
   MOBILE - Bouton d'ouverture de la sidebar
   ======================================== */

.mobile-filters-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;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

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

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

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

/* ========================================
   MOBILE - Overlay (fond sombre)
   ======================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

@media screen and (min-width: 1025px) {
    .sidebar-overlay {
        display: none !important;
    }
}

/* ========================================
   MOBILE - Bouton de fermeture
   ======================================== */

.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--gray-lightest);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--gray);
    transition: all 0.2s ease;
}

.sidebar-close-btn:hover {
    background: var(--primary-color);
    color: white;
}

.sidebar-close-btn i {
    font-size: 1.2rem;
}

@media screen and (max-width: 1024px) {
    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

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

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.filters-sidebar.active {
    animation: slideInFromLeft 0.3s ease;
}

/* ========================================
   BADGES & INDICATORS
   ======================================== */

.active-filters-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

/* Badge sur le bouton mobile */
.mobile-filters-toggle .active-filters-badge {
    background: white;
    color: var(--primary-color);
}

/* ========================================
   ÉTATS VIDES
   ======================================== */

.no-results-sidebar {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--gray);
}

.no-results-sidebar i {
    font-size: 3rem;
    color: var(--gray-light);
    margin-bottom: 1rem;
}

/* ========================================
   ACCESSIBILITÉ
   ======================================== */

.filter-option:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip navigation pour les lecteurs d'écran */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-weight: 600;
    z-index: 100000;
}

.skip-to-content:focus {
    top: 10px;
}
