/*
  Shared design tokens, built from the EduRem logo's own palette (red / navy /
  orange, hand-drawn rocket mark) rather than a generic scheme — but still
  computed against WCAG 2.2 AA (4.5:1 body text), not eyeballed:
    navy on cream      13.1:1   red on cream        4.7:1
    white on red        5.0:1   navy on orange-tint 11.1:1
*/
:root {
    --ink: #1e2a56;
    --ink-soft: #47548a;
    --ink-faint: #7b84ab;
    --paper: #fbf9f4;
    --surface: #ffffff;
    --red: #d6293b;
    --red-tint: #fbdde1;
    --orange: #f2994a;
    --orange-tint: #fbe3c6;
    --line: #e3ddd0;
    --focus-ring: #d6293b;
    /* Semantic, not brand — a "consent given" state, kept separate from red/orange. */
    --success: #1a5c38;
    --success-tint: #dcf0e3;

    /* No web font is loaded — an unlinked font name here would just silently fall through to
       the next one. Personality comes from colour, rounded shapes, and the logo instead of a
       novelty display face, which also reads better for younger/struggling readers. */
    --font-display: "Segoe UI Rounded", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #f3f1ea;
        --ink-soft: #b7bee0;
        --ink-faint: #7b84ab;
        --paper: #12172b;
        --surface: #1a2140;
        --red: #ef5b6b;
        --red-tint: #4a1620;
        --orange: #f2b06e;
        --orange-tint: #4a3115;
        --line: #2c3560;
        --focus-ring: #ef5b6b;
        --success: #5cc98a;
        --success-tint: #16321f;
    }
}

html {
    background: var(--paper);
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.6;
}

h1, h2, h3 {
    font-family: var(--font-display);
    text-wrap: balance;
    letter-spacing: -0.01em;
}

h1 {
    font-size: clamp(1.75rem, 4vw + 1rem, 2.5rem);
    line-height: 1.15;
}

h2 {
    font-size: clamp(1.15rem, 1vw + 1rem, 1.4rem);
}

/* Keyboard focus must stay visible — a Year 3 student navigating by keyboard
   or switch access needs to see where they are at least as much as anyone. */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

h1:focus {
    outline: none;
}

/* Generous padding is a real accessibility choice, not just style — larger touch
   targets matter for a Year 3 student tapping on a shared tablet. */
button[type="submit"], input[type="submit"] {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--red);
    border: none;
    border-radius: 10px;
    padding: 0.7em 1.4em;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(30, 42, 86, 0.25);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.15s ease;
}

button[type="submit"]:hover, input[type="submit"]:hover {
    background: var(--ink);
}

button[type="submit"]:active, input[type="submit"]:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(30, 42, 86, 0.25);
}

@media (prefers-reduced-motion: reduce) {
    button[type="submit"], input[type="submit"] {
        transition: none;
    }
}

/* Anchor styled as a primary button — for a navigation action that isn't a form submit (e.g.
   Register.razor's "Continue to sign in" Entra redirect). Kept visually identical to
   button[type="submit"] so the affordance reads the same whether the element underneath is a
   link or a real submit. (Found undefined/orphaned in the markup during the ADR 0025 visual
   pass — Register.razor referenced class="button" with no matching rule, so it was silently
   falling back to a plain underlined text link.) */
a.button {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--red);
    border: none;
    border-radius: 10px;
    padding: 0.7em 1.4em;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(30, 42, 86, 0.25);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.15s ease;
}

a.button:hover {
    background: var(--ink);
    color: #ffffff;
}

a.button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(30, 42, 86, 0.25);
}

@media (prefers-reduced-motion: reduce) {
    a.button {
        transition: none;
    }
}

label {
    display: block;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.3em;
}

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input:not([type]), textarea, select {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--ink);
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 8px;
    padding: 0.55em 0.7em;
    margin-bottom: 0.8em;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 4px var(--red-tint);
}

@media (prefers-reduced-motion: reduce) {
    input, textarea, select {
        transition: none;
    }
}

select {
    appearance: none;
    min-width: 8em;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 2l4.5 4 4.5-4' stroke='%231e2a56' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75em center;
    background-size: 0.7em;
    padding-right: 2.2em;
}

/* Shared page chrome so every page — not just Home — carries the brand.
   align-items: flex-start (not center) matters here: if a long heading wraps
   to two lines on a narrow screen, centering would strand the logo next to
   the *second* line instead of sitting with the first. */
.page-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.page-header img {
    display: block;
    flex-shrink: 0;
    margin-top: 0.15em;
}

.page-header h1 {
    margin: 0;
}

.card {
    background: var(--surface);
    border: 2px solid var(--line);
    border-top-width: 4px;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 4px 14px rgba(30, 42, 86, 0.07);
}

.card + .card {
    margin-top: 1.25rem;
}

/* Top-border colour encodes the same category as the card's .tag — real
   information, not decoration for its own sake. */
.card--orange {
    border-top-color: var(--orange);
}

.card--red {
    border-top-color: var(--red);
}

/* `/admin/content*` pages (ADR 0028 follow-up) — plain data tables, not styled to any
   age-band since this surface is adult-only (GlobalAdmin policy). */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th, .admin-table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--line);
}

.admin-table th {
    font-weight: 600;
}

.draft-chapter {
    margin-bottom: 1rem;
}

.draft-chapter h4 {
    margin: 0 0 0.4rem;
}

.draft-chapter ul {
    margin: 0;
    padding-left: 1.25rem;
}

.draft-content {
    white-space: pre-wrap;
    background: var(--bg, #f4f4f4);
    border-radius: 8px;
    padding: 1rem;
    max-height: 24rem;
    overflow-y: auto;
}

/* `/admin/content*` breadcrumb + generation-metadata line and the chapter/topic edit form. */
.breadcrumb {
    color: var(--ink-faint);
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
}

.note {
    color: var(--ink-faint);
    font-size: 0.9rem;
}

/* ER-32: the video transcript is collapsed by default (<details> is closed unless [open] is
   set) so it sits alongside the player without competing with it for attention. */
.transcript {
    margin-top: 0.75rem;
}

.transcript summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ink-soft);
}

.edit-chapter {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.edit-topic {
    border-top: 1px dashed var(--line);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.edit-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.edit-row label {
    font-size: 0.82rem;
    color: var(--ink-faint);
    min-width: 9rem;
}

.edit-row input {
    flex: 1 1 auto;
    min-width: 12rem;
    margin-bottom: 0;
}

.edit-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.bulk-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--paper);
}

.dek {
    color: var(--ink-faint);
    margin: -1rem 0 1.75rem;
    max-width: 60ch;
}

/* /admin/course-status — a live, per-course version of specs/content-pipeline.md's own stages. */
.stage-tracker {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.stage {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.stage h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.stage p {
    margin: 0;
    color: var(--ink-faint);
}

.stage-marker {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid var(--line);
}

.stage-done {
    border-color: var(--orange);
}

.stage-done .stage-marker {
    background: var(--orange);
    border-color: var(--orange);
    color: #fff;
}

.stage-pending .stage-marker {
    color: var(--ink-faint);
}

/* Password fields that a *parent* sets/resets on behalf of a young student (Dashboard's
   "register a student" form, StudentDetails' "reset login password" form) — Entra's 8+ char,
   mixed-case/digit/symbol policy is real friction for a Year 3 student who can't type or
   remember it unaided. Hiding it with no way to check it back before the parent writes it down
   is a real usability trap, not just a style nicety, hence the always-available Show/Hide.
   Toggle behaviour is plain progressive-enhancement JS (wwwroot/js/password-toggle.js,
   event-delegated on document), not Blazor interactivity — both forms this appears on are
   static SSR (no @rendermode) by the developer's design, and this doesn't need to change that. */
.password-field {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 0.8em;
}

.password-field input {
    flex: 1 1 auto;
    margin-bottom: 0;
}

.password-toggle {
    flex: 0 0 auto;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink);
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 8px;
    padding: 0 1em;
    min-width: 4.5em;
    cursor: pointer;
}

.password-toggle:hover {
    border-color: var(--ink-faint);
}

.password-toggle[aria-pressed="true"] {
    background: var(--orange-tint);
    border-color: var(--orange);
}

/* Shared by Register.razor and Login.razor — a centred single-card auth page. */
.auth-page {
    display: flex;
    justify-content: center;
    padding-top: 1.5rem;
}

.auth-page .card {
    width: 100%;
    max-width: 420px;
}

.auth-footer {
    margin-top: 1.25rem;
    margin-bottom: 0;
    color: var(--ink-soft);
}

/* Both auth pages otherwise have no plain-text links, so this was the one spot where an
   unstyled <a> would fall back to browser-default blue/purple against the brand palette. */
.auth-footer a, .auth-page .card > p a {
    color: var(--red);
    font-weight: 600;
}

/* Visually hides content while keeping it in the accessibility tree — e.g. a form label that's
   redundant next to a visible placeholder, or status text a screen reader should announce
   without a sighted student seeing duplicate text on screen. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tag {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink);
    background: var(--orange-tint);
    border-radius: 999px;
    padding: 0.3em 0.75em;
}

/* Semantic state, used across Dashboard and StudentDetails — kept global since
   scoped per-component CSS wouldn't apply across both. */
.tag-ok {
    color: var(--success);
    background: var(--success-tint);
}

/* Parent-visible "stuck" alert (ER-38) — same red used for validation errors, since this is the
   same "needs a human's attention" severity, just on the progress report instead of a form. */
.tag-alert {
    color: var(--red);
    background: var(--red-tint);
    margin-left: 0.4em;
}

/* Live whiteboard (ER-43) — a fixed height so the embedded Excalidraw canvas (which sizes itself
   to its container) has somewhere concrete to lay out into inside the split panel. */
.whiteboard-canvas {
    height: 500px;
    width: 100%;
    border: 1px solid var(--border, #ddd);
    border-radius: 8px;
}

/* Grade 1-4 quick-choice buttons (ER-45) — same generous, large-touch-target sizing as
   button[type="submit"] above ("larger touch targets matter for a Year 3 student tapping on a
   shared tablet"), stacked with room to breathe rather than crammed into one row. */
.tutor-quick-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em;
    margin-bottom: 1em;
}

.tutor-quick-choices button {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    background: var(--orange-tint);
    border: 3px solid transparent;
    border-radius: 10px;
    padding: 0.8em 1.2em;
    cursor: pointer;
}

/* ER-115: a tapped-but-not-yet-committed choice — filled orange with a matching border, distinct
   from the soft unselected tint, so the student can see what they picked before it's locked in. */
.tutor-quick-choices button[aria-pressed="true"] {
    background: var(--orange);
    border-color: var(--ink);
}

/* ER-115: commits the young-band flow's current selection — same big-tap-target CTA language as
   button[type="submit"] rather than a bespoke style, since it plays the same "the one obvious next
   action" role. */
.tutor-quick-next {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--red);
    border: none;
    border-radius: 10px;
    padding: 0.7em 1.4em;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(30, 42, 86, 0.25);
}

.tutor-quick-next:disabled {
    background: var(--ink-faint);
    box-shadow: none;
    cursor: not-allowed;
}

.tutor-quick-next:hover:not(:disabled) {
    background: var(--ink);
}

.tutor-quick-next:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(30, 42, 86, 0.25);
}

/* ER-115: on-demand question-audio replay, next to the question text rather than in the choice
   row so it doesn't get mistaken for another answer option. */
.tutor-replay-button {
    font-size: 1.2rem;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 0.3em;
    vertical-align: middle;
}

/* ER-117: number-pad-style entry for Numeric questions (ADR 0061 §4) — same large-tap-target
   language as .tutor-quick-choices, laid out in a wrapping grid rather than one long row. */
.numeric-answer-input__display {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--ink);
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 10px;
    padding: 0.4em 0.8em;
    min-height: 1.4em;
    text-align: center;
}

.numeric-answer-input__keypad {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em;
    margin-bottom: 1em;
}

.numeric-answer-input__keypad button {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    background: var(--orange-tint);
    border: none;
    border-radius: 10px;
    padding: 0.8em;
    min-width: 2.6em;
    cursor: pointer;
}

/* ER-117: tap-an-image grid for ImageChoice questions (ADR 0061 §3/§4) — same selected-state
   convention as .tutor-quick-choices button[aria-pressed="true"]. */
.image-choice-answer-input {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em;
    margin-bottom: 1em;
}

.image-choice-answer-input button {
    background: var(--orange-tint);
    border: 3px solid transparent;
    border-radius: 10px;
    padding: 0.5em;
    cursor: pointer;
}

.image-choice-answer-input button[aria-pressed="true"] {
    background: var(--orange);
    border-color: var(--ink);
}

.image-choice-answer-input img {
    display: block;
    max-width: 8em;
    max-height: 8em;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.success-message {
    color: var(--success);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}
