/* Classes (registration aid) — search table, seat/RMP chips, weekly grid.
   Every colour comes from the css/base.css variables so the view follows the
   theme toggle; status chips use the --status-* tokens, and the course
   palette below ships a dark-mode override. */

/* ---------- tabs ---------- */
.reg-tabs {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.reg-tab {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-md);
  cursor: pointer;
}
.reg-tab:hover { border-color: var(--accent); color: var(--text); }
.reg-tab.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ---------- "we never register for you" banner ---------- */
.reg-notice {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--text);
}
.reg-notice strong { color: var(--accent); }
.reg-notice-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: var(--sp-1);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-2xs);
  font-style: normal;
  line-height: 1;
  cursor: help;
  vertical-align: -2px;
}

.reg-error { color: var(--danger); margin: var(--sp-3) 0 0; }

/* ---------- search ---------- */
.reg-searchbar .form-row { margin-bottom: var(--sp-3); }
.reg-searchbar .form-row > div { min-width: 150px; }

/* The Term <select> and the text inputs line up through the base control
   height (--control-h on input and select in css/base.css, F-25). */

/* natural-language search under the subject/number form */
.reg-semantic { margin-top: var(--sp-3); }
.reg-semantic-row { display: flex; gap: var(--sp-3); align-items: center; }
.reg-semantic-row input { flex: 1; min-width: 0; }
.reg-semantic-row .btn { flex: none; white-space: nowrap; }

.reg-note { margin: var(--sp-3) 0 0; }

.reg-table-wrap { padding: 0; overflow-x: auto; }
.reg-table { min-width: 860px; }
.reg-table td { vertical-align: top; }
.reg-table tbody tr:hover { background: var(--surface-2); }

/* Results table (issue #16 F-46): the course code and each clock time never
   break, and the two chip columns take only their chip's width. */
.reg-code { font-weight: 700; white-space: nowrap; }
.reg-nowrap { white-space: nowrap; }
.reg-table .reg-fit { width: 1%; white-space: nowrap; }

.reg-actions {
  text-align: right;
  white-space: nowrap;
}
.reg-actions .btn { margin-left: var(--sp-2); }

/* ---------- seat chips ---------- */
.seat-chip {
  display: inline-block;
  padding: var(--sp-0) var(--sp-2);
  border-radius: var(--radius);
  font-size: var(--fs-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.seat-green { background: var(--status-ok-bg); color: var(--status-ok-fg); }
.seat-amber { background: var(--status-warn-bg); color: var(--status-warn-fg); }
.seat-red   { background: var(--status-bad-bg); color: var(--status-bad-fg); }
.seat-grey  { background: var(--surface-2); color: var(--text-muted); }

/* ---------- RateMyProfessors chip ---------- */
.rmp-chip {
  display: inline-block;
  margin-top: var(--sp-1);
  padding: 1px var(--sp-2);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: var(--fs-2xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}
a.rmp-chip:hover { border-color: currentColor; }
.rmp-chip.good { background: var(--status-ok-bg); color: var(--status-ok-fg); }
.rmp-chip.ok   { background: var(--status-warn-bg); color: var(--status-warn-fg); }
.rmp-chip.bad  { background: var(--status-bad-bg); color: var(--status-bad-fg); }
.rmp-chip.none,
.rmp-chip.loading { background: var(--surface-2); color: var(--text-muted); }
.rmp-chip.loading { opacity: 0.7; }

/* ---------- schedule builder ---------- */
.reg-prefs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  /* 12px down to Generate schedules, not 4px (issue #16 F-97). */
  margin: var(--sp-3) 0 var(--sp-3);
}
.reg-pref {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
/* The shared .checkbox size (square), not a 13px-wide auto box
   (issue #16 F-97). */
.reg-pref input { flex: none; }

.reg-candidates { display: flex; flex-direction: column; gap: var(--sp-3); }
.reg-cand-course { font-weight: 700; margin-bottom: var(--sp-2); }
.reg-cand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.reg-schedules { display: flex; flex-direction: column; gap: var(--sp-4); margin-top: var(--sp-4); }
.reg-schedule { overflow-x: auto; }

.reg-crns { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.reg-crn {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius);
  font-size: var(--fs-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
}

/* ---------- weekly grid (pure CSS grid, no canvas) ---------- */
.week-grid {
  display: grid;
  gap: 0;
  /* Never wider than its card beside the sidebar (a 470px card at 768 used
     to scroll); phones keep the 480px floor below and scroll (issue #16
     item 4). */
  min-width: min(560px, 100%);
  position: relative;
  font-size: var(--fs-2xs);
}

.wg-head {
  text-align: center;
  font-weight: 700;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp-0);
}

.wg-hour {
  font-size: var(--fs-2xs);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right;
  padding-right: var(--sp-1);
  transform: translateY(-6px);
  white-space: nowrap;
}

.wg-line { border-top: 1px solid var(--border); pointer-events: none; }

.wg-block {
  margin: 1px var(--sp-0);
  padding: var(--sp-0) var(--sp-1);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 1;
}
.wg-course, .wg-meta {
  line-height: var(--lh-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wg-course { font-weight: 700; font-size: var(--fs-2xs); }
.wg-meta { font-size: var(--fs-2xs); opacity: 0.8; font-variant-numeric: tabular-nums; }

/* Eight stable course colours (index from a hash of the course code). */
.c0, .wg-block.c0 { background: #e0e7ff; color: #3730a3; }
.c1, .wg-block.c1 { background: #dcfce7; color: #166534; }
.c2, .wg-block.c2 { background: #fef3c7; color: #92400e; }
.c3, .wg-block.c3 { background: #fce7f3; color: #9d174d; }
.c4, .wg-block.c4 { background: #cffafe; color: #155e75; }
.c5, .wg-block.c5 { background: #ede9fe; color: #5b21b6; }
.c6, .wg-block.c6 { background: #ffedd5; color: #9a3412; }
.c7, .wg-block.c7 { background: #e2e8f0; color: #334155; }

/* ---------- dark theme ---------- */
:root[data-theme="dark"] .wg-block { border-color: rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .c0, :root[data-theme="dark"] .wg-block.c0 { background: #262a52; color: #c7d2fe; }
:root[data-theme="dark"] .c1, :root[data-theme="dark"] .wg-block.c1 { background: #14351f; color: #86efac; }
:root[data-theme="dark"] .c2, :root[data-theme="dark"] .wg-block.c2 { background: #422f06; color: #fcd34d; }
:root[data-theme="dark"] .c3, :root[data-theme="dark"] .wg-block.c3 { background: #4a1230; color: #f9a8d4; }
:root[data-theme="dark"] .c4, :root[data-theme="dark"] .wg-block.c4 { background: #0d3a44; color: #a5f3fc; }
:root[data-theme="dark"] .c5, :root[data-theme="dark"] .wg-block.c5 { background: #2e1f57; color: #ddd6fe; }
:root[data-theme="dark"] .c6, :root[data-theme="dark"] .wg-block.c6 { background: #45230b; color: #fed7aa; }
:root[data-theme="dark"] .c7, :root[data-theme="dark"] .wg-block.c7 { background: #262b38; color: #cbd5e1; }



/* ---------- narrow screens ---------- */
@media (max-width: 760px) {
  .reg-searchbar .form-row { flex-direction: column; }
  /* In a column the shared .form-row > div basis (160px) became a height and
     left each field 170px tall with the input at the top. */
  .reg-searchbar .form-row > div { flex: none; }
  .reg-semantic-row { flex-direction: column; align-items: stretch; }
  .week-grid { min-width: 480px; }
}

/* Layout fixes (issue #16 item 5): at 560px and under the spacer in a schedule's
   header only stranded "Copy CRNs" on a row of its own; the facts line moves
   under the title and buttons so the buttons share the title's row. */
@media (max-width: 560px) {
  .reg-schedule > .toolbar > .spacer { display: none; }
  .reg-schedule > .toolbar > .item-meta { order: 1; flex-basis: 100%; }
}

/* Layout fixes (issue #16 item 6): stacked at 760px and under, flex:1 1 0% gave
   the by-meaning input a zero basis in the column and left it 21px tall. */
@media (max-width: 760px) {
  .reg-semantic-row input { flex: none; }
}
