/* ===========================================================================
   The listing shell shared by FAME's filtered lists (ebooks, classes, …).

   Everything above the results is here — the pill bar, the search field, the
   two-column layout, the filter rail, the toolbar and the pager — because the
   lists are the same page with different rows. Each list then ships only its
   own CARD stylesheet (fame-ebooks-list.css, fame-classes-list.css).

   The wrapper carries BOTH classes: class="fame-list-shell fame-ebooks-list".
   The variables live on .fame-list-shell so a second list inherits them without
   repeating the palette.

   Pills are radios and rail boxes are checkboxes, both marked
   [data-feb-filter]: fame-list-controller.js reads either and posts the chosen
   values with the search text and the offset, so a list needs no JS of its own.
   =========================================================================== */
.fame-list-shell {
  --feb-ink: #0f1f3d;
  --feb-muted: #6b7a99;
  --feb-line: #e6ebf5;
  --feb-primary: #0566e3;
  --feb-radius: 14px;
  color: var(--feb-ink);
  font-size: 14px;
}
.fame-list-shell *, .fame-list-shell *::before, .fame-list-shell *::after { box-sizing: border-box; }

/* ---- quick "Brows by Exams" bar ---- */
.feb-quickbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--feb-line); border-radius: var(--feb-radius);
  padding: 12px 16px; margin-bottom: 18px;
}
.feb-quickbar-label { font-weight: 600; font-size: 13px; flex: 0 0 auto; }
.feb-quickbar-pills { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }
/* Search sits at the far right of the same bar, per the design. */
.feb-quickbar .feb-search { margin-left: auto; flex: 0 0 auto; }
.feb-quick {
  border: 1px solid var(--feb-line); background: #fff; color: var(--feb-ink);
  border-radius: 8px; padding: 7px 16px; font: inherit; font-size: 13px; cursor: pointer;
}
.feb-quick:hover { border-color: #c7d5ee; }
.feb-quick.is-active { background: var(--feb-primary); border-color: var(--feb-primary); color: #fff; }

/* A pill group that is single-select is built from radios: the input is hidden
   and its label is the pill, so the browser gives us the one-of-many behaviour
   and the keyboard handling for free. */
.feb-quick-input { position: absolute; opacity: 0; width: 0; height: 0; }
label.feb-quick { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.feb-quick-input:checked + .feb-quick {
  background: var(--feb-primary); border-color: var(--feb-primary); color: #fff;
}
.feb-quick-input:focus-visible + .feb-quick { outline: 2px solid var(--feb-primary); outline-offset: 2px; }
.feb-quick-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: #eef3fb; color: var(--feb-muted); font-size: 11.5px; font-weight: 600;
}
.feb-quick-input:checked + .feb-quick .feb-quick-count { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---- two-column shell ---- */
.feb-layout { display: grid; grid-template-columns: 258px 1fr; gap: 20px; align-items: start; }

/* ---- filter rail ---- */
.feb-rail { background: #fff; border: 1px solid var(--feb-line); border-radius: var(--feb-radius); padding: 18px 16px; }
.feb-rail-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--feb-line); }
.feb-rail-title { margin: 0; font-size: 16px; font-weight: 700; }
.feb-reset {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: none; color: #e2545b; font: inherit; font-size: 12px; cursor: pointer; padding: 0;
}
.feb-reset:hover { text-decoration: underline; }

.feb-facet { padding: 14px 0 4px; }
.feb-facet-head {
  width: 100%; display: flex; align-items: center; gap: 9px;
  border: 0; background: none; padding: 0 0 10px; font: inherit; font-size: 12.5px;
  font-weight: 700; letter-spacing: .04em; color: var(--feb-ink); cursor: pointer; text-align: left;
}
.feb-facet-ico { flex: 0 0 auto; color: var(--feb-muted); }
.feb-facet-head > span:not(.feb-facet-sign) { flex: 1 1 auto; }
/* +/- drawn in CSS so the markup carries no state-specific icon. */
.feb-facet-sign { position: relative; width: 12px; height: 12px; flex: 0 0 auto; }
.feb-facet-sign::before, .feb-facet-sign::after {
  content: ""; position: absolute; background: var(--feb-muted); transition: opacity .15s ease;
}
.feb-facet-sign::before { left: 0; top: 5px; width: 12px; height: 2px; }
.feb-facet-sign::after { left: 5px; top: 0; width: 2px; height: 12px; opacity: 0; }
.feb-facet.is-closed .feb-facet-sign::after { opacity: 1; }
.feb-facet.is-closed .feb-facet-body { display: none; }

.feb-check { display: flex; align-items: center; gap: 9px; padding: 6px 0; cursor: pointer; font-size: 13px; }
.feb-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.feb-check-box {
  flex: 0 0 auto; width: 17px; height: 17px; border: 1.5px solid #c7d0e2;
  border-radius: 5px; background: #fff; position: relative;
}
.feb-check input:checked + .feb-check-box { background: var(--feb-primary); border-color: var(--feb-primary); }
.feb-check input:checked + .feb-check-box::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.feb-check input:focus-visible + .feb-check-box { outline: 2px solid var(--feb-primary); outline-offset: 2px; }
.feb-check-label { flex: 1 1 auto; }
.feb-check-count { color: var(--feb-muted); font-size: 12px; }

/* ---- toolbar ---- */
.feb-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.feb-resultcount { margin: 0; color: var(--feb-muted); font-size: 13px; }
.feb-resultcount strong { color: var(--feb-ink); }
/* Search: field + live match count + a solid blue button, as one control. */
.feb-search {
  position: relative; display: flex; align-items: center; gap: 8px;
  min-width: 320px; border: 1px solid var(--feb-line); border-radius: 10px;
  background: #fff; padding: 4px 4px 4px 14px;
}
.feb-search:focus-within { border-color: var(--feb-primary); }
.feb-search-input {
  flex: 1 1 auto; min-width: 0; border: 0; background: none;
  padding: 7px 0; font: inherit; font-size: 13px; color: var(--feb-ink);
}
.feb-search-input:focus { outline: none; }
.feb-search-count { flex: 0 0 auto; color: var(--feb-muted); font-size: 12.5px; }
.feb-search-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--feb-primary); color: #fff;
}
.feb-search-spinner { flex: 0 0 auto; width: 14px; height: 14px; display: none; }
.feb-search-spinner.is-visible {
  display: block; border: 2px solid var(--feb-line); border-top-color: var(--feb-primary);
  border-radius: 50%; animation: feb-spin .7s linear infinite;
}
@keyframes feb-spin { to { transform: rotate(360deg); } }

/* Sort dropdown — native <select>, restyled; the chevron is ours. */
.feb-sort { position: relative; display: inline-flex; align-items: center; }
.feb-sort select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--feb-line); border-radius: 10px; background: #fff;
  color: var(--feb-ink); font: inherit; font-size: 13px;
  padding: 9px 34px 9px 14px; cursor: pointer;
}
.feb-sort select:focus { outline: none; border-color: var(--feb-primary); }
.feb-sort-chev { position: absolute; right: 12px; color: var(--feb-muted); pointer-events: none; }
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---- empty state / load more ---- */
.feb-empty { margin: 26px 0; text-align: center; color: var(--feb-muted); }
.feb-loadmore-wrap { display: flex; justify-content: center; margin-top: 20px; }
.feb-loadmore {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--feb-line);
  background: #fff; color: var(--feb-ink); border-radius: 10px; padding: 10px 22px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.feb-loadmore:hover { border-color: var(--feb-primary); color: var(--feb-primary); }

/* ---- numbered pages ---- */
/* Filled in by fame-list-controller.js after every load, so a filter that
   shrinks the set reshapes the pager with it. A list without this element keeps
   its Load More button instead. */
.feb-pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 26px; flex-wrap: wrap; }
.feb-pager[hidden] { display: none; }
.feb-page {
  min-width: 38px; height: 38px; padding: 0 11px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--feb-line); border-radius: 50%; background: #fff;
  color: var(--feb-ink); font: inherit; font-size: 13.5px; cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.feb-page:hover:not(:disabled):not(.is-active) { border-color: #c7d5ee; }
.feb-page.is-active { background: var(--feb-primary); border-color: var(--feb-primary); color: #fff; font-weight: 600; }
.feb-page:disabled { opacity: .45; cursor: default; }
.feb-page:focus-visible { outline: 2px solid var(--feb-primary); outline-offset: 2px; }
.feb-page-gap { color: var(--feb-muted); padding: 0 2px; }

@media (max-width: 860px) {
  .feb-layout { grid-template-columns: 1fr; }
  .feb-quickbar .feb-search { margin-left: 0; width: 100%; min-width: 0; }
}
