/* Listes multi-sélection (voir static/js/filter-multiselect.js)

   Repris de Mars. Le bouton reprend l'aspect du select qu'il remplace —
   filtre de liste (.filter-group) ou champ de fiche (.form-group) — pour
   qu'une liste convertie ne se remarque pas tant qu'on n'y coche pas deux
   valeurs. */

.ms-filtre {
    position: relative;
    display: block;
    width: 100%;
}

/* Le select d'origine porte toujours les valeurs, et reste soumis avec le
   formulaire : il est masqué, pas retiré. */
.ms-select-source {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.ms-bouton {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: var(--color-text);
    text-align: left;
    background: var(--color-white);
    border: 1px solid #ddd;
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--transition);
}

/* Dans une ligne de filtres : même gabarit que les autres listes. */
.filter-group .ms-filtre {
    min-width: 160px;
}

.filter-group .ms-bouton {
    height: 34px;
    padding: 0 0.6rem;
    font-size: 0.85rem;
    background: #f8f9fa;
    border-color: var(--color-border);
}

.ms-bouton:hover {
    border-color: #999;
}

.ms-bouton:focus-visible {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.15);
}

.ms-bouton:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.ms-libelle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-fleche {
    flex: none;
    border-top: 5px solid #666;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}

/* Un filtre actif se voit sans être lu : c'est ce qui manque le plus quand on
   revient sur une page et qu'on s'étonne du nombre de résultats. Dans une
   fiche, une valeur choisie n'est pas un filtre : pas de mise en relief. */
.filter-group .ms-filtre.ms-actif .ms-bouton {
    font-weight: 600;
    color: var(--color-primary-dark);
    border-color: var(--color-primary);
}

.ms-panneau {
    position: fixed;
    z-index: 1200;
    max-height: 320px;
    padding: 4px;
    overflow-y: auto;
    background: var(--color-white);
    border: 1px solid #bbb;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.ms-entete {
    padding: 2px 4px 4px;
    border-bottom: 1px solid var(--color-border-light);
}

.ms-tout {
    padding: 3px 6px;
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text-light);
    background: none;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.ms-tout:hover {
    color: var(--color-primary-dark);
    background: var(--color-hover);
}

/* `.ms-panneau .ms-option` et non `.ms-option` seul : dans une fiche, la
   règle `.form-group label { display: block }` de detail.css l'emporterait,
   et la case se collerait à son libellé. */
.ms-panneau .ms-option {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0;
    padding: 5px 8px;
    font-weight: normal;
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-text);
    white-space: nowrap;
    cursor: pointer;
    border-radius: 3px;
}

.ms-option:hover {
    background: var(--color-hover);
}

.ms-panneau .ms-option input {
    flex: none;
    width: 14px;
    height: 14px;
    margin: 0 2px 0 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}
