/* Panneau Filtres (tiroir de gauche) : son contenu.
   Hiérarchie à l'écran : champ de recherche, puis 3 sections NIST
   (Fonctions niveau 1 = boutons, Catégories niveau 2 et Sous-catégories niveau 3 = cases à cocher). */

/* Le champ "Rechercher une solution" en haut du panneau (2e barre de recherche, synchronisée avec celle du haut) */
.filters-search {
  width: 100%;
  margin-bottom: 12px;
  flex-shrink: 0;
}

/* La zone qui défile sous le champ de recherche (contient toutes les sections de filtres) */
.drawer-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 6px;
  margin-right: -6px;
}
.drawer-scroll::-webkit-scrollbar {
  width: 6px;
}
.drawer-scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 8px;
}

/* Le bouton "Réinitialiser" (à côté du titre "Filtres NIST") qui efface tous les filtres */
.reset-button {
  padding: 5px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border-radius: 999px;
  border: 1px solid var(--line);
}
.reset-button:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-soft);
}

/* Une section de filtres (ex. "Fonctions niveau 1", "Catégories niveau 2") */
.filter-group {
  margin: 0;
}
/* Le titre de la section (ex. "FONCTIONS niveau 1") */
.filter-group h3 {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
/* La partie grise et discrète du titre (le "niveau 1" après le mot principal) */
.filter-group h3 .muted {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

/* La grille 2 colonnes des boutons de fonction NIST */
.chip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
/* Un BOUTON de fonction NIST niveau 1 (Détecter, Répondre, Protéger...). C'est un interrupteur :
   on clique pour l'activer/désactiver. Couleur de la fonction quand actif. */
.fn-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--chip-bg, var(--surface-soft));
  color: var(--chip-ink, var(--ink));
  border: 1.5px solid transparent;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
  transition:
    transform 120ms ease,
    box-shadow 150ms ease,
    border-color 120ms ease,
    opacity 150ms ease;
}
.fn-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
/* Fonction DÉSACTIVÉE (décochée) : grisée, atténuée */
.fn-chip[aria-pressed="false"] {
  opacity: 0.4;
  background: #fff;
  color: var(--ink-soft);
  border-color: var(--line);
}
/* Fonction ACTIVE : bordure marquée + ombre légère */
.fn-chip[aria-pressed="true"] {
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-sm);
}
/* Le nom de la fonction dans le bouton (tronqué si trop long) */
.fn-chip .fn-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* La petite pastille avec le nombre d'acteurs, à droite dans le bouton */
.fn-chip .fn-count {
  flex-shrink: 0;
  font-size: 0.64rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.7);
  padding: 2px 6px;
  border-radius: 999px;
  color: inherit;
}

/* La liste des cases à cocher (Catégories niveau 2, Sous-catégories niveau 3) */
.check-list {
  display: grid;
  gap: 2px;
}
/* Une ligne de case à cocher : [case] [libellé] [nombre] */
.check-row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.check-row:hover {
  background: var(--surface-soft);
}
/* La case à cocher elle-même */
.check-row input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}
/* Le nombre d'acteurs à droite de la ligne */
.check-row .check-count {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--muted);
}
/* Le libellé de la catégorie (tronqué si trop long) */
.check-row span:first-of-type {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Message affiché quand une section n'a aucune option (ex. pas de sous-catégorie) */
.empty-filter {
  padding: 8px 10px;
  font-size: 0.74rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}
