/* Class tabs — the Ask / Study guide / Grades / Notes panels under a class.
   Token-driven throughout, so light and dark both come from css/base.css; there
   is not a literal colour in this file. The panels lean on shared components
   wherever one already exists (.card, .btn, .toolbar, .chat-thread from
   css/base.css; .note-grid / .note-card from notes.css) — only what those cannot
   express lives here, prefixed .ctab- so nothing here can reach another view. */

/* A vertical rhythm the panels share: several of them stack a chips row, a
   scope line, a tools row and a result, and each of those is a separate
   append into the page body. */
.ctab-stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.ctab-lead { align-self: center; }

/* ---- Ask ---- */
.ctab-chat-bar { margin-bottom: var(--sp-3); }

.ctab-hint { margin-bottom: var(--sp-3); }
.ctab-hint-title { font-weight: 600; margin-bottom: var(--sp-1); }

/* Sticky so the input stays reachable however long the transcript grows. The
   background is opaque on purpose — the thread scrolls underneath it. */
.ctab-composer {
  display: flex;
  gap: var(--sp-3);
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: var(--sp-2) 0;
}
.ctab-composer-input { flex: 1; }
/* Ask keeps its width while it reads "…" (issue #16 F-69). */
.ctab-composer > .btn { min-width: 60px; }

/* ---- Study guide: the chapter picker ---- */
.ctab-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-0) 0 var(--sp-2);
}

/* Pills rather than the underline .course-tab: these are a multi-select, and
   an underline reads as "one of these is where you are". */
.ctab-chip {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-2);
  max-width: 100%;
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ctab-chip:hover { border-color: var(--accent); color: var(--text); }
.ctab-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.ctab-chip-n {
  flex-shrink: 0;
  font-size: var(--fs-2xs);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

/* The sentence that says, in words, what the tools below will read from. */
.ctab-scope {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* One 16px step from the tools to the result, and inside a result the stack
   gap alone separates a toolbar from what follows (issue #16 F-64). */
.ctab-tools { margin-bottom: var(--sp-4); }
.ctab-stack > .toolbar { margin-bottom: 0; }
.ctab-tool { margin-bottom: var(--sp-4); }
.ctab-added { align-self: center; }

/* ---- Study guide: flashcards ---- */
.ctab-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: var(--sp-3);
}
button.card.ctab-flip {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-height: 110px;
  text-align: left;
  cursor: pointer;
  color: var(--text);        /* buttons don't inherit — dark-mode readability */
  font: inherit;
}
.ctab-flip:hover { border-color: var(--accent); }
.ctab-flip-body { font-weight: 600; overflow-wrap: anywhere; }
.ctab-flip.flipped .ctab-flip-body { font-weight: 400; }

/* ---- Study guide: summary + quiz ---- */
.ctab-summary { line-height: var(--lh-loose); }

.ctab-score { align-self: flex-start; font-variant-numeric: tabular-nums; }

.ctab-q {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.ctab-q-text { font-weight: 600; }
.ctab-choices {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.ctab-choice {
  text-align: left;
  justify-content: flex-start;
  overflow-wrap: anywhere;
}
/* Marked only after an answer is locked in; a disabled .btn dims itself, so
   these two set their own colour explicitly to stay legible. */
/* Correct reads as success, not as the accent a picked button uses
   (issue #16 F-91). */
.ctab-choice.right,
.ctab-choice.right:disabled {
  border-color: var(--success);
  background: var(--success);
  color: var(--on-accent);
  opacity: 1;
}
.ctab-choice.wrong,
.ctab-choice.wrong:disabled {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--on-accent);
  opacity: 1;
}
.ctab-explain { margin-top: var(--sp-0); }

/* ---- shared: a failure that is the panel's whole content ---- */
.ctab-error {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---- Grades: the line pointing at the all-classes view ---- */
.ctab-foot {
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.ctab-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.ctab-link:hover { color: var(--accent-hover); }

@media (max-width: 760px) {
  .ctab-cards { grid-template-columns: minmax(0, 1fr); }
}
