/* Shared styling for the unauthenticated pages: login, signup, link-sent.
   Extracted verbatim from the original login page so all auth screens stay in
   lockstep. Additions for the signup/link-sent screens are grouped at the end. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --teal:          #1ACECF;
    --teal-dim:      rgba(26, 206, 207, 0.14);
    --teal-hover:    #3bdbdc;
    --teal-dark:     #13a8a9;
    --teal-glow:     rgba(26, 206, 207, 0.32);
    --cream:         #FDFBD4;
    --bg:            #090B10;
    --page-bg:       radial-gradient(circle at 25% -8%, rgba(26,206,207,.24), transparent 32rem),
                       linear-gradient(145deg, #111722 0%, #090B10 58%, #07080B 100%);
    --surface:       #16181e;
    --border:        rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-focus:  #1ACECF;
    --text:          #F4F6F8;
    --text-secondary:#99a1ad;
    --text-muted:    #5b6573;
    --error-bg:      rgba(239, 68, 68, 0.10);
    --error-border:  rgba(239, 68, 68, 0.28);
    --error-text:    #FCA5A5;
    --success-bg:    rgba(26, 206, 207, 0.10);
    --success-border:rgba(26, 206, 207, 0.28);
    --card-inset:    rgba(255, 255, 255, 0.05);
    --card-shadow:   inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 44px -20px rgba(0, 0, 0, 0.75);
    --ambient-glow:  radial-gradient(ellipse 65% 45% at 50% 0%, rgba(26, 206, 207, 0.12) 0%, transparent 60%);
    --toggle-track:  rgba(255, 255, 255, 0.05);
    --toggle-thumb:  linear-gradient(135deg, rgba(26, 206, 207, 0.22), rgba(253, 251, 212, 0.12));
}

html[data-theme="light"] {
    --bg:            #F4F0E7;
    --page-bg:       radial-gradient(circle at 24% -10%, rgba(26,206,207,.18), transparent 30rem),
                       radial-gradient(circle at 92% 7%, rgba(248,214,109,.20), transparent 28rem),
                       linear-gradient(145deg, #FFFDF7 0%, #F3EFE6 54%, #E9E3D7 100%);
    --surface:       rgba(255,253,247,.86);
    --border:        rgba(21,31,40,.11);
    --border-subtle: rgba(21,31,40,.08);
    --text:          #17232B;
    --text-secondary:#66717E;
    --text-muted:    #8A96A3;
    --error-bg:      rgba(239, 68, 68, 0.10);
    --error-border:  rgba(239, 68, 68, 0.18);
    --error-text:    #B94A48;
    --success-bg:    rgba(26, 206, 207, 0.10);
    --success-border:rgba(26, 206, 207, 0.18);
    --card-inset:    rgba(255, 255, 255, 0.7);
    --card-shadow:   0 24px 48px rgba(22, 30, 38, 0.08);
    --ambient-glow:  radial-gradient(ellipse at center top, rgba(26, 206, 207, 0.12) 0%, rgba(253, 251, 212, 0.18) 34%, transparent 74%);
    --toggle-track:  rgba(24, 33, 39, 0.05);
    --toggle-thumb:  linear-gradient(135deg, rgba(26, 206, 207, 0.16), rgba(253, 251, 212, 0.72));
}

html, body {
    height: 100%;
    background: var(--page-bg, var(--bg));
    background-attachment: fixed;
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.003em;
}

body::before { display: none; }

.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    gap: 0;
}

.theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 2;
    border: 1px solid var(--border);
    border-radius: 9999px;
    background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface), var(--bg) 28%) 100%);
    box-shadow: 0 1px 0 var(--card-inset) inset, var(--card-shadow);
    padding: 0.4rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    color: inherit;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--teal), var(--border) 58%);
}

.theme-toggle:focus-visible {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(26, 206, 207, 0.12), var(--card-shadow);
}

.theme-toggle-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem;
    border-radius: 9999px;
    background: var(--toggle-track);
    border: 1px solid var(--border-subtle);
}

.theme-chip {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

html[data-theme="light"] .theme-chip-light,
html[data-theme="dark"] .theme-chip-dark {
    background: var(--toggle-thumb);
    color: var(--text);
    box-shadow: 0 8px 18px rgba(26, 206, 207, 0.12);
    transform: translateY(-1px);
}

/* ── Brand ─────────────────────────────────────────────────── */
.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.brand-img {
    display: block;
    width: 10.5rem;
    height: 3.1rem;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(26,206,207,.16));
}
.brand-img-dark { display: none; }
html[data-theme="dark"] .brand-img-light { display: none; }
html[data-theme="dark"] .brand-img-dark { display: block; }

.brand-sub {
    font-size: 0.625rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1;
}

/* ── Card ──────────────────────────────────────────────────── */
.card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 2.25rem 2.25rem 2.5rem;
    box-shadow:
        0 0 0 1px var(--card-inset) inset,
        0 24px 60px rgba(42,44,40,.13);
}

.card-heading {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.055em;
    color: var(--text);
    line-height: 0.98;
    margin-bottom: 0.375rem;
}

.card-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.875rem;
}

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.8125rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--teal);
}

.alert-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* ── Form ──────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.125rem;
}

label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(26, 206, 207, 0.12);
}

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

/* ── Button ────────────────────────────────────────────────── */
.btn {
    display: block;
    width: 100%;
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 9999px;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.005em;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
    margin-top: 0.75rem;
}

.btn-primary {
    background: linear-gradient(180deg, #22d7d8, #14b9ba);
    color: #042322;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 22px -6px var(--teal-glow);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #34e0e1, #19c5c6);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 12px 30px -6px var(--teal-glow);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* ── Divider / footer ──────────────────────────────────────── */
.page-footer {
    margin-top: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.page-footer-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
}

/* ── Accent line at top of card ────────────────────────────── */
.card::before { display: none; }

@media (max-width: 640px) {
    .theme-toggle {
        top: 0.85rem;
        right: 0.85rem;
    }
}

/* ══ Additions for signup / passwordless / link-sent ═══════════ */

/* Secondary (outline) button for the "email me a link" alternative. */
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 0 var(--card-inset);
}

.btn-ghost:hover {
    border-color: color-mix(in srgb, var(--teal), var(--border) 45%);
    background: var(--teal-dim);
    transform: translateY(-1px);
}

.btn-ghost:active {
    transform: scale(0.98);
}

/* "or" divider between the password form and the magic-link option. */
.divider-or {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.6875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

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

/* Small centered link row under the card ("Already have an account?"). */
.card-switch {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.text-link {
    color: var(--teal);
    text-decoration: none;
    font-weight: 600;
}

.text-link:hover {
    text-decoration: underline;
}

/* Big glyph on the "check your email" confirmation card. */
.confirm-glyph {
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: var(--teal-dim);
    color: var(--teal);
}
