/*
 * style.css — Styles front-end du bloc ACF "listing-formations-filtres"
 * Sélecteur racine : .wp-block-teamtreize-listing-formations-filtres
 * Les cartes reprennent le style du bloc "carte-formation".
 */

.listing-formations-filtres__filtres {
    display: flex;
    flex-wrap: wrap;
    gap: 24px 48px;
    margin-bottom: 40px;
}

.listing-formations-filtres__groupe {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Filières sur toute la largeur, admission, niveau et format côte à côte en dessous */
.listing-formations-filtres__groupe--filiere {
    flex-basis: 100%;
}

.listing-formations-filtres__libelle {
    font-family: var(--wp--preset--font-family--primary, inherit);
    font-weight: 700;
    font-size: 15px;
    line-height: 24px;
    color: var(--wp--preset--color--black, #192548);
}

.listing-formations-filtres__bulles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* --bulle-couleur / --bulle-texte surchargées en ligne pour les filières qui ont une couleur */
.listing-formations-filtres__bulle {
    --bulle-couleur: var(--wp--preset--color--primary, #373cf5);
    --bulle-texte: var(--wp--preset--color--white, #fff);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 6px 18px;
    border: 2px solid var(--wp--preset--color--grey-dark, #e6e8ee);
    border-radius: 20px;
    background-color: var(--wp--preset--color--white, #fff);
    font-family: var(--wp--preset--font-family--primary, inherit);
    font-weight: 600;
    font-size: 15px;
    line-height: 24px;
    color: var(--wp--preset--color--black, #192548);
    text-align: left;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.listing-formations-filtres__bulle:hover {
    border-color: var(--bulle-couleur);
}

.listing-formations-filtres__bulle:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #373cf5);
    outline-offset: 2px;
}

.listing-formations-filtres__bulle[aria-pressed="true"] {
    border-color: var(--bulle-couleur);
    background-color: var(--bulle-couleur);
    color: var(--bulle-texte);
}

.listing-formations-filtres__pastille {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--bulle-couleur);
}

/* Bulle active : la pastille se fond dans le fond, on la passe à la couleur du texte */
.listing-formations-filtres__bulle[aria-pressed="true"] .listing-formations-filtres__pastille {
    background-color: currentColor;
}

.listing-formations-filtres__barre {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 24px;
}

/* Bouton et fermeture du panneau de filtres : mobile uniquement (cf. media query) */
.listing-formations-filtres__ouvrir,
.listing-formations-filtres__fermer {
    display: none;
}

.listing-formations-filtres__nb-actifs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 12px;
    background-color: var(--wp--preset--color--primary, #373cf5);
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    color: var(--wp--preset--color--white, #fff);
}

/* Texte lu par les lecteurs d'écran seulement */
.listing-formations-filtres__masque {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.listing-formations-filtres__compteur {
    margin: 0;
    font-family: var(--wp--preset--font-family--primary, inherit);
    font-weight: 800;
    font-size: 20px;
    line-height: 1.3;
    color: var(--wp--preset--color--black, #192548);
}

/* « Afficher toutes nos formations » : bouton contour, comme la variation de bouton « Border » */
.listing-formations-filtres__reinitialiser {
    margin: 0;
    padding: 13px 20px;
    border: 3px solid var(--wp--preset--color--primary, #373cf5);
    border-radius: var(--wp--custom--radius--m, 10px);
    background-color: transparent;
    font-family: var(--wp--preset--font-family--primary, inherit);
    font-weight: 600;
    font-size: var(--wp--preset--font-size--s, 15px);
    line-height: normal;
    color: var(--wp--preset--color--primary, #373cf5);
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.listing-formations-filtres__reinitialiser:hover {
    border-color: var(--wp--custom--color--primary-hover, #0c0eeb);
    background-color: var(--wp--custom--color--primary-hover, #0c0eeb);
    color: var(--wp--preset--color--white, #fff);
}

.listing-formations-filtres__reinitialiser:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #373cf5);
    outline-offset: 2px;
}

.listing-formations-filtres__liste {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.listing-formations-filtres__item {
    margin: 0;
}

.listing-formations-filtres__vide {
    margin: 0;
    padding: 24px;
    border: 2px dashed var(--wp--preset--color--grey-dark, #e6e8ee);
    border-radius: 10px;
    color: var(--wp--preset--color--black, #192548);
}

.listing-formations-filtres__item[hidden],
.listing-formations-filtres__vide[hidden],
.listing-formations-filtres__reinitialiser[hidden],
.listing-formations-filtres__nb-actifs[hidden] {
    display: none;
}

@media (max-width: 768px) {
    .listing-formations-filtres__ouvrir {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        margin: 0 0 24px;
        padding: 14px 20px;
        border: 2px solid var(--wp--preset--color--grey-dark, #e6e8ee);
        border-radius: 10px;
        background-color: var(--wp--preset--color--white, #fff);
        font-family: var(--wp--preset--font-family--primary, inherit);
        font-weight: 700;
        font-size: 16px;
        line-height: 24px;
        color: var(--wp--preset--color--black, #192548);
        text-align: left;
        cursor: pointer;
        /* Cible du « Voir les résultats » : écart sous le header fixe (déjà
           évité par le scroll-padding-top global, cf. style.css du thème) */
        scroll-margin-top: var(--wp--preset--spacing--30);
    }

    .listing-formations-filtres__ouvrir:focus-visible {
        outline: 2px solid var(--wp--preset--color--primary, #373cf5);
        outline-offset: 2px;
    }

    .listing-formations-filtres__icone {
        flex-shrink: 0;
        color: var(--wp--preset--color--primary, #373cf5);
    }

    .listing-formations-filtres__chevron {
        flex-shrink: 0;
        margin-left: auto;
        transition: transform 0.2s ease;
    }

    /* Panneau replié par défaut */
    .listing-formations-filtres__filtres {
        display: none;
    }

    /* Panneau ouvert : accolé sous le bouton, dans le même cadre */
    .is-filtres-ouverts .listing-formations-filtres__ouvrir {
        margin-bottom: 0;
        border-bottom-color: transparent;
        border-radius: 10px 10px 0 0;
    }

    .is-filtres-ouverts .listing-formations-filtres__chevron {
        transform: rotate(180deg);
    }

    .is-filtres-ouverts .listing-formations-filtres__filtres {
        display: flex;
        margin-bottom: 24px;
        padding: 4px 20px 20px;
        border: 2px solid var(--wp--preset--color--grey-dark, #e6e8ee);
        border-top: 0;
        border-radius: 0 0 10px 10px;
        background-color: var(--wp--preset--color--white, #fff);
    }

    .listing-formations-filtres__fermer {
        display: block;
        flex-basis: 100%;
        margin: 0;
        padding: 13px 20px;
        border: 3px solid var(--wp--preset--color--primary, #373cf5);
        border-radius: var(--wp--custom--radius--m, 10px);
        background-color: var(--wp--preset--color--primary, #373cf5);
        font-family: var(--wp--preset--font-family--primary, inherit);
        font-weight: 600;
        font-size: 15px;
        line-height: normal;
        color: var(--wp--preset--color--white, #fff);
        cursor: pointer;
    }

    .listing-formations-filtres__fermer:focus-visible {
        outline: 2px solid var(--wp--preset--color--primary, #373cf5);
        outline-offset: 2px;
    }

    .listing-formations-filtres__bulle {
        padding: 5px 14px;
        font-size: 14px;
        line-height: 22px;
    }
}
