/* styles for the static sign-in pages. Put in wwwroot/auth.css. Light and dark follow the system setting. */
:root {
    color-scheme: light dark;   /* native checkboxes, scrollbars and autofill follow the system theme */
    --a-bg: #f3f5f9;
    --a-card: #fff;
    --a-text: #1f2430;
    --a-sub: #5b6475;
    --a-line: #d5dae3;
    --a-accent: #1565c0;
    --a-accent-text: #fff;
    --a-err-bg: #fdecea;
    --a-err: #8a1c14;
    --a-info-bg: #e8f1fb;
    --a-info: #0d3b72;
}

/* The sign-in pages follow the same light/dark choice as the public site (landing.js sets data-mk-theme from the saved choice,
   else the system setting). Without scripts the system setting still applies. */
@media (prefers-color-scheme: dark) {
    :root:not([data-mk-theme="light"]) {
        --a-bg: #12151c;
        --a-card: #1b202b;
        --a-text: #e8ebf1;
        --a-sub: #a3acbd;
        --a-line: #363e50;
        --a-accent: #4c9aff;
        --a-accent-text: #0b1220;
        --a-err-bg: #3a1a18;
        --a-err: #ffb4ab;
        --a-info-bg: #14304f;
        --a-info: #b6d6ff;
    }
}

:root[data-mk-theme="dark"] {
    color-scheme: dark;
    --a-bg: #12151c;
    --a-card: #1b202b;
    --a-text: #e8ebf1;
    --a-sub: #a3acbd;
    --a-line: #363e50;
    --a-accent: #4c9aff;
    --a-accent-text: #0b1220;
    --a-err-bg: #3a1a18;
    --a-err: #ffb4ab;
    --a-info-bg: #14304f;
    --a-info: #b6d6ff;
}

:root[data-mk-theme="light"] { color-scheme: light; }

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--a-bg);
    color: var(--a-text);
    font-family: system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: var(--a-card);
    border: 1px solid var(--a-line);
    border-radius: 14px;
    padding: 28px 28px 24px;
    box-shadow: 0 2px 14px rgba(0,0,0,.06);
}

.auth-brand {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: .2px;
    margin-bottom: 14px;
}

    .auth-brand span {
        color: var(--a-accent);
    }

.auth-title {
    font-size: 1.35rem;
    margin: 0 0 6px;
}

.auth-section {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--a-sub);
    margin: 20px 0 4px;
}

.auth-sub {
    color: var(--a-sub);
    margin: 0 0 16px;
    line-height: 1.45;
}

.auth-hint {
    color: var(--a-sub);
    font-size: .85rem;
    margin: 6px 0 12px;
    line-height: 1.4;
}

.auth-label {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    margin: 12px 0 4px;
}

.auth-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 1rem;
    color: var(--a-text);
    background: transparent;
    border: 1px solid var(--a-line);
    border-radius: 8px;
}

    .auth-input:focus {
        outline: 2px solid var(--a-accent);
        outline-offset: 1px;
        border-color: transparent;
    }

.auth-code {
    letter-spacing: .25em;
    text-align: center;
    font-size: 1.25rem;
}

.auth-check {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 12px 0 0;
    font-size: .92rem;
    line-height: 1.35;
}

.auth-choice {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid var(--a-line);
    border-radius: 8px;
    cursor: pointer;
}

.auth-button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 20px;
    padding: 12px 14px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: var(--a-accent-text);
    background: var(--a-accent);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

    .auth-button:hover {
        filter: brightness(1.07);
    }

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    font-size: .9rem;
}

    .auth-links a, .auth-sub a {
        color: var(--a-accent);
    }

.auth-alert {
    padding: 10px 12px;
    border-radius: 8px;
    margin: 0 0 14px;
    font-size: .92rem;
    line-height: 1.4;
}

    .auth-alert.error {
        background: var(--a-err-bg);
        color: var(--a-err);
    }

    .auth-alert.info {
        background: var(--a-info-bg);
        color: var(--a-info);
    }

.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width:420px) {
    .auth-row {
        grid-template-columns: 1fr;
    }
}

.auth-steps {
    padding-left: 20px;
    color: var(--a-sub);
    font-size: .9rem;
    line-height: 1.5;
}

.auth-qr {
    display: block;
    margin: 10px auto;
    width: 200px;
    height: 200px;
    image-rendering: pixelated;
    background: #fff;
    padding: 8px;
    border-radius: 8px;
}

.auth-key {
    text-align: center;
    font-family: ui-monospace,Consolas,monospace;
    letter-spacing: .12em;
    word-break: break-all;
    margin: 4px 0 8px;
}

.auth-codes {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-family: ui-monospace,Consolas,monospace;
    font-size: 1.05rem;
}

    .auth-codes li {
        padding: 8px 10px;
        border: 1px dashed var(--a-line);
        border-radius: 6px;
        text-align: center;
    }

.auth-foot {
    color: var(--a-sub);
    font-size: .8rem;
    margin-top: 16px;
    text-align: center;
}

/* browser autofill paints its own pale background; keep the text readable in dark mode */
.auth-input:-webkit-autofill {
    -webkit-text-fill-color: var(--a-text);
    box-shadow: 0 0 0 1000px var(--a-card) inset;
}

.auth-button:focus-visible, .auth-links a:focus-visible, .auth-sub a:focus-visible {
    outline: 2px solid var(--a-accent);
    outline-offset: 2px;
}

.auth-button:disabled { opacity: .6; cursor: not-allowed; }

/* Drop-down lists: the open list is drawn by the browser, so give the list and its options the card colours.
   Otherwise the page's light text lands on the browser's white list in dark mode (and the reverse). */
select.auth-input { background-color: var(--a-card); cursor: pointer; }
.auth-input option, .auth-input optgroup { background-color: var(--a-card); color: var(--a-text); }

/* theme toggle in the card corner (the button itself is styled by .mk-theme in landing.css) */
.auth-theme { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; }

/* multi-step sign-up form: landing.js adds .reg-js, so without scripts every step shows and the form still works */
.reg-progress { margin: 4px 0 6px; }
.reg-count { font-size: .85rem; color: var(--a-sub); margin-bottom: 6px; }
.reg-count b { color: var(--a-text); }
.reg-bar { height: 6px; border-radius: 3px; background: var(--a-line); overflow: hidden; }
.reg-bar i { display: block; height: 100%; width: 100%; background: var(--a-accent); border-radius: 3px; transition: width .2s ease; }
.reg-js .reg-step { display: none; }
.reg-js .reg-step.active { display: block; }
.reg-nav { display: flex; gap: 12px; }
.reg-nav .auth-button { flex: 1; }
.reg-nav .auth-button[hidden] { display: none; }
.auth-button.secondary { color: var(--a-text); background: transparent; border: 1px solid var(--a-line); }
.auth-button.secondary:hover { border-color: var(--a-accent); filter: none; }

/* sign-up: the "kind of books" choice. One card per option; the card of the ticked radio is highlighted. */
.reg-choice { display: flex; gap: 12px; align-items: flex-start; margin: 10px 0 0; padding: 12px 14px; border: 1px solid var(--a-line); border-radius: 10px; cursor: pointer; }
.reg-choice:hover { border-color: var(--a-accent); }
.reg-choice:has(input:checked) { border-color: var(--a-accent); box-shadow: 0 0 0 1px var(--a-accent) inset; }
.reg-choice input { margin-top: 4px; flex: none; }
.reg-choice span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reg-choice small { color: var(--a-muted, inherit); opacity: .8; font-size: .85rem; line-height: 1.35; }
.reg-choice.off { opacity: .55; cursor: not-allowed; }
.reg-soon { margin-left: 8px; font-style: normal; font-size: .72rem; padding: 1px 7px; border: 1px solid var(--a-line); border-radius: 999px; }
