/* ===== TOPIC / SYLLABUS-POINT SELECTOR (multi-select, cross-topic) =====
   Styles for shared/topic-selector.js. Loaded alongside /styles.css on any page
   that mounts a selector — it depends on that file for the shared palette
   variables, .subtopic-accordion, .dropdown-section-label and .tutor-chip.

   Topic > subtopic-group pill > individual syllabus point.
   - Topic row expands into its subtopic pills via the same accordion pattern as
     Settings' subject picker (.subtopic-accordion, grid-rows collapse).
   - Each subtopic pill carries its own "Advanced options" bar along its bottom edge;
     opening it reveals that group's individual point checkboxes inline (same
     grid-rows collapse idiom — safe here since point descriptions are plain text,
     see CLAUDE.md's note on that idiom failing with MathJax content).
   - Checkboxes are the custom .topic-selector-check control (mirrors Settings/
     onboarding's .subject-tile .check-icon), not a native <input>, so a third,
     visually distinct indeterminate state (some-but-not-all children selected) can be
     drawn: coloured outline, hollow centre, small dash — vs. the solid accent fill of
     "fully selected". */
.topic-selector-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 8px;
}

.topic-selector-empty {
  margin: 8px 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.topic-selector-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.topic-selector-row-topic:hover {
  background: var(--surface-soft);
}

/* Custom checkbox — mirrors .subject-tile .check-icon / .checked exactly, plus a
   third "indeterminate" visual not needed there: coloured outline, unfilled centre,
   small accent dash, distinct from the solid fill of a full selection. */
.topic-selector-check {
  position: relative;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.topic-selector-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.topic-selector-check.checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid var(--accent-contrast);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.topic-selector-check.indeterminate {
  background: transparent;
  border-color: var(--accent);
}

.topic-selector-check.indeterminate::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 6.5px;
  width: 8px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.topic-selector-label {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
}

.topic-selector-expand {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 4px;
  transition: transform 0.2s ease;
}

.topic-selector-expand-open {
  transform: rotate(180deg);
}

/* Subtopic pill — same tile treatment as .subject-tile, but taller to make room for
   the advanced-options bar along its bottom edge. */
.topic-selector-group {
  margin-left: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.topic-selector-group .topic-selector-row {
  border-radius: 0;
  padding: 8px 10px;
}

.topic-selector-group .topic-selector-row:hover {
  background: var(--surface-soft);
}

.topic-selector-group .topic-selector-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.topic-selector-advanced-bar {
  display: block;
  width: 100%;
  background: var(--surface-soft);
  border: none;
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-family: var(--font-note);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.64rem;
  text-align: center;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

.topic-selector-advanced-bar:hover,
.topic-selector-advanced-bar.topic-selector-advanced-bar-open {
  color: var(--accent);
  background: var(--accent-soft);
}

.topic-selector-points {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 0.25s ease;
  border-top: 1px solid var(--border-soft);
}

.topic-selector-points.open {
  grid-template-rows: 1fr;
}

.topic-selector-points-inner {
  min-height: 0;
}

.topic-selector-row-point {
  align-items: flex-start;
  padding: 7px 10px;
}

.topic-selector-point-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ===== SELECTED CHIPS ===== */
.topic-selector-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topic-selector-chips[hidden] {
  display: none;
}

.topic-selector-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}

.topic-selector-chip-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
}
