/* Barre « Filtrer / Trier » du fil + panneau de filtres.
   Mobile : panneau en bas d'écran (bottom sheet). Ordinateur : fenêtre flottante sous la barre. */
.ff { position: relative; margin: 10px 0 12px; }
.ff, .ff-layer { --ff-petrol: #073A50; --ff-petrol-2: #006289; --ff-hair: #DCE6EA; --ff-mist: #EDF3F5; --ff-ink: #1B1B2F; --ff-muted: #557080; }
.ff *, .ff *::before, .ff *::after, .ff-layer *, .ff-layer *::before, .ff-layer *::after { box-sizing: border-box; }
.ff button, .ff select, .ff-layer button, .ff-layer select { font-family: inherit; }
.ff :focus-visible, .ff-layer :focus-visible { outline: 3px solid #50A8CB; outline-offset: 2px; }

.ff-bar { display: flex; gap: 8px; align-items: stretch; }
.ff-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--ff-hair);
  background: #fff; color: var(--ff-petrol); font-size: 14px; font-weight: 700; cursor: pointer;
  line-height: 1.2; text-align: center;
}
.ff-btn:hover { background: var(--ff-mist); }
.ff-btn:disabled { opacity: .45; cursor: not-allowed; }
.ff-btn--filter { flex: 1 1 50%; min-width: 0; }
.ff-btn--primary { background: var(--ff-petrol); border-color: var(--ff-petrol); color: #fff; }
.ff-btn--primary:hover { background: var(--ff-petrol-2); }
.ff-btn--ghost { background: #fff; }
.ff-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: #E71D72; color: #fff; font-size: 12px; font-weight: 700;
}

.ff-sort { position: relative; flex: 1 1 50%; min-width: 0; display: flex; align-items: center; margin: 0; }
.ff-sort__label { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--ff-muted); pointer-events: none; }
.ff-sort__select {
  width: 100%; min-height: 44px; padding: 0 34px 0 58px; border-radius: 10px; border: 1px solid var(--ff-hair);
  background: #fff; color: var(--ff-petrol); font-size: 14px; font-weight: 700; appearance: none; -webkit-appearance: none;
  cursor: pointer; text-overflow: ellipsis;
}
.ff-sort__chev { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ff-petrol); pointer-events: none; }

.ff-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.ff-chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%;
  padding: 0 12px; border-radius: 999px; border: 1px solid var(--ff-petrol-2); background: var(--ff-mist);
  color: var(--ff-petrol); font-size: 13px; font-weight: 600; cursor: pointer;
}
.ff-chip::after { content: ''; position: absolute; inset: -4px; }
.ff-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-chip:hover { background: #dfeaee; }
.ff-clear {
  position: relative; min-height: 36px; padding: 0 8px; border: 0; background: none; color: var(--ff-petrol-2);
  font-size: 13px; font-weight: 700; text-decoration: underline; cursor: pointer;
}
.ff-clear::after { content: ''; position: absolute; inset: -4px; }
.ff-count { margin: 8px 0 0; font-size: 12.5px; font-weight: 600; color: var(--ff-muted); }

/* ---- Panneau ---- */
.ff-layer { position: fixed; inset: 0; z-index: 10000; }
.ff-backdrop { position: absolute; inset: 0; background: rgba(7, 58, 80, .45); }
.ff-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88dvh; max-height: 88vh; display: flex; flex-direction: column;
  background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(7, 58, 80, .28);
  animation: ff-up .22s ease-out; transition: transform .18s ease-out; padding-bottom: env(safe-area-inset-bottom, 0);
}
@supports (height: 1dvh) { .ff-sheet { max-height: 88dvh; } }
@keyframes ff-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.ff-sheet__head { position: relative; padding: 18px 56px 10px 18px; border-bottom: 1px solid var(--ff-hair); touch-action: none; }
.ff-grab { position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: #C9D6DC; }
.ff-sheet__title { margin: 0; font-size: 18px; font-weight: 800; color: var(--ff-ink); outline: none; }
.ff-close {
  position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; background: none; color: var(--ff-petrol); cursor: pointer;
}
.ff-close:hover { background: var(--ff-mist); }
.ff-sheet__body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 6px 18px 14px; }
.ff-group { margin: 14px 0 0; padding: 0; border: 0; min-width: 0; }
.ff-group legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 800; color: var(--ff-ink); }
.ff-sheet .pill-grid.ff-pills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ff-pill {
  min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--ff-hair); background: #fff;
  color: var(--ff-petrol); font-size: 13.5px; font-weight: 600; cursor: pointer; line-height: 1.25;
}
.ff-pill:hover { background: var(--ff-mist); }
.ff-pill.is-on { background: var(--ff-petrol); border-color: var(--ff-petrol); color: #fff; }
.ff-hint { margin: 14px 0 0; font-size: 13px; color: var(--ff-muted); }

.ff-switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; cursor: pointer; padding: 2px 0; }
.ff-switch__txt { font-size: 14px; font-weight: 700; color: var(--ff-ink); }
.ff-switch__input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ff-switch__track { position: relative; flex: 0 0 auto; width: 46px; height: 26px; border-radius: 26px; background: #C9D6DC; transition: background .15s; }
.ff-switch__track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.ff-switch__input:checked ~ .ff-switch__track { background: var(--ff-petrol); }
.ff-switch__input:checked ~ .ff-switch__track::after { transform: translateX(20px); }
.ff-switch__input:focus-visible ~ .ff-switch__track { outline: 3px solid #50A8CB; outline-offset: 2px; }

.ff-sheet__foot { display: flex; gap: 10px; padding: 12px 18px 14px; border-top: 1px solid var(--ff-hair); background: #fff; }
.ff-sheet__foot .ff-btn--ghost { flex: 0 0 auto; }
.ff-sheet__foot .ff-btn--primary { flex: 1 1 auto; }

/* ---- État vide ---- */
.ff-empty { text-align: center; padding: 22px 16px !important; }
.ff-empty__title { margin: 0 0 4px; font-size: 16px; font-weight: 800; color: var(--ff-ink, #1B1B2F); }
.ff-empty__text { margin: 0 0 14px; font-size: 14px; color: #557080; }
.ff-empty__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.ff-empty__actions .ff-btn { flex: 1 1 160px; max-width: 260px; }

/* ---- Ordinateur : fenêtre flottante sous la barre ---- */
@media (min-width: 768px) {
  .ff-bar { max-width: 460px; }
  .ff-btn--filter, .ff-sort { flex: 1 1 0; }
  .ff-backdrop { background: rgba(7, 58, 80, .28); }
  .ff-sheet {
    left: 50%; right: auto; bottom: auto; top: 12vh; transform: translateX(-50%); width: min(480px, 92vw);
    max-height: min(76vh, 680px); border-radius: 14px; border: 1px solid var(--ff-hair);
    box-shadow: 0 18px 50px rgba(7, 58, 80, .22); padding-bottom: 0; animation: ff-fade .15s ease-out;
  }
  .ff-grab { display: none; }
  .ff-sheet__head { padding-top: 14px; touch-action: auto; }
}
@keyframes ff-fade { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .ff-sheet, .ff-switch__track, .ff-switch__track::after { animation: none !important; transition: none !important; }
}

/* Petit écran : le mot « Trier » cède la place pour que le choix tienne en entier */
@media (max-width: 479.98px) {
  .ff-sort__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ff-sort__select { padding-left: 14px; }
}

/* Sous-titre d'un interrupteur (explication courte) */
.ff-switch__sub { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--ff-muted); }
