/* =====================================================================
   Seerlock sign-in pages: sign in, create account, codes and passwords.
   Colours come from the season (App.razor). The value after each comma
   is the Season 1 colour, used only if the season one is missing.
   ===================================================================== */

.sl-auth {
    --auth-bg: var(--sl-bg, #0E0B1A);
    --auth-surface: var(--sl-surface, #18122C);
    --auth-border: var(--sl-border, #2A2142);
    --auth-border-strong: color-mix(in srgb, var(--auth-border), var(--auth-text) 10%);
    --auth-text: var(--sl-text, #FFF4F8);
    --auth-muted: var(--sl-muted, #B9A9C9);
    --auth-g1: var(--sl-grad-1, #FFB347);
    --auth-g2: var(--sl-grad-2, #FF4FA3);
    --auth-g3: var(--sl-grad-3, #8B5CF6);
    --auth-link: var(--auth-g2);
    --auth-teal: #34E0D1;
    --auth-warn: #FFB347;

    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    color: var(--auth-text);
    font-family: Inter, system-ui, sans-serif;
    /* A soft glow of the season colours at the top, fading into the night */
    background:
        radial-gradient(120% 55% at 50% -12%,
            color-mix(in srgb, var(--auth-g3) 42%, transparent) 0%,
            color-mix(in srgb, var(--auth-g2) 14%, transparent) 45%,
            transparent 70%),
        var(--auth-bg);
}

.sl-auth *,
.sl-auth *::before,
.sl-auth *::after {
    box-sizing: border-box;
}

/* ---------- Page frame ---------- */

.sl-auth-top {
    padding: 10px 12px 0;
}

.sl-auth-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    padding: 0 14px 0 6px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    color: var(--auth-muted);
}

.sl-auth-back:hover {
    color: var(--auth-text);
}

.sl-auth-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 4px 24px 40px;
}

.sl-auth-card {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

@media (min-width: 768px) {
    .sl-auth-top {
        padding: 20px 24px 0;
    }

    .sl-auth-center {
        align-items: center;
        padding: 24px 24px 64px;
    }
}

/* ---------- Logo ---------- */

.sl-auth-logo {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
    text-decoration: none;
}

.sl-auth-logo-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--auth-g1), var(--auth-g2) 55%, var(--auth-g3));
}

.sl-auth-logo-word {
    font-family: 'Space Grotesk', Inter, sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--auth-text);
}

.sl-auth-logo-word span {
    background: linear-gradient(90deg, var(--auth-g1), var(--auth-g2), var(--auth-g3));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- Heading ---------- */

.sl-auth-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
}

.sl-auth-head h1 {
    margin: 0;
    font-family: 'Space Grotesk', Inter, sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--auth-text);
}

.sl-auth-head p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--auth-muted);
}

.sl-auth-head strong {
    color: var(--auth-text);
}

/* The round gradient icon above a heading (email, tick) */
.sl-auth-icon {
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--auth-g1), var(--auth-g2) 55%, var(--auth-g3));
    color: var(--auth-bg);
}

.sl-auth-centered {
    text-align: center;
}

/* Hidden on screen but still read out by screen readers */
.sl-auth-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Form ---------- */

.sl-auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 0;
}

/* The passkey helper is invisible: don't let it take up a row in the form */
.sl-auth-form passkey-submit {
    display: contents;
}

.sl-auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sl-auth-field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sl-auth-field label {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--auth-muted);
}

.sl-auth-input {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    background: var(--auth-bg);
    color: var(--auth-text);
    font: inherit;
    font-size: 16px;
    line-height: 1.5;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sl-auth-input::placeholder {
    color: color-mix(in srgb, var(--auth-muted) 72%, var(--auth-bg));
}

.sl-auth-input:focus {
    outline: none;
    border-color: var(--auth-teal);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-teal) 25%, transparent);
}

/* Blazor adds valid / invalid classes: swap the default red and green outlines for calm ones */
.sl-auth .sl-auth-input.valid.modified,
.sl-auth .sl-auth-input.invalid {
    outline: none;
}

.sl-auth .sl-auth-input.invalid {
    border-color: var(--auth-warn);
}

.sl-auth .validation-message {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--auth-warn);
}

/* The small line under a field: turns teal (all good) or orange (fix this) while you type */
.sl-auth-hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--auth-muted);
}

.sl-auth-hint.is-ok {
    color: var(--auth-teal);
}

.sl-auth-hint.is-warn {
    color: var(--auth-warn);
}

/* When the server puts an error under a field, the grey hint steps aside so the message isn't said twice */
.sl-auth-field:has(.validation-message) .sl-auth-hint {
    display: none;
}

/* A tick box that still needs ticking gets a soft orange ring instead of the default red one */
.sl-auth .sl-auth-check input.invalid {
    outline: 2px solid var(--auth-warn);
    outline-offset: 1px;
}

/* Username box with the @ inside it */
.sl-auth-handle {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    background: var(--auth-bg);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sl-auth-handle > span {
    display: inline-flex;
    align-items: center;
    padding: 0 2px 0 14px;
    font-size: 16px;
    font-weight: 700;
    color: var(--auth-muted);
}

.sl-auth-handle .sl-auth-input {
    flex: 1;
    min-width: 0;
    padding-left: 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.sl-auth-handle .sl-auth-input:focus {
    box-shadow: none;
}

.sl-auth-handle:focus-within {
    border-color: var(--auth-teal);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-teal) 25%, transparent);
}

.sl-auth-handle:has(.invalid) {
    border-color: var(--auth-warn);
}

/* Password box with the eye button inside it */
.sl-auth-pw {
    position: relative;
}

.sl-auth-pw .sl-auth-input {
    padding-right: 52px;
}

.sl-auth-pw-toggle {
    position: absolute;
    top: 3px;
    right: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
}

.sl-auth-pw-toggle:hover {
    color: var(--auth-text);
}

.sl-auth-pw-toggle .sl-auth-eye-off,
.sl-auth-pw-toggle[aria-pressed="true"] .sl-auth-eye {
    display: none;
}

.sl-auth-pw-toggle[aria-pressed="true"] .sl-auth-eye-off {
    display: inline;
}

/* Tick box with a small hint under its label */
.sl-auth-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    cursor: pointer;
}

.sl-auth-check input[type="checkbox"] {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    accent-color: var(--auth-teal);
    cursor: pointer;
}

.sl-auth-check-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sl-auth-check-title {
    font-size: 15px;
    color: var(--auth-text);
}

.sl-auth-check-hint {
    font-size: 13px;
    line-height: 1.45;
    color: var(--auth-muted);
}

/* Links inside a tick box's text, like House rules */
.sl-auth-check a {
    font-weight: 600;
    color: var(--auth-text);
    text-decoration: underline;
}

/* ---------- Buttons ---------- */

.sl-auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    padding: 0 20px;
    border-radius: 14px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    /* Smooth movement for the hover lift and the press */
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.sl-auth-btn-primary {
    border: 0;
    background: linear-gradient(90deg, var(--auth-g1), var(--auth-g2), var(--auth-g3));
    color: var(--auth-bg);
}

.sl-auth-btn-outline {
    border: 1px solid var(--auth-border-strong);
    background: var(--auth-surface);
    color: var(--auth-text);
}

/* Hover: only on devices with a mouse, so phones don't get a "stuck" hover after a tap */
@media (hover: hover) and (pointer: fine) {
    /* The main button lifts a little, grows a touch and glows in the season colours */
    .sl-auth-btn-primary:hover {
        transform: translateY(-2px) scale(1.015);
        filter: brightness(1.05);
        box-shadow: 0 12px 28px -10px color-mix(in srgb, var(--auth-g2) 70%, transparent);
        color: var(--auth-bg);
    }

    /* The quieter button lifts and its border lights up in the season gradient */
    .sl-auth-btn-outline:hover {
        transform: translateY(-2px);
        border-color: transparent;
        background:
            linear-gradient(var(--auth-surface), var(--auth-surface)) padding-box,
            linear-gradient(90deg, var(--auth-g1), var(--auth-g2), var(--auth-g3)) border-box;
        box-shadow: 0 12px 26px -14px color-mix(in srgb, var(--auth-g3) 80%, transparent);
        color: var(--auth-text);
    }

    .sl-auth-input:hover:not(:focus) {
        border-color: var(--auth-border-strong);
    }

    .sl-auth-handle:hover:not(:focus-within) {
        border-color: var(--auth-border-strong);
    }
}

/* Press: every button sinks a little when clicked or tapped (this part works on phones too) */
.sl-auth-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: none;
    transition-duration: 0.06s;
}

/* People who switch off animations in their device settings get no movement */
@media (prefers-reduced-motion: reduce) {
    .sl-auth-btn,
    .sl-auth-input,
    .sl-auth-handle {
        transition: none;
    }

    .sl-auth-btn:hover,
    .sl-auth-btn:active {
        transform: none;
    }
}

.sl-auth a:focus-visible,
.sl-auth button:focus-visible,
.sl-auth-check input:focus-visible {
    outline: 2px solid var(--auth-teal);
    outline-offset: 2px;
}

/* "or use your email" with a line on each side */
.sl-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--auth-muted);
}

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

/* ---------- Messages and links ---------- */

.sl-auth-alert {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--auth-warn) 40%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--auth-warn) 10%, transparent);
    font-size: 14px;
    line-height: 1.5;
    color: var(--auth-text);
    text-align: left;
}

.sl-auth-alert svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--auth-warn);
}

.sl-auth-alert a {
    margin-left: 4px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--auth-text);
}

.sl-auth-alert.is-ok {
    border-color: color-mix(in srgb, var(--auth-teal) 40%, transparent);
    background: color-mix(in srgb, var(--auth-teal) 10%, transparent);
}

.sl-auth-alert.is-ok svg {
    color: var(--auth-teal);
}

.sl-auth-link {
    padding: 4px 0;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: var(--auth-link);
}

.sl-auth-link:hover {
    color: var(--auth-link);
    text-decoration: underline;
}

button.sl-auth-link,
.sl-auth-switch button {
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

button.sl-auth-link {
    min-height: 44px;
    font-size: 14px;
    font-weight: 600;
    color: var(--auth-link);
}

.sl-auth-switch {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 15px;
    color: var(--auth-muted);
}

.sl-auth-switch a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-weight: 700;
    text-decoration: none;
    color: var(--auth-link);
}

.sl-auth-switch a:hover {
    color: var(--auth-link);
    text-decoration: underline;
}

.sl-auth-switch button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0;
    font-weight: 700;
    color: var(--auth-link);
}

.sl-auth-switch button:hover {
    text-decoration: underline;
}

/* ---------- The 6-digit code ---------- */

/* Without the script it's one big box; the script turns it into 6 boxes */
.sl-auth-code {
    position: relative;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
}

.sl-auth-code-input {
    display: block;
    width: 100%;
    min-height: 58px;
    padding: 0 14px;
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: 'Space Grotesk', Inter, sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.4em;
    text-align: center;
}

.sl-auth-code-boxes {
    display: none;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.sl-auth-code-boxes span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 58px;
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    background: var(--auth-bg);
    font-family: 'Space Grotesk', Inter, sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--auth-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

/* With the script: the real input sits invisibly on top of the 6 boxes */
.sl-auth-code.is-enhanced .sl-auth-code-boxes {
    display: grid;
}

.sl-auth-code.is-enhanced .sl-auth-code-input {
    position: absolute;
    inset: 0;
    z-index: 1;
    height: 100%;
    min-height: 0;
    opacity: 0;
    caret-color: transparent;
    cursor: text;
}

.sl-auth-code-boxes span.is-filled {
    border-color: var(--auth-border-strong);
}

.sl-auth-code.is-focused .sl-auth-code-boxes span.is-current {
    border: 2px solid var(--auth-teal);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-teal) 20%, transparent);
}

.sl-auth-code.has-error .sl-auth-code-boxes span,
.sl-auth-code.has-error .sl-auth-code-input {
    border-color: var(--auth-warn);
}

.sl-auth-code.is-checking .sl-auth-code-boxes span {
    opacity: 0.6;
}

.sl-auth-code-form .sl-auth-code-submit {
    margin-top: 14px;
}

.sl-auth-code-form.is-enhanced .sl-auth-code-submit {
    display: none;
}

.sl-auth-code-status {
    margin: 10px 0 0;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: var(--auth-teal);
}

.sl-auth-code-status:empty {
    display: none;
}

/* "Send a new code in 0:29" */
.sl-auth-resend {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: -8px 0;
    font-size: 14px;
    color: var(--auth-muted);
}

/* Only while testing: shows the code that would have been emailed */
.sl-auth-dev {
    margin: 0;
    padding: 12px 14px;
    border: 1px dashed var(--auth-border-strong);
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    color: var(--auth-muted);
}

.sl-auth-dev strong {
    font-size: 15px;
    letter-spacing: 0.12em;
    color: var(--auth-text);
}

/* ---------- Welcome: the passkey card ---------- */

.sl-auth-box {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--auth-border);
    border-radius: 18px;
    background: var(--auth-surface);
}

.sl-auth-box-row {
    display: flex;
    gap: 12px;
}

.sl-auth-box-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--auth-teal) 12%, transparent);
    color: var(--auth-teal);
}

.sl-auth-box-title {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 700;
    color: var(--auth-text);
}

.sl-auth-box-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--auth-muted);
}

.sl-auth-box-done {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 46px;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--auth-teal);
}

.sl-auth-box form {
    margin: 0;
}
