/* Student Trajectory — Custom Styles */

/* Student Trajectory's palette — the platform default, worn by any organisation
   that has not chosen colours of its own. These were one customer's navy and
   gold (#163960 / #E8AE44) until 2026-09-20.

   The variable NAMES are historical and now misdescribe the colours: --at-gold
   is a teal. Renaming them touches every rule in this file and several
   templates, so it is left as a separate job rather than folded into a colour
   change. The values here must stay in step with DEFAULT_PRIMARY_COLOR and
   DEFAULT_ACCENT_COLOR in models.py; a check asserts they do. */
:root {
    --at-navy:  #1D3557;
    --at-gold:  #2A7F72;
    --at-navy-dark: #142740;
    --at-gold-hover: #36a08f;
}

/* ── Body ─────────────────────────────────────────────────── */
body {
    background-color: #f4f6f9;
}

/* ── Navbar ───────────────────────────────────────────────────
   Two rows: row 1 is brand + search + utility, row 2 is the main menu.
   Sticky/background/border live on the wrapper so the two rows read as one
   bar; each row is transparent and contributes only its own height. */
.at-header {
    background-color: var(--at-navy);
    border-bottom: 3px solid var(--at-gold);
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* The "View as" and "Organization Admin View" bands (beta fixes, F,
   2026-11-17): inside the pinned .at-header, so they never scroll away. White
   on #B34700 is 5.5 to 1 and on #B45309 5.0 to 1 (the guideline is 4.5 to 1);
   the button is the same orange on white. */
.at-band {
    color: #fff;
    padding: .4rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    font-weight: 600;
    font-size: .85rem;
    line-height: 1.3;
}
.at-band-view-as   { background-color: #B34700; --at-band-ink: #B34700; }
.at-band-org-admin { background-color: #B45309; --at-band-ink: #B45309; }
.at-band-button {
    background: #fff;
    color: var(--at-band-ink);
    border: none;
    border-radius: 4px;
    padding: .2rem .7rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.at-band-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 575.98px) {
    .at-band { padding: .35rem .75rem; font-size: .8rem; }
    .at-band-button { padding: .15rem .5rem; }
}

/* On paper the menu bar is an ordinary block at the top of the first page.
   Sticky, it was printed again over the top of the page's content (Pete,
   2026-09-26). */
@media print {
    .at-header {
        position: static !important;
    }
}

.at-navbar {
    background-color: transparent !important;
    padding-top: 0;
    padding-bottom: 0;
}

/* Row 1 sits a shade darker so the two rows separate without a rule line —
   a border here would still show when row 2 is collapsed to zero height. */
.at-row1 { background-color: rgba(0, 0, 0, 0.18) !important; }

.at-brand {
    padding: 5px 0;
    margin-right: 1rem;
    line-height: 1;
}

/* Smaller than the one-row layout: two rows means the logo no longer has to
   carry the bar's whole height. */
.at-logo {
    height: 36px;
    width: auto;
    display: block;
}
/* A company's own logo (Pete, 2026-10-02): the trimmed copy (logo_display.py,
   empty margins cut away, the uploaded file untouched), 42px tall and as wide
   as its shape needs up to 260px, never stretched; 34 by 180 on a phone
   (logo_display.DISPLAY['menu']). */
.at-logo-org {
    height: 42px;
    max-width: 260px;
    object-fit: contain;
    object-position: left center;
}
@media (max-width: 575.98px) {
    .at-logo-org { height: 34px; max-width: 180px; }
}

/* A branded organisation that has not uploaded a logo shows its NAME here
   instead. Sized to occupy the same band as .at-logo so the bar does not
   change height, and white because .at-header is painted --at-navy. */
.at-brand-name {
    display: block;
    line-height: 36px;
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
    white-space: nowrap;
}

/* Nav links — every top-level item is labeled. Each row stays compact so the
   two together aren't much taller than the old single row. */
.at-navbar .nav-link {
    color: rgba(255,255,255,0.85) !important;
    white-space: nowrap;
    transition: color 0.15s;
}
.at-row1 .nav-link {
    font-size: 0.92rem;
    padding: 0.5rem 0.6rem !important;
}
.at-row2 .nav-link {
    font-size: 1rem;
    padding: 0.6rem 0.85rem !important;
}
/* First item flush with the logo above it */
.at-row2 .navbar-nav > .nav-item:first-child > .nav-link { padding-left: 0 !important; }
.at-navbar .nav-link:hover,
.at-navbar .nav-link:focus,
.at-navbar .nav-link.active {
    color: var(--at-gold) !important;
}
.at-navbar .dropdown-toggle::after {
    opacity: 0.6;
}

/* Dropdown menus */
.at-navbar .dropdown-menu {
    border: none;
    border-top: 2px solid var(--at-gold);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.at-navbar .dropdown-item:hover {
    background-color: #f0f4f8;
    color: var(--at-navy);
}
.at-navbar .dropdown-item-text {
    font-size: 0.8rem;
}

/* ── Nav search (students + parents) ──────────────────────────
   Row 1 has the whole width to itself now, so the field grows into it. */
.at-search {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 38rem;
    margin-right: 1rem;
}
.at-search-input {
    width: 100%;
    padding-left: 2rem;
    background-color: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}
.at-search-input::placeholder { color: rgba(255,255,255,0.6); }
.at-search-input:focus {
    background-color: #fff;
    color: var(--at-navy);
    border-color: var(--at-gold);
    box-shadow: 0 0 0 0.15rem rgba(232,174,68,0.35);
}
.at-search-input:focus::placeholder { color: #9aa5b1; }
.at-search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    pointer-events: none;
    z-index: 4;
}
.at-search-input:focus ~ .at-search-icon,
.at-search .position-relative:focus-within .at-search-icon { color: #6b7280; }
.at-search-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 22rem;
    max-width: 80vw;
    max-height: 24rem;
    overflow-y: auto;
    padding: 0.25rem 0;
}
.at-search-menu.show { display: block; }
.at-search-menu .dropdown-item { white-space: normal; }
.at-search-empty {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #6b7280;
}
/* Below lg the rows collapse. The search field stays visible in row 1 rather
   than hiding behind the toggler — it's the fastest way to reach a student on
   a phone — and drops onto its own full-width line under the brand. */
@media (max-width: 991.98px) {
    .at-row1 .container { flex-wrap: wrap; }
    .at-brand    { order: 1; }
    .at-toggler  { order: 2; margin-left: auto; }
    .at-search   { order: 3; flex: 0 0 100%; max-width: 100%;
                   margin: 0 0 0.5rem; }
    .at-utility  { order: 4; }
    .at-search-menu { width: 100%; }
    /* Stacked menus need breathing room between rows */
    .at-row1 .navbar-nav,
    .at-row2 .navbar-nav { padding-bottom: 0.4rem; }
    .at-row2 .navbar-nav > .nav-item:first-child > .nav-link { padding-left: 0.85rem !important; }
    .at-row1 .nav-link,
    .at-row2 .nav-link { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
    /* Collapsed row 2 must contribute no height at all */
    .at-row2 { padding: 0; }
    .at-row2 .navbar-collapse.show { border-top: 1px solid rgba(255,255,255,0.12); }
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.card-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
    background-color: var(--at-navy);
    border-color: var(--at-navy);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--at-navy-dark);
    border-color: var(--at-navy-dark);
}
.btn-primary:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(22,57,96,0.4);
}

.btn-outline-primary {
    color: var(--at-navy);
    border-color: var(--at-navy);
}
.btn-outline-primary:hover {
    background-color: var(--at-navy);
    border-color: var(--at-navy);
    color: #fff;
}

/* Gold accent button */
.btn-gold {
    background-color: var(--at-gold);
    border-color: var(--at-gold);
    color: var(--at-navy);
    font-weight: 600;
}
.btn-gold:hover {
    background-color: var(--at-gold-hover);
    border-color: var(--at-gold-hover);
    color: var(--at-navy);
}

/* ── Form controls ────────────────────────────────────────── */
.form-check-input:checked {
    background-color: var(--at-navy);
    border-color: var(--at-navy);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--at-gold);
    box-shadow: 0 0 0 0.2rem rgba(232,174,68,0.25);
}

/* ── Tables ───────────────────────────────────────────────── */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #555;
}

/* ── Misc ─────────────────────────────────────────────────── */
.badge {
    font-weight: 500;
}

.progress {
    border-radius: 4px;
}

.font-monospace {
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Gold highlight for nav active state (used in report pages etc.) */
.at-gold-text { color: var(--at-gold); }
.at-navy-text { color: var(--at-navy); }

/* Red and yellow messages (Pete, 2026-11-04): a card, near what the
   person just did (the script at the end of base.html), with a pulse
   that plays six times and stops (since 2026-11-04, round 6: three was
   too easy to miss, and a little stronger than before). Anyone whose
   computer asks for less motion: no pulse. Green ones: no pulse. They
   stay until dismissed: nothing closes them by itself. */
.msg-card { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .12); border-width: 2px; }
.msg-card.alert-danger  { border-color: #dc3545; }
.msg-card.alert-warning { border-color: #ffc107; }
@keyframes msg-look-pulse {
    0%, 100% { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .12); }
    50%      { box-shadow: 0 0 0 .65rem var(--msg-glow, rgba(220, 53, 69, .55)); }
}
.msg-look { animation: msg-look-pulse 1.2s ease-in-out 6; }
.msg-look.alert-warning { --msg-glow: rgba(255, 193, 7, .7); }
@media (prefers-reduced-motion: reduce) {
    .msg-look { animation: none; }
}

/* The three kinds of test (Pete, 2026-11-08; templates/_test_kind.html):
   Official green (Bootstrap's text-bg-success), Diagnostic this blue, Practice
   gray (text-bg-secondary). White on #0b5ed7 reads at 5.8 to 1. Its own class,
   not text-bg-primary, so an organization's branding colors never change it. */
.text-bg-diagnostic { color: #fff !important; background-color: #0b5ed7 !important; }

/* The Test History on a narrow screen (Pete, 2026-11-09, Help rebuild item 3;
   his check 5.2: it ran off the right side as the window narrowed). One table,
   class history-stack, on the Progress Report page and the student's page; the
   PDF has its own table and does not load this file.
     * A laptop (1200 px and wider): the table as before.
     * A tablet (768 to 1199 px): the same table, a little smaller and tighter;
       long test names wrap, and below 992 px the buttons too. If it still cannot
       fit, it scrolls sideways inside its own box (Bootstrap's table-responsive),
       never the page.
     * A phone (below 768 px): each test is a small card: its date and kind of
       test, the test, the score (each section's score small under it), Since
       last, Since first, and the report button. The column headings are hidden,
       so each figure says what it is. CSS only: no script. */
@media (min-width: 992px) {
    .history-stack .history-actions { white-space: nowrap; }   /* the buttons on one line */
}
@media (min-width: 768px) and (max-width: 1199.98px) {
    .history-stack { font-size: .8125rem; }
    /* headings in ordinary letters, narrower than capitals: the columns are as wide as their headings */
    .history-stack th { font-size: .75rem; text-transform: none; letter-spacing: 0; }
    .history-stack > :not(caption) > * > * { padding: .4rem .25rem; }
    /* the exam's badge, "ACT (Enhanced)", may take two lines; the kind-of-test tag stays whole */
    .history-stack .history-kind .badge:not(.test-kind-tag) { white-space: normal; }
}
@media (max-width: 767.98px) {
    .history-stack, .history-stack > tbody { display: block; }
    .history-stack > thead { display: none; }
    .history-stack > tbody > tr {
        display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .9rem;
        border: 1px solid var(--bs-border-color); border-radius: .5rem;
        padding: .6rem .75rem; margin-bottom: .6rem;
        background-color: var(--bs-table-bg, var(--bs-body-bg));
    }
    .history-stack > tbody > tr:last-child { margin-bottom: 0; }
    .history-stack > tbody > tr > td {
        display: block; border: 0; padding: 0; min-width: 0;
        background-color: transparent; box-shadow: none;
        text-align: left !important;
    }
    .history-stack .history-date { order: 1; }
    .history-stack .history-kind { order: 2; margin-left: auto; }
    .history-stack .history-test { order: 3; flex: 0 0 100%; font-weight: 600; }
    .history-stack .history-score { order: 4; flex: 0 0 100%; }
    .history-stack .history-section { order: 5; font-size: .8125rem; color: var(--bs-secondary-color); }
    .history-stack .history-section.no-score { display: none; }
    .history-stack > tbody > tr::after { content: ""; order: 6; flex: 0 0 100%; height: 0; }
    .history-stack .since-last { order: 7; }
    .history-stack .since-first { order: 8; }
    .history-stack .history-actions { order: 9; margin-left: auto; }
    .history-stack .history-score::before,
    .history-stack .history-section::before,
    .history-stack .since-last::before,
    .history-stack .since-first::before {
        font-size: .8125rem; font-weight: 400; color: var(--bs-secondary-color); margin-right: .3rem;
    }
    .history-stack .history-score::before { content: "Score"; }
    .history-stack .history-section::before { content: attr(data-line); margin-right: .2rem; }
    .history-stack .since-last::before { content: "Since last"; }
    .history-stack .since-first::before { content: "Since first"; }
    .history-box { padding: .6rem; }       /* the Progress Report's: inside a card */
}
