/* SuperCala shared sign-in / register styling.
 *
 * Used by MyNetWorth and LedgerPilot auth screens so OAuth buttons,
 * form fields, and modals look the same across products. Relies on
 * the host app's CSS variables (--bg, --surface, --text, --muted,
 * --border, --accent, --accent-hover, --negative). --panel falls
 * back to --surface so apps that don't define a separate panel
 * token still get a solid white (or dark-mode surface) OAuth button.
 *
 * All selectors are scoped under .auth-screen except the modal —
 * the modal is a sibling of .auth-screen in LedgerPilot's markup,
 * so it has its own scope via .auth-modal wrapper classes below.
 */

/* Page-level gradient backdrop. Light-mode only — in dark mode we
 * fall back to a flat --bg so the cyan wash doesn't look garish on
 * a navy surface. Matches MyNetWorth's SPA shell.
 */
body {
    background-color: var(--bg);
    background-image: linear-gradient(to bottom, rgba(0, 162, 232, 0.24), rgba(195, 195, 195, 0.16) 400px, #ffffff 800px);
    background-repeat: no-repeat;
}
@media (prefers-color-scheme: dark) {
    body { background-image: none; }
}

.auth-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80vh;
}
.auth-screen h1 {
    font-size: 32px;
    text-align: center;
    margin-bottom: 8px;
}
.auth-screen p,
.auth-screen p.tagline {
    text-align: center;
    color: var(--muted);
    margin-bottom: 32px;
}

.auth-screen .field,
.auth-modal .field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}
.auth-screen .field label,
.auth-modal .field label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.auth-screen .field input,
.auth-modal .field input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 16px;
    font-family: inherit;
}
.auth-screen .field input:focus,
.auth-modal .field input:focus { outline: 2px solid var(--accent); }

.auth-screen .button {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    margin-top: 4px;
    text-decoration: none;
}
.auth-screen .button:hover { background: var(--bg); }
.auth-screen .button.primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    font-weight: 600;
}
.auth-screen .button.primary:hover { background: var(--accent-hover); }
.auth-screen .button.primary:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-screen .oauth-btn {
    background: var(--panel, var(--surface, #ffffff));
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    color: var(--text);
}
.auth-screen .oauth-icon { display: inline-flex; line-height: 0; }

.auth-screen .divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: var(--muted);
    font-size: 12px;
}
.auth-screen .divider-line { flex: 1; height: 1px; background: var(--border); }

.auth-screen .error-msg,
.auth-modal .error-msg {
    color: var(--negative);
    font-size: 14px;
    text-align: center;
    margin: 8px 0;
    min-height: 18px;
}

/* Six-box TOTP / one-time-code input. Matches SCOtpInput JS widget. */
.otp-input {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 12px 0 16px;
}
.otp-input input {
    width: 44px;
    height: 52px;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    padding: 0;
    box-sizing: border-box;
}
.otp-input input:focus {
    outline: 2px solid var(--accent);
    border-color: var(--accent);
}
@media (max-width: 360px) {
    .otp-input { gap: 6px; }
    .otp-input input { width: 38px; height: 46px; font-size: 20px; }
}

.auth-screen .auth-toggle {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--muted);
}
.auth-screen .auth-toggle a { color: var(--accent); cursor: pointer; text-decoration: none; }
.auth-screen .auth-toggle a:hover { text-decoration: underline; }

/* Legal/contact footer under the auth card. Present on every auth
 * screen so vendors (SnapTrade, Plaid reviewers, etc.) and
 * logged-out visitors have a reachable path to Terms, Privacy, and
 * a contact address without having to go through signup.
 */
.auth-footer {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}
.auth-footer a {
    color: var(--muted);
    text-decoration: none;
}
.auth-footer a:hover { color: var(--accent); text-decoration: underline; }
.auth-footer .sep {
    color: var(--border);
    user-select: none;
}

/* Forgot-password modal. Sibling of .auth-screen in markup, not
 * nested under it — so classes are unscoped but prefixed to avoid
 * collisions with host apps that have their own .modal system.
 */
.auth-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
.auth-modal-backdrop.active { display: flex; }
.auth-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.auth-modal h3 { margin: 0 0 8px; font-size: 18px; }
.auth-modal .modal-sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; line-height: 1.5; }
.auth-modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.auth-modal .modal-actions .button {
    width: auto;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}
.auth-modal .modal-actions .button.primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    font-weight: 600;
}
.auth-modal .modal-actions .button.primary:hover { background: var(--accent-hover); }
.auth-modal .modal-actions .button.primary:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 480px) {
    .auth-modal-backdrop { align-items: flex-end; padding: 0; }
    .auth-modal { border-radius: 16px 16px 0 0; }
}
