/*
 * Base stylesheet for the Classroom SPA. It is deliberately generic and shared:
 * the lookup view (U12) uses it now, and the admin (U10) and student (U11) views
 * will reuse the same card, search box, badge, and layout primitives later. All
 * colours come from custom properties so a future theme tweak happens in one
 * place. Australian spelling in any author-facing text. No framework.
 */

:root {
  /* Colour palette. Kept neutral and accessible. The accent is #2563d6: on the
     #f5f6f8 page background it measures ~5.1:1, clearing WCAG AA (4.5:1) for the
     link/accent text that uses it. (The previous #2f6feb was only ~4.2:1, under
     AA.) Status colours below drive the linkage pills. */
  --colour-bg: #f5f6f8;
  --colour-surface: #ffffff;
  --colour-border: #d9dee5;
  --colour-text: #1c2330;
  --colour-text-muted: #5b6776;
  --colour-accent: #2563d6;
  --colour-accent-contrast: #ffffff;

  /* Linkage-status colours: unlinked (needs attention), linked (has account),
     in-progress (repo being built), provisioned (done). Each pairs a soft
     background with a readable foreground. */
  --colour-unlinked-bg: #fdecea;
  --colour-unlinked-fg: #a01b12;
  --colour-linked-bg: #fff5e0;
  --colour-linked-fg: #8a5800;
  --colour-in-progress-bg: #e7f0fd;
  --colour-in-progress-fg: #1a4d8f;
  --colour-provisioned-bg: #e4f6ec;
  --colour-provisioned-fg: #1c6b3c;

  /* Spacing scale, kept small and consistent. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);

  --font-stack: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-stack);
  color: var(--colour-text);
  background: var(--colour-bg);
  line-height: 1.5;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

.page__header {
  margin-bottom: var(--space-5);
}

.page__title {
  margin: 0 0 var(--space-1);
  font-size: 1.6rem;
}

.page__subtitle {
  margin: 0;
  color: var(--colour-text-muted);
}

/* Search box: a labelled, full-width text input used by lookup and reusable by
   admin overview filters. */
.search {
  margin-bottom: var(--space-3);
}

.search__label {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
  font-size: 0.95rem;
}

.search__input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 1rem;
  border: 1px solid var(--colour-border);
  border-radius: var(--radius);
  background: var(--colour-surface);
  color: inherit;
}

.search__input:focus {
  outline: 2px solid var(--colour-accent);
  outline-offset: 1px;
  border-color: var(--colour-accent);
}

.results__count {
  margin: 0 0 var(--space-4);
  color: var(--colour-text-muted);
  font-size: 0.95rem;
}

.results__empty {
  padding: var(--space-5);
  text-align: center;
  color: var(--colour-text-muted);
  background: var(--colour-surface);
  border: 1px dashed var(--colour-border);
  border-radius: var(--radius);
}

/* Card component: the student card today, reusable for any record summary. */
.card {
  background: var(--colour-surface);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
}

.card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}

.card__title {
  margin: 0;
  font-size: 1.2rem;
}

.card__subtitle {
  margin: 0;
  color: var(--colour-text-muted);
  font-size: 0.95rem;
}

/* A simple definition-style grid for the card fields. */
.field-list {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-4);
}

.field-list__term {
  margin: 0;
  font-weight: 600;
  color: var(--colour-text-muted);
}

.field-list__desc {
  margin: 0;
}

.field-list__desc--muted {
  color: var(--colour-text-muted);
}

/* Inline list of links/values (GitHub accounts, repos, groups). */
.inline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.inline-list__item {
  margin: 0;
}

/* Status pills for linkage state and provisioning flags. */
.pill {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.pill--unlinked {
  background: var(--colour-unlinked-bg);
  color: var(--colour-unlinked-fg);
}

.pill--linked {
  background: var(--colour-linked-bg);
  color: var(--colour-linked-fg);
}

.pill--in-progress {
  background: var(--colour-in-progress-bg);
  color: var(--colour-in-progress-fg);
}

.pill--provisioned {
  background: var(--colour-provisioned-bg);
  color: var(--colour-provisioned-fg);
}

/* Link styled as a small button, for "open repo" actions. */
.link-button {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius);
  background: var(--colour-accent);
  color: var(--colour-accent-contrast);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.link-button:hover {
  filter: brightness(0.94);
}

/* Buttons. Shared here (not only in admin.css) so the landing page — which loads
   only this stylesheet — renders its Student/Admin CTAs as real buttons rather
   than bare text links. `.button--primary` is the accent-filled call to action;
   the base `.button` is the neutral/secondary style. */
.button {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  border: 1px solid var(--colour-border);
  background: var(--colour-surface);
  color: var(--colour-text);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  filter: brightness(0.97);
}

.button:disabled {
  opacity: 0.6;
  cursor: default;
}

.button--primary {
  background: var(--colour-accent);
  color: var(--colour-accent-contrast);
  border-color: var(--colour-accent);
}

/* Armed-confirmation state for a destructive two-step button (armConfirm): the
   button becomes its own "are you sure?" prompt, tinted with the unlinked/danger
   palette so the warning reads clearly. */
.button--confirm {
  background: var(--colour-unlinked-bg);
  color: var(--colour-unlinked-fg);
  border-color: var(--colour-unlinked-fg);
}

/* Plain text link colour for GitHub account links. */
a {
  color: var(--colour-accent);
}

/* A small banner noting the page is running on dev fixture data. */
.dev-banner {
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--colour-linked-bg);
  color: var(--colour-linked-fg);
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------------------
 * Auth pending state. While Firebase restores a persisted session, the body is
 * data-auth="pending"; we show a lightweight spinner instead of any sign-in
 * control, so a signed-in reload never flashes the signed-out UI.
 * ------------------------------------------------------------------------- */
.topbar__pending {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  color: var(--colour-muted, #667085);
  font-size: 0.9rem;
}

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

.auth-pending {
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  padding: var(--space-4, 1rem) 0;
  color: var(--colour-muted, #667085);
}

/* The hidden attribute must always win. Author rules that set an explicit
 * `display` (buttons, flex containers) otherwise override the UA [hidden] rule,
 * which silently breaks every `element.hidden = true` toggle in the app. */
[hidden] {
  display: none !important;
}

/* Embedded tutorial recording (student + admin). The webm is 1280x900; scale it
   to the card width and keep letterboxing black so captions stay readable. */
.tutorial-video {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  background: #000;
}
