/* ==========================================================================
   ExamPortal — authentication screens
   Visual language borrowed from the exam hall itself: the question palette,
   its status colours, and the flat ink of a printed question booklet.
   ========================================================================== */

:root {
    --ink:          #0E1626;
    --ink-soft:     #162034;
    --paper:        #FFFFFF;
    --paper-sunk:   #F3F5FB;
    --line:         #DFE4F0;

    --text:         #162034;
    --text-muted:   #66708A;
    --text-invert:  #EEF1F9;

    --indigo:       #2F49D1;
    --indigo-deep:  #22349B;
    --indigo-wash:  #E9EDFF;

    /* Straight from the CBT palette a candidate sees during an attempt */
    --answered:     #12A150;
    --review:       #F5A524;
    --danger:       #D0342C;
    --unseen:       #C4CBDD;

    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 1px 2px rgba(14, 22, 38, .06), 0 12px 32px -12px rgba(14, 22, 38, .18);

    --font-display: "Sora", "IBM Plex Sans", system-ui, sans-serif;
    --font-body:    "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

[data-theme="dark"] {
    --paper:      #111A2B;
    --paper-sunk: #0B1220;
    --line:       #26324B;
    --text:       #E5EAF6;
    --text-muted: #939DB8;
    --indigo:     #7A8CFF;
    --indigo-deep:#5C6FEA;
    --indigo-wash:#1B2540;
    --unseen:     #3A4763;
    --shadow:     0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -16px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

body.auth-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--paper-sunk);
    -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ shell */

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---------------------------------------------------------- stage (left) */

.auth-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 44px 52px;
    background: var(--ink);
    color: var(--text-invert);
    overflow: hidden;
}

.auth-stage::after {
    /* faint booklet ruling, not a gradient wash */
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px);
    background-size: 100% 30px;
    pointer-events: none;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -.02em;
    color: #fff;
    text-decoration: none;
    position: relative;
    z-index: 1;
}

.wordmark-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--indigo);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.stage-copy { position: relative; z-index: 1; max-width: 30ch; }

.stage-copy h1 {
    font-family: var(--font-display);
    font-size: clamp(28px, 3vw, 38px);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.025em;
    margin: 0 0 12px;
}

.stage-copy p {
    margin: 0;
    color: #A9B4CE;
    font-size: 15px;
}

/* --------------------------------------------- signature: question palette */

.palette-block { position: relative; z-index: 1; }

.palette-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #7C89A6;
    margin-bottom: 12px;
}

.palette {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 34px));
    gap: 6px;
    margin-bottom: 20px;
}

.palette span {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: #0E1626;
    background: var(--unseen);
    opacity: 0;
    animation: palette-in .32s ease-out forwards;
}

.palette .is-answered { background: var(--answered); color: #fff; }
.palette .is-review   { background: var(--review);   color: #3D2A00; }
.palette .is-unseen   { background: rgba(255, 255, 255, .09); color: #7C89A6; }
.palette .is-current  {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 0 0 2px var(--indigo);
}

@keyframes palette-in {
    from { opacity: 0; transform: translateY(4px) scale(.94); }
    to   { opacity: 1; transform: none; }
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 12.5px;
    color: #A9B4CE;
}

.legend span { display: inline-flex; align-items: center; gap: 7px; }

.legend i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--unseen);
}

.legend .k-answered { background: var(--answered); }
.legend .k-review   { background: var(--review); }
.legend .k-unseen   { background: rgba(255, 255, 255, .18); }

/* ------------------------------------------------------------ form (right) */

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--paper-sunk);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 34px 34px 30px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card h2 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -.02em;
    margin: 0 0 4px;
}

.auth-card .sub {
    margin: 0 0 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.field { margin-bottom: 16px; }

.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.field .hint {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.input {
    width: 100%;
    padding: 11px 13px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}

.input::placeholder { color: var(--text-muted); opacity: .75; }

.input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px var(--indigo-wash);
}

.input[aria-invalid="true"] { border-color: var(--danger); }

.field-error {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--danger);
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    background: var(--indigo);
    border: 1px solid var(--indigo);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s, transform .05s;
}

.btn:hover { background: var(--indigo-deep); border-color: var(--indigo-deep); }
.btn:active { transform: translateY(1px); }

.btn:focus-visible,
.input:focus-visible,
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--indigo);
    outline-offset: 2px;
}

.btn-quiet {
    color: var(--text);
    background: transparent;
    border-color: var(--line);
}

.btn-quiet:hover { background: var(--paper-sunk); border-color: var(--line); }

.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -4px 0 18px;
    font-size: 13.5px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    cursor: pointer;
}

a.link { color: var(--indigo); text-decoration: none; font-weight: 500; }
a.link:hover { text-decoration: underline; }

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.foot {
    margin: 22px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

/* ---------------------------------------------------------------- alerts */

.alert {
    display: flex;
    gap: 10px;
    padding: 11px 13px;
    margin-bottom: 18px;
    font-size: 14px;
    border: 1px solid;
    border-radius: var(--radius-sm);
}

.alert-error {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.alert-success {
    color: var(--answered);
    background: color-mix(in srgb, var(--answered) 8%, transparent);
    border-color: color-mix(in srgb, var(--answered) 30%, transparent);
}

/* ------------------------------------------------------------- OTP inputs */

.otp-inputs {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 6px;
}

.otp-inputs input {
    width: 100%;
    padding: 13px 0;
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 500;
    text-align: center;
    color: var(--text);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}

.otp-inputs input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px var(--indigo-wash);
}

.otp-inputs input.filled { border-color: var(--indigo); }

/* ----------------------------------------------------------- theme toggle */

.theme-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 20;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    font-size: 15px;
    color: var(--text-muted);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
}

.theme-toggle:hover { color: var(--text); }

/* ----------------------------------------------------------- responsive */

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }

    .auth-stage {
        padding: 22px 22px 26px;
        gap: 22px;
    }

    .stage-copy h1 { font-size: 24px; }
    .stage-copy p, .legend { display: none; }
    .palette { grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 5px; }
    .palette span:nth-child(n + 29) { display: none; }
    .palette-label { margin-bottom: 8px; }
    .auth-panel { padding: 26px 16px 40px; }
    .auth-card { border: none; box-shadow: none; background: transparent; padding: 8px 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .palette span { animation: none; opacity: 1; }
    * { transition: none !important; }
}
