/* Question Bank — card-based browse view + practice mode.
   Token-driven throughout, so light and dark both come from css/base.css.
   Fresh qb2-* names (plus .qbank-search / .qbank-progress) — the legacy
   .qbank-* rules in css/question-bank.css belong to the old caret-row UI. */

/* ---- header row: count · search · practice ---- */
.qb2-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.qb2-head .spacer { flex: 1; }
.qbank-search {
  width: min(260px, 100%);
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.qbank-search:focus {
  outline: none;
  border-color: var(--accent);
}
.qbank-search::placeholder { color: var(--text-muted); }

/* ---- question cards ---- */
.qb2-cards {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.qb2-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  cursor: pointer;
}
.qb2-card:hover { border-color: var(--accent); }
.qb2-card.open { background: var(--surface-2); }
.qb2-hint { margin: 0 0 var(--sp-3); }

/* The class chip gets its own line above the question, so every question
   starts at the same x whatever the chip's width (issue #16 F-65). */
.qb2-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--sp-1) var(--sp-3);
}
.qb2-card-top > .class-chip { grid-column: 1 / -1; justify-self: start; }
.qb2-q {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: var(--fs-md);
  line-height: var(--lh);
}
.qb2-date {
  flex-shrink: 0;
  margin-left: auto;
  font-size: var(--fs-2xs);
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---- expanded answer block ---- */
.qb2-body {
  margin-top: var(--sp-3);
  border-top: 1px solid var(--border);
  padding-top: var(--sp-3);
  cursor: auto;
}
.qb2-label {
  margin-top: var(--sp-2);
}
.qb2-label:first-child { margin-top: 0; }
.qb2-answer { margin-top: var(--sp-0); font-size: var(--fs-md); }
.qb2-why { margin-top: var(--sp-0); font-size: var(--fs-sm); color: var(--text-muted); }

/* ---- source chips ---- */
.qb2-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.qb2-chip {
  padding: var(--sp-0) var(--sp-2);
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
}
.qb2-chip:hover { border-color: var(--accent); color: var(--accent); }

/* Layout fixes (issue #16 item 1): a long file name breaks inside its own
   chip instead of widening the page (F-02). The course filter is the shared
   .course-tab now, which wraps the same way (css/notes-bar.css). */
.qb2-chip { max-width: 100%; text-align: left; overflow-wrap: anywhere; }

/* ---- practice mode ---- */
.qb2-practice-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.qb2-practice-head .spacer { flex: 1; }
.qbank-progress {
  height: 4px;
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: var(--sp-3);
}
.qbank-progress-fill {
  height: 100%;
  border-radius: var(--radius);
  background: var(--accent);
  transition: width 0.2s ease;
}
.qb2-practice-card { padding: var(--sp-4); }
.qb2-practice-q {
  font-weight: 700;
  font-size: var(--fs-body);
  line-height: var(--lh);
  margin-bottom: var(--sp-2);
}
