/*
 * TCG Keeper
 * Copyright (c) Mario Löser. Alle Rechte vorbehalten.
 * Dieses Skript und der gesamte Quellcode von TCG Keeper sind geistiges
 * Eigentum von Mario Löser und dürfen ohne ausdrückliche
 * Zustimmung nicht ohne diesen Hinweis weiterverwendet oder verbreitet
 * werden.
 */
/* =====================================================================
   Teil 13 — Filterbox-Varianten (11.10.2026, siehe
   includes/filterbox_variants.php und assets/filterbox-variants.js).
   Alle Regeln hängen an html.fbv-on (A/B/C) bzw. html.fbv-a/-b/-c — die
   klassische Box bleibt davon vollständig unberührt. Nur der Testschalter
   (.fbv-switcher) erscheint in jeder Variante.
   ===================================================================== */

/* ---------- Testschalter im Kopf der Filterbox ---------- */
.filterbox-head .fbv-switcher{
  display:inline-flex; align-items:center; gap:4px; flex:0 1 auto;
  color:var(--ink-faint); font-size:11px; min-width:0;
}
.fbv-switcher svg{ flex:none; }
.fbv-switcher-select{
  font:inherit; font-size:11.5px; color:var(--ink-soft); background:var(--paper-sunken);
  border:1px solid var(--line); border-radius:999px; padding:3px 6px; max-width:130px; min-width:0; cursor:pointer;
}
.fbv-switcher-select:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }

/* ---------- Hilfsklassen ---------- */
.fbv-sr{ position:absolute !important; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
html.fbv-on .fbv-gone{ display:none !important; }
html.fbv-on .fbv-hidden-list{ display:none !important; }
html.fbv-on .fbv-off{ display:none !important; }
html.fbv-on .fbv-host-empty{ display:none !important; }
html.fbv-on .fbv-host{ gap:14px; }
html.fbv-on .fbv-box svg{ flex:none; }

/* ---------- Seitenleiste: eigene Bildlaufleiste + fester Knopf ---------- */
html.fbv-on.fbv-wide:not(.fbv-c) .page-sidebar{
  max-height:calc(100vh - 92px); overflow-y:auto; overscroll-behavior:contain;
  scrollbar-width:thin;
}
html.fbv-on .fbv-box form.filter-rail{ gap:14px; margin-bottom:0; }
html.fbv-on .fbv-box .filterbox-head{ margin-bottom:12px; }

/* Baustein 5 — fester Filtern-Knopf */
html.fbv-on .fbv-actions{
  position:sticky; bottom:0; z-index:5; width:100%;
  display:flex; gap:8px; align-items:center;
  padding:10px 0 2px; margin-top:2px;
  background:linear-gradient(to bottom, transparent, var(--paper-raised) 30%);
}
html.fbv-on .fbv-actions .btn{ flex:1 1 0; justify-content:center; min-height:40px; white-space:nowrap; padding-left:10px; padding-right:10px; }
html.fbv-on .lightbox-panel .fbv-actions{ background:linear-gradient(to bottom, transparent, var(--paper-raised) 30%); }
html.fbv-on .fbv-expand{ display:none; }

/* ---------- Abschnitt ---------- */
html.fbv-on .fbv-sec{ width:100%; min-width:0; position:relative; }
html.fbv-on .fbv-pill{ display:none; }
html.fbv-on .fbv-pop-foot{ display:none; }
html.fbv-on .fbv-sec-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; min-height:20px;
}
html.fbv-on .fbv-sec-title{
  display:inline-flex; align-items:center; gap:6px;
  font-size:11px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--ink-faint);
}
html.fbv-on .fbv-sec.fbv-active .fbv-sec-title{ color:var(--accent); }
html.fbv-on .fbv-sec-right{ display:inline-flex; align-items:center; gap:4px; }
.fbv-count{
  display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; padding:0 5px;
  border-radius:999px; background:var(--accent); color:var(--accent-ink); font-size:11px; font-weight:700; line-height:1;
}
.fbv-count[hidden]{ display:none; }
.fbv-clear{
  display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; padding:0;
  border:0; border-radius:50%; background:none; color:var(--ink-faint); cursor:pointer;
}
.fbv-clear:hover{ background:var(--paper-sunken); color:var(--danger); }
.fbv-clear[hidden]{ display:none; }
html.fbv-on .fbv-q label{ display:inline-flex; align-items:center; gap:6px; }
html.fbv-on .fbv-range{ display:grid; grid-template-columns:1fr 1fr; gap:6px; }
html.fbv-on .fbv-sub{
  margin:8px 0 4px; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-faint);
}
html.fbv-on .fbv-ctrl > .fbv-sub:first-child{ margin-top:0; }
.fbv-link{
  display:inline-flex; align-items:center; gap:5px; border:0; background:none; padding:2px 4px;
  color:var(--accent); font:inherit; font-size:12.5px; font-weight:600; cursor:pointer; border-radius:6px;
}
.fbv-link:hover{ background:var(--accent-soft); }
.fbv-ctx-hint{
  display:flex; align-items:center; gap:6px; width:100%;
  margin:0; font-size:12px; color:var(--ink-faint);
}
.fbv-ctx-hint[hidden]{ display:none; }

/* ---------- Baustein 1: Segment-Schalter ---------- */
.fbv-seg{
  display:flex; width:100%; border:1px solid var(--line); border-radius:10px; overflow:hidden;
  background:var(--paper-sunken);
}
.fbv-seg-btn{
  flex:1 1 0; min-width:0; border:0; border-right:1px solid var(--line); background:none;
  padding:8px 6px; font:inherit; font-size:12.5px; color:var(--ink-soft); cursor:pointer;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.fbv-seg-btn:last-child{ border-right:0; }
.fbv-seg-btn:hover{ color:var(--accent); }
.fbv-seg-btn.on{ background:var(--accent); color:var(--accent-ink); font-weight:600; }
.fbv-seg-btn:focus-visible{ outline:2px solid var(--accent); outline-offset:-2px; }

/* ---------- Baustein 1: Chips ---------- */
html.fbv-on .check-list.fbv-chips{
  flex-direction:row; flex-wrap:wrap; gap:6px; max-height:none; overflow:visible;
  border:0; padding:0; background:none;
}
html.fbv-on .fbv-chips .check-item{
  position:relative; display:inline-flex; align-items:center; gap:0;
  padding:5px 11px; border:1px solid var(--line); border-radius:999px;
  background:var(--paper-sunken); font-size:12.5px; color:var(--ink-soft); user-select:none;
  transition:background .12s, border-color .12s, color .12s;
}
html.fbv-on .fbv-chips .check-item:hover{ border-color:var(--accent); color:var(--accent); }
html.fbv-on .fbv-box .filter-rail .fbv-sec label.check-item{ text-transform:none; letter-spacing:0; font-size:12.5px; }
html.fbv-on .fbv-chips .check-item input{ position:absolute; opacity:0; width:1px; height:1px; pointer-events:none; }
html.fbv-on .fbv-chips .check-item.on{ background:var(--accent-soft); border-color:var(--accent); color:var(--accent); font-weight:600; }
html.fbv-on .fbv-chips .check-item:focus-within{ outline:2px solid var(--accent); outline-offset:1px; }

/* ---------- Baustein 1: Typ-Symbole ---------- */
.fbv-ico{ display:grid; grid-template-columns:repeat(auto-fill, minmax(34px, 1fr)); gap:7px; }
.fbv-ico-btn{
  --fbv-type:#999;
  aspect-ratio:1; width:100%; max-width:40px; justify-self:center;
  display:flex; align-items:center; justify-content:center; padding:0;
  border:0; border-radius:50%; background:var(--fbv-type); cursor:pointer;
  box-shadow:inset 0 -2px 0 rgba(0,0,0,.16);
  transition:transform .12s, opacity .12s, box-shadow .12s;
}
.fbv-ico-btn:hover{ transform:scale(1.08); }
.fbv-ico.has-on .fbv-ico-btn{ opacity:.38; }
.fbv-ico.has-on .fbv-ico-btn.on, .fbv-ico-btn.on{
  opacity:1; box-shadow:0 0 0 2px var(--paper-raised), 0 0 0 4px var(--accent);
}
.fbv-ico-btn:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; }
.fbv-ico-letter{ color:#fff; font-weight:700; font-size:13px; }
.fbv-ico-names{ margin-top:7px; font-size:12px; color:var(--ink); }
.fbv-ico-names.muted{ color:var(--ink-faint); }

/* ---------- Baustein 1: Auswahl mit Suche ---------- */
.fbv-combo{
  width:100%; min-height:40px; display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:8px 12px; border:1px solid var(--line); border-radius:10px; background:var(--paper-sunken);
  font:inherit; font-size:13.5px; color:var(--ink-soft); cursor:pointer; text-align:left;
}
.fbv-combo:hover{ border-color:var(--accent); }
.fbv-combo.has-value{ color:var(--ink); border-color:var(--accent); }
.fbv-combo-text{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.fbv-combo[aria-expanded="true"] svg{ transform:rotate(180deg); }
.fbv-combo-panel{
  margin-top:6px; padding:8px; border:1px solid var(--line); border-radius:10px; background:var(--paper-raised);
}
.fbv-combo-panel[hidden]{ display:none; }
.fbv-combo-search{ width:100%; min-height:36px !important; margin-bottom:6px; }
.fbv-combo-bulk{ display:flex; justify-content:flex-end; margin-bottom:4px; }
html.fbv-on .check-list.fbv-combo-list{ max-height:220px; border:0; padding:2px 4px; background:none; }
html.fbv-on .fbv-combo-list .check-item{ padding:4px 6px; border-radius:6px; color:var(--ink); }
html.fbv-on .fbv-combo-list .check-item:hover{ background:var(--paper-sunken); }
html.fbv-on .fbv-combo-list .check-item.on{ color:var(--accent); font-weight:600; }
html.fbv-on .fbv-combo-list .check-item[hidden]{ display:none; }
.fbv-combo-group[hidden]{ display:none; }
.fbv-combo-empty{ margin:6px 4px; font-size:12.5px; color:var(--ink-faint); }
.fbv-combo-empty[hidden]{ display:none; }
.fbv-chosen{ display:flex; flex-wrap:wrap; gap:5px; margin-top:6px; }
.fbv-chosen:empty{ display:none; }

/* entfernbare Chips (Auswahl + Leiste "Aktive Filter") */
.fbv-chip-x{
  display:inline-flex; align-items:center; gap:5px; max-width:100%;
  padding:4px 6px 4px 10px; border:1px solid var(--accent); border-radius:999px;
  background:var(--accent-soft); color:var(--accent); font:inherit; font-size:12.5px; font-weight:600; cursor:pointer;
}
.fbv-chip-x:hover{ background:var(--accent); color:var(--accent-ink); }
.fbv-chip-x svg{ width:13px; height:13px; }

/* ---------- Variante B: Reiter ---------- */
.fbv-tabs{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(0, 1fr)); gap:4px; width:100%;
  padding:4px; border:1px solid var(--line); border-radius:12px; background:var(--paper-sunken);
}
.fbv-tab{
  position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; min-width:0;
  padding:7px 4px 6px; border:0; border-radius:9px; background:none;
  font:inherit; font-size:11.5px; line-height:1.15; color:var(--ink-soft); cursor:pointer;
}
.fbv-tab span:not(.fbv-count){ max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.fbv-tab:hover{ color:var(--accent); }
.fbv-tab.on{ background:var(--paper-raised); color:var(--accent); font-weight:600; box-shadow:0 1px 3px rgba(0,0,0,.12); }
.fbv-tab[hidden]{ display:none; }
.fbv-tab .fbv-count{ position:absolute; top:3px; right:5px; min-width:16px; height:16px; font-size:10px; }
.fbv-tab:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }
html.fbv-b .fbv-tab-hidden{ display:none !important; }

/* ---------- Variante C: Leiste über den Ergebnissen (breite Bildschirme) ---------- */
html.fbv-c.fbv-wide .page-with-sidebar{ flex-direction:column; align-items:stretch; gap:16px; }
html.fbv-c.fbv-wide .page-with-sidebar > .page-sidebar{ order:-1; }
html.fbv-c.fbv-wide .page-sidebar{ position:static; flex:none; width:100%; max-height:none; overflow:visible; }
html.fbv-c.fbv-wide .page-main{ width:100%; }
html.fbv-c.fbv-wide .fbv-box{ padding-bottom:14px; }
html.fbv-c.fbv-wide .fbv-box form.filter-rail{ flex-direction:row; flex-wrap:wrap; align-items:center; gap:8px; }
html.fbv-c.fbv-wide .fbv-box .fbv-host,
html.fbv-c.fbv-wide .fbv-box .fbv-sec{ width:auto; }
html.fbv-c.fbv-wide .fbv-box .fbv-host{ display:contents; }
html.fbv-c.fbv-wide .fbv-box .fbv-q{ flex:1 1 240px; width:auto; max-width:360px; }
html.fbv-c.fbv-wide .fbv-box .fbv-q label{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
html.fbv-c.fbv-wide .fbv-pill{
  display:inline-flex; align-items:center; gap:6px; min-height:40px; padding:7px 12px;
  border:1px solid var(--line); border-radius:999px; background:var(--paper-sunken);
  font:inherit; font-size:13px; color:var(--ink); cursor:pointer; white-space:nowrap;
}
html.fbv-c.fbv-wide .fbv-pill:hover{ border-color:var(--accent); color:var(--accent); }
html.fbv-c.fbv-wide .fbv-sec.fbv-active .fbv-pill{ border-color:var(--accent); background:var(--accent-soft); color:var(--accent); font-weight:600; }
html.fbv-c.fbv-wide .fbv-sec.fbv-pop-open .fbv-pill svg:last-child{ transform:rotate(180deg); }
html.fbv-c.fbv-wide .fbv-sec-body{
  display:none; position:absolute; top:calc(100% + 6px); left:0; z-index:60;
  width:320px; max-width:calc(100vw - 40px); max-height:min(70vh, 520px); overflow:auto;
  padding:12px; border:1px solid var(--line); border-radius:12px; background:var(--paper-raised);
  box-shadow:var(--shadow), 0 18px 40px -18px rgba(0,0,0,.35);
}
html.fbv-c.fbv-wide .fbv-sec.fbv-pop-open .fbv-sec-body{ display:block; }
html.fbv-c.fbv-wide .fbv-sec.fbv-pop-open .fbv-pop-foot{ display:flex; justify-content:flex-end; margin-top:10px; }
html.fbv-c.fbv-wide .fbv-sec-head .fbv-count{ display:none; }
html.fbv-c.fbv-wide .fbv-actions{
  position:static; width:auto; margin:0 0 0 auto; padding:0; background:none; flex:none;
}
html.fbv-c.fbv-wide .fbv-actions .btn{ flex:none; }
html.fbv-c.fbv-wide .fbv-expand{ display:inline-flex; gap:6px; align-items:center; }
html.fbv-c.fbv-wide .fbv-expand[aria-pressed="true"]{ background:var(--accent-soft); border-color:var(--accent); color:var(--accent); }
html.fbv-c.fbv-wide .fbv-ctx-hint{ order:50; }
/* "Alle Filter": alle Felder ausgeklappt nebeneinander */
html.fbv-c.fbv-wide form.fbv-expanded{ align-items:flex-start; }
html.fbv-c.fbv-wide form.fbv-expanded .fbv-sec{ flex:1 1 260px; }
html.fbv-c.fbv-wide form.fbv-expanded .fbv-pill{ display:none; }
html.fbv-c.fbv-wide form.fbv-expanded .fbv-sec-body{
  display:block; position:static; width:auto; max-width:none; max-height:none; box-shadow:none; background:var(--paper-sunken);
}
html.fbv-c.fbv-wide form.fbv-expanded .fbv-sec-head .fbv-count:not([hidden]){ display:inline-flex; }
html.fbv-c.fbv-wide form.fbv-expanded .fbv-pop-foot{ display:none !important; }
html.fbv-c.fbv-wide form.fbv-expanded .fbv-q{ flex-basis:100%; max-width:none; }
html.fbv-c.fbv-wide form.fbv-expanded .fbv-actions{ flex-basis:100%; justify-content:flex-end; }

/* ---------- Baustein 4: Werkzeugleiste über den Ergebnissen ---------- */
.fbv-toolbar{
  display:flex; flex-direction:column; gap:10px; margin:0 0 16px;
  padding:10px 14px; border:1px solid var(--line); border-radius:14px; background:var(--paper-raised);
  box-shadow:var(--shadow);
}
.fbv-active-row{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding-bottom:10px; border-bottom:1px dashed var(--line); }
.fbv-active-row[hidden]{ display:none; }
.fbv-active-label{
  display:inline-flex; align-items:center; gap:6px; margin-right:4px;
  font-size:11px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--ink-faint);
}
.fbv-reset-all{ margin-left:auto; }
.fbv-tools-row{ display:flex; flex-wrap:wrap; align-items:center; gap:10px 18px; }
.fbv-tool{ display:inline-flex; align-items:center; gap:8px; min-width:0; }
.fbv-tool-end{ margin-left:auto; }
.fbv-tool-end + .fbv-tool-end{ margin-left:0; }
.fbv-tool-label{
  display:inline-flex; align-items:center; gap:5px;
  font-size:11px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--ink-faint); white-space:nowrap;
}
.fbv-toolbar .view-switch.fbv-views{ margin:0; gap:0; flex-wrap:nowrap; border:1px solid var(--line); border-radius:10px; overflow:hidden; }
.fbv-toolbar .fbv-views .view-switch-btn.btn.small{
  flex:none; min-height:32px; padding:5px 11px; font-size:12.5px; border:0; border-right:1px solid var(--line); border-radius:0; background:var(--paper-sunken);
}
.fbv-toolbar .fbv-views .view-switch-btn.btn.small:last-child{ border-right:0; }
.fbv-toolbar .fbv-views .view-switch-btn.btn.small.active{ background:var(--accent); color:var(--accent-ink); }
.fbv-toolbar .fbv-tool-select{ min-height:34px; padding-top:4px; padding-bottom:4px; width:auto; max-width:240px; }
.fbv-dd{ position:relative; }
.fbv-dd-btn{ display:inline-flex; align-items:center; gap:6px; min-height:34px; }
.fbv-dd-btn[aria-expanded="true"] svg:last-child{ transform:rotate(180deg); }
.fbv-dd-panel{
  position:absolute; top:calc(100% + 6px); right:0; z-index:70; width:300px; max-width:calc(100vw - 32px);
  padding:12px; border:1px solid var(--line); border-radius:12px; background:var(--paper-raised);
  box-shadow:var(--shadow), 0 18px 40px -18px rgba(0,0,0,.35);
}
.fbv-dd-panel[hidden]{ display:none; }
.fbv-dd-panel .sidebar-actions{ gap:8px; }
.fbv-dd-hint{ margin:6px 0 0; font-size:12px; color:var(--ink-faint); }
.fbv-dd-hint.err{ color:var(--danger); }
.fbv-tpl-list{ list-style:none; margin:0 0 10px; padding:0; display:flex; flex-direction:column; gap:2px; }
.fbv-tpl-list li{ display:flex; align-items:center; gap:4px; }
.fbv-tpl-link{
  flex:1; min-width:0; display:flex; align-items:center; gap:7px; padding:7px 8px; border-radius:8px;
  color:var(--ink); text-decoration:none; font-size:13.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.fbv-tpl-link:hover{ background:var(--accent-soft); color:var(--accent); }
.fbv-tpl-link svg{ color:var(--gold); }
.fbv-tpl-del{
  flex:none; display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px;
  border:0; border-radius:8px; background:none; color:var(--ink-faint); cursor:pointer;
}
.fbv-tpl-del:hover{ background:var(--danger-soft); color:var(--danger); }
.fbv-tpl-save{ display:flex; gap:6px; }
.fbv-tpl-save .form-input{ flex:1; min-width:0; min-height:34px; }
.fbv-tpl-save .btn{ display:inline-flex; align-items:center; gap:5px; }
.fbv-online-row{ padding-top:10px; border-top:1px dashed var(--line); }
.fbv-online-row #onlineImportForm{ margin:0 !important; }
.fbv-online-row #onlineImportBtn{ width:auto !important; }

@media (max-width:900px){
  .fbv-toolbar{ padding:10px 12px; }
  .fbv-tools-row{ gap:10px; }
  .fbv-tool{ flex-wrap:wrap; }
  .fbv-tool-end{ margin-left:0; }
  .fbv-toolbar .view-switch.fbv-views{ flex-wrap:wrap; }
  .fbv-dd-panel{ left:0; right:auto; }
  .fbv-tool-end:last-child .fbv-dd-panel{ left:auto; right:0; }
}
