/* pr-controls.css — shared filter-control look, mirroring the Explorer page's
 * graphical layout (pill selects, icon search, chips, reset) so every filterable
 * page reads the same. Loaded AFTER a page's own CSS so it overrides the older
 * mockup `.filter-*` styling. Token names match across BaseLayout + MockupLayout;
 * `--border-color` falls back gracefully where a layout doesn't define it. */

/* Row container. z-index lifts the bar's stacking context above the result list:
 * the list items use `.fade-in` (transform → own stacking context), which would
 * otherwise paint OVER the absolutely-positioned facet dropdown panel. */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 50;
}
.filter-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-color-subtle, #8a7d70);
  margin-right: 0.1rem;
}

/* Native selects → Explorer pill look */
.filter-select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.7rem;
  border-radius: 7px;
  border: 1px solid var(--border-color, rgba(90, 24, 36, 0.18));
  background: var(--background-color-muted, #fff);
  color: var(--text-color, inherit);
  cursor: pointer;
}
.filter-select:hover {
  border-color: var(--primary-color, #5a1824);
}

/* Search field with leading icon */
.filter-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 220px;
}
.filter-search-icon {
  position: absolute;
  left: 0.6rem;
  font-size: 0.85rem;
  opacity: 0.6;
  pointer-events: none;
}
.filter-search {
  font: inherit;
  font-size: 0.9rem;
  width: 100%;
  padding: 0.45rem 0.7rem 0.45rem 2rem;
  border-radius: 7px;
  border: 1px solid var(--border-color, rgba(90, 24, 36, 0.18));
  background: var(--background-color-muted, #fff);
  color: var(--text-color, inherit);
}
.filter-search:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--primary-color, #5a1824);
  box-shadow: 0 0 0 2px rgba(90, 24, 36, 0.12);
}

/* Facet dropdown buttons flow inline in the bar (the wrapper itself is layout-neutral). */
[data-ff-facets] {
  display: contents;
}

/* Small numeric inputs (year / date filters) — distinct from the wide .filter-search */
.filter-num {
  font: inherit;
  font-size: 0.9rem;
  width: 4.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 7px;
  border: 1px solid var(--border-color, rgba(90, 24, 36, 0.18));
  background: var(--background-color-muted, #fff);
  color: var(--text-color, inherit);
  -moz-appearance: textfield;
  appearance: textfield;
}
/* Hide the number-input spinner arrows for a cleaner bar */
.filter-num::-webkit-outer-spin-button,
.filter-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.filter-num:focus {
  outline: none;
  border-color: var(--primary-color, #5a1824);
  box-shadow: 0 0 0 2px rgba(90, 24, 36, 0.12);
}

/* Result count + separator */
.filter-count {
  font-size: 0.85rem;
  color: var(--text-color-muted, #6b5d52);
}
.filter-sep {
  width: 1px;
  align-self: stretch;
  background: var(--border-color, rgba(90, 24, 36, 0.15));
  margin: 0 0.15rem;
}

/* Reset button (ghost) */
.filter-reset {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.8rem;
  border-radius: 7px;
  border: 1px solid var(--border-color, rgba(90, 24, 36, 0.18));
  background: transparent;
  color: var(--text-color-muted, #6b5d52);
  cursor: pointer;
}
.filter-reset:hover {
  color: var(--primary-color, #5a1824);
  border-color: var(--primary-color, #5a1824);
}

/* Active-filter chips (pills) */
.active-filters {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.active-filters:empty {
  display: none;
}
.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--primary-color, #5a1824);
  background: var(--primary-color, #5a1824);
  color: #fff;
  cursor: pointer;
}
.active-filter-pill .pill-x {
  font-weight: 700;
  opacity: 0.85;
}

/* ---- Faceted multi-select dropdowns (shared/faceted.js) -------------------
 * The Explorer faceted look (checkbox dropdowns + per-option counts), reusable
 * on any server-rendered listing page. Mirrors ExploreList's .el-facet* styles
 * but lives here so MockupLayout pages can use it without the map component. */
.ff-facet {
  position: relative;
}
.ff-facet-btn {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.7rem;
  border-radius: 7px;
  border: 1px solid var(--border-color, rgba(90, 24, 36, 0.18));
  background: var(--background-color-muted, #fff);
  color: var(--text-color, inherit);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.ff-facet-btn:hover {
  border-color: var(--primary-color, #5a1824);
}
.ff-facet-badge {
  background: var(--primary-color, #5a1824);
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  min-width: 1.1em;
  text-align: center;
  padding: 0 0.35em;
}
.ff-facet-caret {
  font-size: 0.7rem;
  opacity: 0.6;
}
.ff-facet-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  min-width: 240px;
  max-height: 340px;
  overflow-y: auto;
  /* Solid, clearly-elevated menu (was reading as washed-out vs the page surface). */
  background: var(--background-color, #fff);
  border: 1px solid var(--primary-color, #5a1824);
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 0.35rem;
}
/* In-panel "filter the options" search (large facets, e.g. Personnage) */
.ff-opt-search {
  position: sticky;
  top: 0;
  display: block;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.55rem;
  margin-bottom: 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--border-color, rgba(90, 24, 36, 0.18));
  background: var(--background-color, #fff);
  color: var(--text-color, inherit);
}
.ff-opt-search:focus {
  outline: none;
  border-color: var(--primary-color, #5a1824);
}
.ff-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
}
.ff-opt:hover {
  background: var(--background-color, rgba(0, 0, 0, 0.05));
}
.ff-opt-label {
  flex: 1;
}
.ff-opt-count {
  font-size: 0.74rem;
  color: var(--text-color-subtle, #8a7d70);
}
.ff-opt-zero {
  opacity: 0.4;
}

/* ---- Mobile (revue 2026-07) : rangées compactes au lieu d'une pile centrée ----
 * Libellés en tête de rangée, facettes deux par rangée, recherche pleine largeur,
 * Réinitialiser + tri côte à côte. */
@media (max-width: 680px) {
  .filter-bar {
    /* re-neutralise le `flex-direction: column` des CSS de page (ex.
       personnages-index.css ≤600px) — ce fichier charge en dernier */
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
  }
  .filter-sep {
    display: none;
  }
  .filter-label {
    flex: 1 1 100%;
    margin: 0;
  }
  .ff-facet {
    flex: 1 1 calc(50% - 0.45rem);
  }
  .ff-facet-btn {
    width: 100%;
    justify-content: space-between;
  }
  .filter-search-wrap {
    flex: 1 1 100%;
    min-width: 0;
  }
  /* Le libellé « Tri » (tout label après le premier) est superflu ici :
     Réinitialiser et le sélecteur de tri partagent une rangée */
  .filter-label:not(:first-child) {
    display: none;
  }
  .filter-reset,
  .filter-select {
    flex: 1;
    width: auto;
  }
  .filter-count {
    flex: 1 1 100%;
    text-align: right;
  }
}
