/* Question bank: filters, result count, question tiles and pager.
   Tokens and shared components come from atom.css. */

i[data-icon] { display: inline-flex; font-style: normal; }

.bank { display: grid; gap: 22px; }

/* ---------- Filters ---------- */

.filters { display: grid; gap: 14px; }

.search-field {
  position: relative;
  display: block;
}

.search-field input {
  min-height: 48px;
  padding-left: 44px;
  font-size: 1rem;
}

.search-field i[data-icon] {
  position: absolute;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  pointer-events: none;
}

.search-field .icon-svg { width: 20px; height: 20px; }

.filter-selects {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.filter .label { margin: 0 0 6px; }

/* ---------- Results ---------- */

.results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.result-count {
  font-weight: 600;
  color: var(--text);
}

.result-count .numerals {
  font-size: 1.6rem;
  margin-right: 4px;
  vertical-align: -2px;
}

.status { font-size: 0.9rem; }

.bank-error { margin: 0; }

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}

/* ---------- Question tile ---------- */

.tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--rule);
  border-radius: var(--r-panel);
  background: var(--plate);
}

.tile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tile-tags .tag {
  height: 24px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.tile-question {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.5em;
  font-size: 1.05rem;
  line-height: 1.5;
}

/* Picture questions: a shimmer placeholder until the image loads. */
.tile-figure {
  position: relative;
  min-height: 120px;
  border-radius: var(--r-control);
  overflow: hidden;
  background: #ffffff;
}
.tile-figure img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  transition: opacity 200ms var(--ease);
}
.tile-figure.loading { background: var(--plate-2); }
.tile-figure.loading img { opacity: 0; }
.tile-figure.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--text) 10%, transparent) 50%, transparent 80%);
  background-size: 200% 100%;
  animation: tile-shimmer 1.2s linear infinite;
}
@keyframes tile-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.tile-figure.failed { min-height: 0; padding: 12px; background: var(--plate-2); font-size: 0.9rem; }

@media (prefers-reduced-motion: reduce) {
  .tile-figure.loading::after { animation: none; }
}

.tile-answer {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.tile-answer strong {
  color: var(--correct);
  font-weight: 600;
}

.tile-meta {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.tile-actions .btn { width: 100%; }

/* ---------- Pager ---------- */

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
}

.pager .btn .icon-svg { width: 18px; height: 18px; }

.pager-label {
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Narrow ---------- */

@media (max-width: 960px) {
  .filter-selects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .bank { gap: 18px; }
  .results { grid-template-columns: 1fr; }
  .filter-selects { gap: 10px; }
}
