@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* AntHill Student Portal - matches the standard /portal/ design system:
   Plus Jakarta Sans, blue->teal gradient hero, 22px floating card, gradient
   buttons, 1.5px/9px inputs with focus ring. */

:root {
    --blue: #1565C0; --blue2: #1976D2; --blued: #0C447C; --teal: #14a8b8;
    --ink: #0f172a; --ink2: #374151; --muted: #64748b; --muted2: #94a3b8;
    --line: #e2e8f0; --fill: #f8fafc; --lite: #EBF2FD; --ph: #cbd5e1;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    background: #eef2f7; color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* ---- gradient hero (login / set-pin) ---- */
body.hero {
    min-height: 100vh;
    background: linear-gradient(135deg, #0d47a1 0%, #1565C0 30%, #1976D2 55%, #0288d1 78%, #006064 100%);
    background-size: 400% 400%;
    animation: heroShift 18s ease infinite;
}
@keyframes heroShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
body.hero::before {
    content: ''; position: fixed; inset: 0; pointer-events: none;
    background-image: radial-gradient(circle, rgba(255,255,255,.10) 1px, transparent 1px);
    background-size: 30px 30px;
}

.p-wrap { max-width: 430px; margin: 0 auto; padding: 44px 18px 26px; position: relative; z-index: 1; }

/* ---- card ---- */
.p-card {
    position: relative; background: #fff; border-radius: 22px; overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 8px 32px rgba(0,0,0,.2), 0 32px 64px rgba(0,0,0,.15);
    padding: 30px 26px 26px;
}
.p-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px;
    background: linear-gradient(90deg, #1565C0 0%, #14a8b8 100%);
}
/* flatter cards on the light dashboard */
body:not(.hero) .p-card { box-shadow: 0 6px 18px rgba(21,101,192,.06); border: 1px solid var(--line); }
body:not(.hero) .p-card::before { display: none; }

.p-appicon {
    width: 60px; height: 60px; margin: 2px auto 16px;
    background: linear-gradient(135deg, #1565C0, #1976D2); border-radius: 17px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(21,101,192,.4);
}
.p-appicon svg { width: 30px; height: 30px; color: #fff; }

.p-title { text-align: center; font-size: 23px; font-weight: 800; color: var(--ink); margin: 0 0 4px; letter-spacing: -.01em; }
.p-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 22px; line-height: 1.5; }

.p-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink2); margin: 15px 0 6px; }

/* ---- inputs (with inline icon) ---- */
.p-inp { position: relative; }
.p-inp .p-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted2); pointer-events: none; }
.p-field {
    width: 100%; border: 1.5px solid var(--line); background: #fff; color: var(--ink);
    border-radius: 9px; padding: 12px 14px 12px 42px; font-size: 16px; font-family: inherit;
    outline: none; transition: border-color .2s, box-shadow .2s;
}
.p-field::placeholder { color: var(--ph); }
.p-field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,101,192,.09); }

/* ---- buttons ---- */
.p-btn {
    width: 100%; margin-top: 22px; border: none; cursor: pointer;
    background: linear-gradient(135deg, #1565C0, #1976D2); color: #fff;
    font-size: 16px; font-weight: 700; font-family: inherit;
    border-radius: 9px; padding: 14px 16px;
    box-shadow: 0 3px 10px rgba(21,101,192,.3);
    transition: background .2s, box-shadow .2s, transform .05s;
}
.p-btn:hover { background: linear-gradient(135deg, #0C447C, #1565C0); box-shadow: 0 5px 18px rgba(21,101,192,.4); }
.p-btn:active { transform: translateY(1px); }

.p-error { margin-top: 14px; background: #fdecea; border: 1px solid #f5c6c2; color: #b3261e; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.p-note { margin-top: 12px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.p-note.flush { margin: 0; }

.p-footer { text-align: center; color: rgba(255,255,255,.85); font-size: 12.5px; margin-top: 18px; line-height: 1.5; }
body:not(.hero) .p-footer { color: var(--muted2); }
.p-link { color: var(--blue); text-decoration: none; font-weight: 700; }
.p-link:hover { text-decoration: underline; }

/* ---- dashboard header (full-width bar, like the parent portal) ---- */
.p-top {
    background: linear-gradient(135deg, #1565C0, #1976D2); color: #fff;
    padding: 14px 20px; box-shadow: 0 2px 10px rgba(21,101,192,.25);
}
.p-top-in { max-width: 1140px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.p-top .brand { font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 9px; color: #fff; }
.p-top .brand svg { width: 22px; height: 22px; color: #fff; }
.p-badge { background: rgba(255,255,255,.18); color: #fff; font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.p-user { display: flex; align-items: center; gap: 14px; }
.p-user .nm { color: #fff; font-weight: 600; font-size: 14px; }
.p-top .out { color: #fff; text-decoration: none; font-size: 13px; font-weight: 600; background: rgba(255,255,255,.15); padding: 7px 14px; border-radius: 8px; }
.p-top .out:hover { background: rgba(255,255,255,.28); }

/* ---- wide authenticated content ---- */
.p-wide { max-width: 1140px; margin: 0 auto; padding: 26px 20px 44px; }

.p-hero-card {
    background: linear-gradient(120deg, #0d47a1, #1565C0 55%, #1976D2);
    border-radius: 22px; padding: 26px 28px; color: #fff;
    box-shadow: 0 12px 30px rgba(21,101,192,.28);
    display: flex; align-items: center; gap: 20px;
}
.p-hero-av { width: 74px; height: 74px; border-radius: 18px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; flex-shrink: 0; }
.p-hero-name { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.p-hero-sub { opacity: .92; font-size: 14.5px; margin-top: 4px; }

.p-section-title { font-size: 18px; font-weight: 800; color: var(--ink); margin: 28px 0 14px; }

/* ---- exam cards (grid on desktop) ---- */
.e-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }

@media (max-width: 640px) {
    .p-hero-card { padding: 20px; gap: 14px; }
    .p-hero-av { width: 56px; height: 56px; font-size: 20px; }
    .p-hero-name { font-size: 20px; }
    .p-wide { padding: 16px 16px 32px; }
}

/* ==== take exam =========================================================
   Moved here verbatim from the old inline <style> block in pages/TAKE.aspx.
   EVERYTHING is scoped under body.exam on purpose: the exam taker uses short,
   generic class names (.card .btn .field .h1 .muted) that would otherwise
   collide with the dashboard/login pages sharing this same stylesheet.
   The variables below are re-declared on body.exam so they override the :root
   palette for the exam subtree ONLY -- this reproduces exactly what the old
   inline block did, so the exam page looks pixel-identical to before.
   ======================================================================== */
body.exam {
    --acc: #1565C0; --acc-d: #0f4f9e; --soft: #EBF2FD; --bg: #eef2f7;
    --card: #ffffff; --ink: #0f2f4f; --muted: #64748b; --line: #e2e8f0; --ok: #1a8f4a;
    background: var(--bg); color: var(--ink);
}
body.exam * { -webkit-tap-highlight-color: transparent; }

body.exam .wrap { max-width: 600px; margin: 0 auto; padding: 18px 16px 44px; }
body.exam .brand { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: #94a3b8; font-weight: 700; }
body.exam .card { background: var(--card); border-radius: 18px; padding: 22px; box-shadow: 0 10px 30px rgba(21,101,192,.08); border: 1px solid var(--line); }
body.exam .h1 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; margin: 6px 0 2px; }
body.exam .muted { color: var(--muted); font-size: 13px; line-height: 1.55; }
body.exam .chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
body.exam .chip { font-size: 12px; background: #f7f9fc; border: 1px solid var(--line); color: #5a6273; border-radius: 999px; padding: 5px 12px; }
body.exam .btn { display: block; width: 100%; border: none; cursor: pointer; text-align: center; background: linear-gradient(135deg,#1565C0,#1976D2); color: #fff; border-radius: 12px; padding: 15px; font-size: 15px; font-weight: 700; box-shadow: 0 8px 20px rgba(21,101,192,.30); transition: transform .06s ease, box-shadow .15s ease; font-family: inherit; }
body.exam .btn:active { transform: scale(.985); }
body.exam .btn.ghost { background: #fff; color: var(--acc); border: 1.5px solid #cfe0f5; box-shadow: none; }
body.exam .field { width: 100%; font-size: 15px; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; font-family: inherit; background: #fff; }
body.exam .field:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 4px var(--soft); }
body.exam .avatar { width: 58px; height: 58px; border-radius: 50%; background: var(--soft); color: var(--acc); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 19px; }
body.exam .topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
body.exam .prog { font-size: 13px; font-weight: 700; color: #5a6273; }
body.exam .tmr { font-size: 13px; font-weight: 800; color: var(--acc); background: var(--soft); border-radius: 999px; padding: 5px 12px; }
body.exam .tmr.low { color: #c0392b; background: #fdecea; }
body.exam .bar { height: 6px; border-radius: 999px; background: #e8edf5; overflow: hidden; margin-bottom: 16px; }
body.exam .bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg,#1565C0,#14a8b8); border-radius: 999px; transition: width .25s ease; }
body.exam .qnum { font-size: 12px; color: #94a3b8; font-weight: 700; }
body.exam .q { font-size: 17px; font-weight: 600; line-height: 1.45; margin: 4px 0 14px; }
body.exam .q-img { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); margin: 2px 0 14px; display: block; }
body.exam .opt { display: flex; align-items: center; gap: 12px; border: 1.5px solid #e9eef5; border-radius: 12px; padding: 14px; margin-bottom: 9px; font-size: 15px; color: #3a4150; cursor: pointer; transition: border-color .12s ease, background .12s ease; }
body.exam .opt.sel { border-color: var(--acc); background: var(--soft); color: #0C447C; font-weight: 600; }
body.exam .opt input { position: absolute; opacity: 0; width: 0; height: 0; }
body.exam .tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cfd7e6; flex: none; transition: all .12s ease; }
body.exam .opt.sel .tick { border-color: var(--acc); background: var(--acc); box-shadow: inset 0 0 0 3px var(--soft); }
body.exam .opt-img { max-height: 90px; border-radius: 8px; border: 1px solid var(--line); margin-left: auto; }
body.exam .num { width: 100%; }
body.exam .save { font-size: 12px; color: var(--ok); text-align: center; margin: 6px 0 2px; min-height: 18px; font-weight: 600; }
body.exam .nav { display: flex; gap: 10px; margin-top: 14px; }
body.exam .rev { padding: 12px 14px; border: 1px solid #e9eef5; border-radius: 11px; margin-bottom: 7px; font-size: 14px; cursor: pointer; background: #fff; }
body.exam .rev.un { border-color: #f2c2c2; color: #b42318; background: #fff6f6; }
body.exam .center { text-align: center; }
body.exam .done-ic { width: 70px; height: 70px; border-radius: 50%; background: #e7f8f0; color: var(--ok); display: flex; align-items: center; justify-content: center; font-size: 36px; margin: 6px auto 16px; }
body.exam .foot { text-align: center; margin-top: 20px; }
body.exam .foot a { color: var(--acc); text-decoration: none; font-weight: 700; }
body.exam .msg-ic { width: 60px; height: 60px; border-radius: 50%; background: var(--soft); color: var(--acc); display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 800; margin: 0 auto 14px; }

/* replaces the inline style="..." attributes the code-behind used to emit */
body.exam .card.solo { margin-top: 12px; }
body.exam .center .avatar { margin: 0 auto; }
body.exam .h1.tight { margin-top: 12px; }
body.exam .h1.head { margin: 4px 0 12px; }
body.exam .h1.sm { font-size: 18px; }
body.exam .exam-name { font-weight: 600; margin-top: 14px; font-size: 16px; }
body.exam .chips.mid { justify-content: center; }
body.exam .btn.go { margin-top: 18px; }
body.exam #btnPrev { flex: 1; }
body.exam #btnNext { flex: 2; }
body.exam #revlist { margin: 12px 0; }
body.exam .ecount { text-align: right; font-size: 12px; color: #8a92a6; margin-top: 6px; }

.e-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 18px rgba(21,101,192,.06); padding: 16px 18px; margin-bottom: 14px; }
.e-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.e-subj { font-weight: 800; color: var(--ink); font-size: 15px; }
.e-title { color: var(--ink2); font-size: 14px; margin-top: 3px; font-weight: 500; }
.e-meta { color: var(--muted2); font-size: 12.5px; margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.e-meta svg { width: 14px; height: 14px; flex-shrink: 0; }
.e-pill { font-size: 11.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.e-pill-open { background: #e6f0fb; color: #1565C0; }
.e-pill-submitted { background: #e7f8f0; color: #1a8f4a; }
.e-pill-notyet { background: #fef3e2; color: #b7791f; }
.e-pill-closed { background: #f1f5f9; color: #64748b; }
.e-start { display: inline-flex; align-items: center; gap: 6px; margin-top: 13px; background: linear-gradient(135deg, #1565C0, #1976D2); color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; padding: 11px 17px; border-radius: 10px; box-shadow: 0 3px 10px rgba(21,101,192,.28); }
.e-start:hover { background: linear-gradient(135deg, #0C447C, #1565C0); }

/* ---- subject tiles (dashboard) ----
   Whole tile is an <a>: a big tap target reads better for young students on a
   phone than a small button tucked in a corner. */
.s-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.s-card {
    display: flex; align-items: center; gap: 12px; text-decoration: none;
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 6px 18px rgba(21,101,192,.06); padding: 18px;
    transition: border-color .15s, box-shadow .15s, transform .06s;
}
.s-card:hover { border-color: #bcd3ef; box-shadow: 0 10px 24px rgba(21,101,192,.12); }
.s-card:active { transform: translateY(1px); }
.s-main { min-width: 0; flex: 1; }
.s-name { font-weight: 800; color: var(--ink); font-size: 16px; line-height: 1.3; }
.s-code { color: var(--muted2); font-size: 12px; font-weight: 600; margin-top: 2px; letter-spacing: .02em; }
.s-stat { display: inline-block; margin-top: 10px; font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px; }
.s-stat-pending { background: #fef3e2; color: #b7791f; }
.s-stat-done { background: #e7f8f0; color: #1a8f4a; }
.s-stat-none { background: #f1f5f9; color: #64748b; }
.s-go { width: 20px; height: 20px; color: var(--ph); flex-shrink: 0; }
.s-card:hover .s-go { color: var(--blue); }

/* "To answer now" -- the pinned block above the quarters. */
.g-now {
    font-size: 15px; font-weight: 800; color: var(--blued); margin: 8px 0 12px;
    display: flex; align-items: center; gap: 8px;
}
.g-now::before {
    content: ''; width: 8px; height: 8px; border-radius: 50%;
    background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.18); flex-shrink: 0;
}
/* an exam already started gets a little more weight than one not begun */
.e-card-now { border-color: #bcd3ef; box-shadow: 0 8px 22px rgba(21,101,192,.14); }

/* group headings on the per-subject page (quarter, then component) */
.g-quarter {
    font-size: 15px; font-weight: 800; color: var(--ink); margin: 24px 0 2px;
    padding-bottom: 8px; border-bottom: 2px solid var(--line);
}
.g-quarter:first-child { margin-top: 8px; }
.g-comp {
    font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase;
    letter-spacing: .05em; margin: 16px 0 10px;
}
.g-quarter + .g-comp { margin-top: 14px; }
.g-comp:first-child { margin-top: 8px; }

/* back link + heading on the per-subject page */
.s-back {
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px;
    color: var(--blue); text-decoration: none; font-size: 13.5px; font-weight: 700;
}
.s-back:hover { text-decoration: underline; }
.s-back svg { width: 16px; height: 16px; }
.p-section-title.s-head { margin-top: 12px; }

/* ---- error pages (400/401/403/404/500) ----
   Was an identical inline <style> block copy-pasted into all five pages. */
.err-card { text-align: center; }
.err-num {
    font-size: 64px; font-weight: 800; letter-spacing: -1px; line-height: 1; margin: 4px 0 6px;
    background: linear-gradient(135deg, #1565C0, #14a8b8);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.err-h { font-size: 20px; font-weight: 700; color: var(--ink); margin: 0 0 6px; }
.err-p { font-size: 14px; color: var(--muted); margin: 0 0 20px; line-height: 1.5; }

/* ==== toast notifications ================================================
   Drives process_alert_success / process_alert_warning (see js/portal.js and
   App_Code/foundation/method.cs). Visually and behaviourally matched to the
   staff app's toastr (toast-top-right, close button, progress bar, 5s timeout,
   fade in/out) but with NO jQuery + toastr dependency -- those weigh ~99KB and
   the portal is deliberately library-free so it stays quick on student phones.
   Colors are toastr's own defaults so staff and students see the same language.
   ======================================================================== */
#ah-toast {
    position: fixed; top: 12px; right: 12px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
    max-width: 340px; width: calc(100% - 24px); pointer-events: none;
}
.ah-toast {
    position: relative; overflow: hidden; pointer-events: auto;
    border-radius: 10px; padding: 14px 38px 14px 16px; color: #fff;
    font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.45;
    box-shadow: 0 8px 24px rgba(15,23,42,.22);
    opacity: 0; transform: translateY(-8px);
    transition: opacity .3s ease, transform .3s ease;
}
.ah-toast.on { opacity: 1; transform: translateY(0); }
.ah-toast.out { opacity: 0; transform: translateY(-8px); }
.ah-toast-success { background: #51A351; }
.ah-toast-warning { background: #F89406; }
.ah-toast-error { background: #BD362F; }
.ah-toast-info { background: #2F96B4; }
.ah-toast-x {
    position: absolute; top: 8px; right: 10px; cursor: pointer;
    background: none; border: none; padding: 0; line-height: 1;
    color: #fff; opacity: .75; font-size: 18px; font-weight: 700; font-family: inherit;
}
.ah-toast-x:hover { opacity: 1; }
.ah-toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: rgba(255,255,255,.4); }
.ah-toast-bar > i { display: block; height: 100%; width: 100%; background: rgba(255,255,255,.9); transform-origin: left center; }
@media (max-width: 640px) {
    #ah-toast { top: 8px; right: 8px; left: 8px; width: auto; max-width: none; }
}
