/* Student device-bound QR app — single stylesheet for the register and QR
   pages. Deliberately framework-free and small so the service worker can
   precache it for offline use. */

:root {
    /* Kept identical to the :root in css/style.css (the admin side) so the
       student app and the dashboard read as one product. */
    --myqr-blue: #0984e3;
    --myqr-blue-dark: #0770c4;
    --myqr-bg: #f6f7f9;
    --myqr-card: #ffffff;
    --myqr-surface-2: #f4f6f8;
    --myqr-text: #2d3436;
    --myqr-muted: #64748b;
    --myqr-border: #e5e8ee;
    --myqr-border-soft: #edf0f4;
    --myqr-tint: #e7f2fc;
    --myqr-danger: #d63031;
    --myqr-success: #00b894;
}

* { box-sizing: border-box; }

body.myqr-body {
    margin: 0;
    padding: 0;
    background: var(--myqr-bg);
    color: var(--myqr-text);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}

.myqr-shell {
    max-width: 520px;
    margin: 0 auto;
    padding: 18px 16px 40px;
}

.myqr-header h1 {
    font-size: 1.45rem;
    margin: 6px 0 2px;
}

.myqr-sub {
    margin: 0 0 8px;
    color: var(--myqr-muted);
    font-size: 0.92rem;
}

.myqr-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.myqr-badge {
    background: var(--myqr-tint);
    color: #0a4d7a;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

.myqr-badge-ok { background: #d6f7ec; color: #04634c; }
.myqr-badge-warn { background: #ffe7d6; color: #a8500a; }

.myqr-card {
    background: var(--myqr-card);
    border: 1px solid var(--myqr-border-soft);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 14px;
}

.myqr-card h2 { margin: 0 0 8px; font-size: 1.1rem; }

.myqr-warn { border-left: 4px solid var(--myqr-danger); }

.myqr-ok { color: var(--myqr-success); }

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 12px 0 4px;
}

input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--myqr-border);
    border-radius: 10px;
    background: #fff;
    color: var(--myqr-text);
}

.myqr-btn {
    display: inline-block;
    width: 100%;
    margin-top: 14px;
    padding: 13px 16px;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}

.myqr-btn-primary { background: var(--myqr-blue); color: #fff; }
.myqr-btn-primary:active { background: var(--myqr-blue-dark); }

.myqr-btn-ghost {
    background: transparent;
    border: 1px solid var(--myqr-border);
    color: inherit;
}

.myqr-status { min-height: 1.2em; margin: 12px 0 0; font-size: 0.9rem; }
.myqr-status.is-error { color: var(--myqr-danger); }
.myqr-status.is-ok { color: var(--myqr-success); }

.myqr-note { color: var(--myqr-muted); font-size: 0.85rem; line-height: 1.45; }
.myqr-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.35;
}

.myqr-check input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--myqr-blue);
}

.myqr-diag {
    display: grid;
    grid-template-columns: minmax(120px, 42%) 1fr;
    gap: 4px 12px;
    margin: 12px 0 0;
    font-size: 0.82rem;
    word-break: break-word;
}

.myqr-diag dt { color: var(--myqr-muted); font-weight: 600; }.myqr-diag dd { margin: 0; }
.myqr-diag dd.is-error { color: var(--myqr-danger); font-weight: 700; }

details summary { cursor: pointer; }


.myqr-list { margin: 6px 0 0; padding-left: 18px; font-size: 0.9rem; line-height: 1.5; }
.myqr-list li { margin-bottom: 6px; }

.myqr-qr-card { text-align: center; }

.myqr-qr-wrap {
    position: relative;
    width: min(78vw, 320px);
    margin: 0 auto;
    aspect-ratio: 1 / 1;
}

.myqr-qr {
    position: absolute;
    inset: 10%;
    background: #fff;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.myqr-qr svg { width: 100%; height: auto; display: block; }

.myqr-ring {
    position: absolute;
    inset: 0;
    transform: rotate(-90deg);
    pointer-events: none;
}

.myqr-ring-track,
.myqr-ring-progress {
    fill: none;
    stroke-width: 4;
}

.myqr-ring-track { stroke: var(--myqr-border); }

.myqr-ring-progress {
    stroke: var(--myqr-success);
    stroke-linecap: round;
    stroke-dasharray: 289;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.25s linear, stroke 0.25s linear;
}

.myqr-refresh { margin: 10px 0 0; font-weight: 700; }

.myqr-footer { text-align: center; margin-top: 18px; font-size: 0.85rem; }
.myqr-footer a { color: var(--myqr-blue); }


/* ---------------- FOOTER CREDIT (student app) ---------------- */
/* Footer credit line; the version pill borrows currentColor so it inherits
   whichever palette the page uses. */
.myqr-credit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 8px 0 0;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--myqr-muted);
}

.myqr-credit .footer-version {
    padding: 0 8px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    opacity: 0.9;
}

.myqr-credit .footer-version:hover { opacity: 1; }

.myqr-credit .footer-dot { opacity: 0.5; }


/* ---------------- INSTALL GUIDE (register page) ---------------- */
.myqr-install-steps {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.myqr-install-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--myqr-border-soft);
    border-radius: 14px;
    background: var(--myqr-card);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Circular number badge in the app accent colour. */
.myqr-step-num {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--myqr-blue);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 30px;
    text-align: center;
}

.myqr-step-body {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
}

.myqr-share-icon { display: inline-flex; color: var(--myqr-blue); }
.myqr-share-icon[hidden] { display: none; }

/* Current step (1-2) is highlighted; 3-4 are queued. */
.myqr-install-step.is-current {
    border-color: var(--myqr-blue);
    background: var(--myqr-tint);
}

.myqr-install-step.is-next .myqr-step-num {
    background: var(--myqr-surface-2);
    color: var(--myqr-muted);
}

/* Installed: steps 1-3 shrink to green checks, step 4 stays actionable. */
.myqr-install-guide.is-installed .myqr-install-step[data-step="1"],
.myqr-install-guide.is-installed .myqr-install-step[data-step="2"],
.myqr-install-guide.is-installed .myqr-install-step[data-step="3"] {
    padding: 6px 10px;
    border-color: transparent;
    background: transparent;
    font-size: 0.8rem;
    color: var(--myqr-muted);
}

.myqr-install-guide.is-installed .myqr-install-step.is-done .myqr-step-num {
    background: var(--myqr-success);
    color: #fff;
}

.myqr-install-guide[hidden] { display: none; }

/* Compact secondary action (install / copy link). */
.myqr-btn-compact {
    display: inline-block;
    width: auto;
    margin-top: 10px;
    padding: 10px 18px;
    font-size: 0.92rem;
}


/* ---------------- GUIDED REGISTRATION WIZARD ---------------- */
/* One centered card, one primary action per screen. The step sections are
   plain cards so the existing palette and spacing are retained. */
#wizard { display: block; }
#wizard[hidden] { display: none; }

.wizard-step[hidden] { display: none; }

.wizard-card {
    padding: 20px 18px 22px;
    margin-bottom: 14px;
}

.wizard-kicker {
    margin: 0 0 4px;
    color: var(--myqr-blue);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Progress: a single filled bar plus three step dots. */
.wizard-progress {
    margin: 0 2px 12px;
}

.wizard-progress-track {
    position: relative;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--myqr-border-soft);
}

.wizard-progress-fill {
    display: block;
    width: 34%;
    height: 100%;
    border-radius: inherit;
    background: var(--myqr-blue);
    transition: width 0.25s ease;
}

.wizard-progress-dots {
    display: flex;
    justify-content: space-between;
    margin-top: -14px;
    padding: 0 1px;
    pointer-events: none;
}

.wizard-progress-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 2px solid var(--myqr-card);
    border-radius: 50%;
    background: var(--myqr-border-soft);
    color: var(--myqr-muted);
    font-size: 0.7rem;
    font-weight: 800;
}

.wizard-progress-dot.is-done,
.wizard-progress-dot.is-current {
    background: var(--myqr-blue);
    color: #fff;
}

.wizard-progress-dot.is-skipped {
    background: var(--myqr-card);
    color: var(--myqr-muted);
    border-color: var(--myqr-border);
}

.wizard-progress-label {
    margin: 8px 0 0;
    color: var(--myqr-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
}

/* Large, thumb-friendly controls. 16px avoids iOS zoom on focus. */
.wizard-card input:not([type="checkbox"]),
.wizard-card .myqr-btn {
    min-height: 52px;
}

.wizard-card input:not([type="checkbox"]) {
    font-size: 16px;
}

.wizard-card .myqr-btn {
    margin-top: 16px;
    padding: 15px 18px;
}

.wizard-card .myqr-btn-ghost {
    margin-top: 8px;
}

.wizard-optional {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid var(--myqr-border-soft);
    border-radius: 12px;
    background: var(--myqr-surface-2);
}

.wizard-optional summary {
    color: var(--myqr-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.wizard-optional label:first-of-type { margin-top: 10px; }

/* iPhone Share illustration: local inline SVG, no remote assets. */
.wizard-illustration {
    display: flex;
    justify-content: center;
    margin: 8px 0 14px;
}

.wizard-illustration svg {
    width: min(64vw, 220px);
    height: auto;
}

.wizard-install-copy {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
}

.wizard-success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 12px;
    border-radius: 50%;
    background: #d6f7ec;
    color: #04634c;
}

/* Help link: short, bottom-of-page, opens the modal. */
.myqr-help-link {
    padding: 10px 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--myqr-blue);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.wizard-dialog {
    width: min(92vw, 480px);
    max-height: 86vh;
    padding: 18px;
    border: 1px solid var(--myqr-border);
    border-radius: 18px;
    background: var(--myqr-card);
    color: var(--myqr-text);
    box-shadow: 0 24px 60px rgba(18, 31, 53, 0.24);
}

.wizard-dialog::backdrop {
    background: rgba(18, 31, 53, 0.48);
}

.wizard-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wizard-dialog-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.wizard-dialog-close {
    width: 40px;
    height: 40px;
    border: 1px solid var(--myqr-border);
    border-radius: 50%;
    background: var(--myqr-surface-2);
    color: var(--myqr-text);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.wizard-help-list {
    margin-top: 14px;
    font-size: 0.95rem;
}

.wizard-diag {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--myqr-border-soft);
}

.wizard-diag summary {
    font-weight: 700;
}

.wizard-dialog .myqr-diag {
    margin-bottom: 8px;
}

