/* ========================================
   CONTENEUR PRINCIPAL
   ======================================== */
.partitions-library-container {
    display: flex;
    gap: 30px;
    margin: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ========================================
   COLONNE DES FILTRES
   ======================================== */
.partitions-filters {
    flex: 0 0 280px;
    background: #f9f9f9;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: fit-content;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.partitions-filters h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ddd;
    font-size: 20px;
    color: #333;
}

/* ========================================
   ACCORDÉONS (FILTRES REPLIABLES)
   ======================================== */
.filter-group {
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: white;
}

.filter-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.filter-toggle:hover {
    background: #f5f5f5;
}

.filter-toggle h4 {
    margin: 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
}

.toggle-icon {
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toggle-icon::before,
.toggle-icon::after {
    content: '';
    position: absolute;
    background: #333;
    transition: transform 0.3s ease;
}

.toggle-icon::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

.toggle-icon::after {
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

.filter-group.is-open .toggle-icon::after {
    transform: translateX(-50%) rotate(90deg);
    opacity: 0;
}

.filter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 15px;
}

.filter-group.is-open .filter-content {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

.filter-content label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
    padding: 6px 0;
    font-size: 14px;
    color: #555;
    transition: color 0.2s ease;
}

.filter-content label:hover {
    color: #0073aa;
}

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

.filter-content input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.filter-content .count {
    color: #999;
    font-size: 13px;
    margin-left: 4px;
}

/* Style de la scrollbar pour les filtres */
.filter-content::-webkit-scrollbar {
    width: 8px;
}

.filter-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.filter-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.filter-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Scrollbar pour Firefox */
.filter-content {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

.reset-btn {
    width: 100%;
    padding: 12px 20px;
    margin-top: 10px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.3s ease;
}

.reset-btn:hover {
    background: #005a87;
}

.reset-btn:active {
    transform: scale(0.98);
}

/* ========================================
   COLONNE DES RÉSULTATS
   ======================================== */
.partitions-results {
    flex: 1;
    position: relative;
    min-height: 400px;
}

.results-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.results-count {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

/* ========================================
   GRILLE DES PARTITIONS - 3 COLONNES
   ======================================== */
.partitions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.partition-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.partition-item:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.partition-thumbnail {
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 6px;
}

.partition-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.partition-thumbnail:hover img {
    transform: scale(1.05);
}

.partition-title {
    margin: 0 0 15px 0;
    font-size: 19px;
    line-height: 1.4;
}

.partition-title a {
    text-decoration: none;
    color: #222;
    transition: color 0.2s ease;
}

.partition-title a:hover {
    color: #0073aa;
}

.partition-meta {
    margin-bottom: 15px;
    flex-grow: 1;
}

.partition-meta p {
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #666;
}

.partition-meta strong {
    color: #444;
    font-weight: 600;
}

.partition-excerpt {
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.partition-link {
    display: inline-block;
    padding: 10px 18px;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s ease;
    align-self: flex-start;
}

.partition-link:hover {
    background: #005a87;
}

/* ========================================
   LOADER ET ÉTATS
   ======================================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 8px;
}

.loader {
    padding: 20px 50px;
    background: #0073aa;
    color: white;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.no-results {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: #999;
    font-size: 18px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

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

/* Écrans moyens : 2 colonnes */
@media screen and (max-width: 1200px) {
    .partitions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Tablettes : 1 colonne + filtres au-dessus */
@media screen and (max-width: 768px) {
    .partitions-library-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .partitions-filters {
        position: static;
        flex: 1;
        width: 100%;
        max-height: none;
    }
    
    .partitions-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobiles : optimisation espaces */
@media screen and (max-width: 480px) {
    .partitions-library-container {
        margin: 15px 0;
    }
    
    .partitions-filters {
        padding: 20px 15px;
    }
    
    .partition-item {
        padding: 15px;
    }
    
    .results-header {
        margin-bottom: 15px;
    }
    
    .filter-toggle {
        padding: 12px;
    }
    
    .partitions-grid {
        gap: 15px;
    }
    
    .filter-group.is-open .filter-content {
        max-height: 300px;
    }
}

/* Très grands écrans : maximum 3 colonnes */
@media screen and (min-width: 1800px) {
    .partitions-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
}
