/* ============================================================
   Cartes membres
   ============================================================ */

.carte-membre h3 {
    margin-top: 10px;
}
.carte-membre p {
    padding-bottom: 0 !important;
    margin: 0.2rem 0;
    line-height: 1.3;
}

/* ============================================================
   Layout principal — Desktop (> 1100px)
   ============================================================ */

.grille-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.contenu-principal {
    flex: 1;
    min-width: 0;
}

/* Sidebar */
.sidebar-filtres {
    position: sticky;
    /* Décalage pour passer sous le menu flottant du thème (~120px) */
    top: 140px;
    align-self: flex-start;
    background: #f5f5f5;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    width: 260px;
    min-width: 220px;
    flex-shrink: 0;
    height: fit-content;
}

.sidebar-filtres legend {
    color: #bae6e8;
    font-weight: bold;
    margin-bottom: 0.25rem;
    font-size: 18px;
}
.sidebar-filtres label {
    color: #161616;
    font-size: 0.8rem;
    line-height: 1.25;
    margin-bottom: 0.15rem;
    cursor: pointer;
}
.sidebar-filtres input[type="checkbox"] {
    accent-color: #bae6e8;
    width: 13px;
    height: 13px;
    vertical-align: middle;
    margin-right: 4px;
}

#illumina-compteur {
    margin-top: 0.5rem;
    font-weight: bold;
    color: #161616;
}

#illumina-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.75rem;
    padding: 0.3rem 1rem;
    background-color: #bae6e8;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
#illumina-reset:hover {
    background-color: #ff6866;
}

/* Bouton toggle : caché sur desktop */
.btn-toggle-filtres {
    display: none;
}

/* ============================================================
   Grille des cartes — Desktop
   ============================================================ */

.grille-membres {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.carte-membre {
    padding: 1rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.3s ease;
}
.carte-membre:hover {
    transform: translateY(-4px);
}
.carte-membre h3 a {
    text-decoration: none;
    color: #bae6e8;
    font-size: 1.1rem;
    font-weight: bold;
}
.carte-membre a.image-lien {
    display: block;
    position: relative;
    padding-top: 100%;
    overflow: hidden;
    border-radius: 12px;
}
.carte-membre a.image-lien img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center top;
    border-radius: 12px;
}

.carte-membre .btn-fiche {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
    padding: 0.3rem 1rem;
    background-color: #bae6e8;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}
.carte-membre .btn-fiche:hover {
    background-color: #ff6866;
}

/* ============================================================
   Tablette + Mobile (≤ 1100px) — Toggle accordion activé
   ============================================================ */

@media (max-width: 1100px) {

    /* Layout en colonne : filtres au-dessus des cartes */
    .grille-layout {
        flex-direction: column;
        gap: 1rem;
    }

    /* Sidebar pleine largeur, non sticky */
    .sidebar-filtres {
        position: relative;
        top: 0;
        width: 100%;
        min-width: 0;
        padding: 0;
        background: transparent;
        border-radius: 0;
    }

    /* Bouton toggle visible */
    .btn-toggle-filtres {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 0.75rem 1.1rem;
        background: #bae6e8;
        color: #fff;
        font-size: 1rem;
        font-weight: 600;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        transition: background-color 0.2s;
    }
    .btn-toggle-filtres:hover {
        background-color: #9dd6d8;
    }
    .btn-toggle-filtres .toggle-arrow {
        font-size: 0.8rem;
        transition: transform 0.25s;
        display: inline-block;
    }
    .sidebar-filtres.filtres-ouverts .btn-toggle-filtres .toggle-arrow {
        transform: rotate(180deg);
    }

    /* Sidebar mobile/tablette : pas de sticky, pas de max-height */
    .sidebar-filtres {
        max-height: none;
        overflow: visible;
    }

    /* Formulaire FERMÉ par défaut — !important pour contourner tout style du thème */
    .sidebar-filtres #illumina-filtres-form {
        max-height: 0 !important;
        overflow: hidden !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        padding-left: 1rem;
        padding-right: 1rem;
        background: #f5f5f5;
        border-radius: 0 0 8px 8px;
    }
    /* Formulaire OUVERT quand la sidebar a la classe .filtres-ouverts */
    .sidebar-filtres.filtres-ouverts #illumina-filtres-form {
        max-height: 2000px !important;
        padding-top: 0.75rem !important;
        padding-bottom: 1rem !important;
    }
    /* La transition n'est activée qu'après l'init JS pour éviter l'animation au chargement */
    .sidebar-filtres.filtres-anim #illumina-filtres-form {
        transition: max-height 0.35s ease, padding 0.2s ease;
    }

    /* 3 colonnes sur grande tablette */
    .grille-membres {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================================
   Tablette portrait + Mobile (≤ 900px) — 2 colonnes
   ============================================================ */

@media (max-width: 900px) {
    .grille-membres {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .carte-membre h3 a {
        font-size: 1rem;
    }
}

/* ============================================================
   Mobile (≤ 768px) — ajustements typographiques
   ============================================================ */

@media (max-width: 768px) {
    .carte-membre .btn-fiche {
        font-size: 0.82rem;
        padding: 0.25rem 0.7rem;
    }
    .sidebar-filtres label {
        font-size: 0.9rem;
    }
}

/* ============================================================
   Très petit mobile (≤ 480px) — 1 colonne
   ============================================================ */

@media (max-width: 480px) {
    .grille-membres {
        grid-template-columns: 1fr;
    }
}
