/* ============================================================================
   Auth — signup page, login page and the in-chat signup modal.
   One narrow centered column on the crushly theme tokens (base.css), so it
   follows light / dark / palette switches. Google-first: the provider button
   is the primary CTA, the email form sits under an "or" divider.
   ============================================================================ */

:root { --auth-ctl-h: 50px; --auth-r: 12px; }

/* ---------- Page stage -------------------------------------------------- */
.auth {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(24px, 6vh, 64px) 16px clamp(24px, 6vh, 48px);
}
.auth-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 420px;
    padding: clamp(26px, 5vw, 36px) clamp(20px, 5vw, 32px) clamp(22px, 5vw, 28px);
    border-radius: 20px;
    background: var(--bg-container-solid);
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 30px var(--shadow);
}
.auth-main { display: flex; flex-direction: column; }

/* ---------- Head -------------------------------------------------------- */
.auth-wordmark {
    display: block;
    width: fit-content;
    margin: 0 auto 18px;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -.02em;
    line-height: 1;
    color: var(--text-primary);
    text-decoration: none;
}
.auth-wordmark:hover { text-decoration: none; color: var(--accent-blue); }

.auth-head { margin-bottom: 20px; text-align: center; }
.auth-title {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 24px;
    line-height: 1.15;
    letter-spacing: -.01em;
    color: var(--text-primary);
    text-wrap: balance;
}
.auth-sub { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-secondary); }

/* ---------- Provider button (primary CTA) ------------------------------- */
.auth-socials { display: flex; flex-direction: column; gap: 10px; }
.auth-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
    min-height: var(--auth-ctl-h);
    padding: 0 18px;
    border-radius: var(--auth-r);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    color: #1f1f1f;
    background: #fff;
    border: 1px solid var(--border-main);
    box-shadow: 0 2px 10px var(--shadow);
    transition: background .18s ease, box-shadow .18s ease, transform .16s ease;
}
.auth-google:hover { background: #f4f4f6; text-decoration: none; color: #1f1f1f; transform: translateY(-1px); }
.auth-google:active { transform: scale(.99); }
.auth-google:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 40%, transparent);
}
.auth-google svg { flex-shrink: 0; }

/* ---------- Divider ----------------------------------------------------- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
}
.auth-divider::before,
.auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-main); }

/* ---------- Fields ------------------------------------------------------ */
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
/* Placeholders carry the copy; the label stays for assistive tech. */
.auth-field > label {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.auth-input { position: relative; display: flex; align-items: center; }
.auth-input-icon {
    position: absolute;
    left: 14px;
    width: 18px; height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color .2s ease;
}
.auth-input input {
    box-sizing: border-box;
    width: 100%;
    min-height: var(--auth-ctl-h);
    padding: 0 14px 0 42px;
    font-family: inherit;
    font-size: 16px; /* >=16px: iOS doesn't zoom the field */
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-main);
    border-radius: var(--auth-r);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.auth-input input::placeholder { color: var(--text-muted); }
.auth-input input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 18%, transparent);
}
.auth-input:focus-within .auth-input-icon { color: var(--accent-blue); }
.auth-input--toggle input { padding-right: 48px; }

.auth-input-toggle {
    position: absolute;
    right: 5px;
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color .16s ease, background .16s ease;
}
.auth-input-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.auth-input-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 30%, transparent);
}
.auth-input-toggle svg { width: 19px; height: 19px; }
.auth-input-toggle .i-hide { display: none; }
.auth-input-toggle[aria-pressed="true"] .i-show { display: none; }
.auth-input-toggle[aria-pressed="true"] .i-hide { display: block; }

/* invalid state + inline error */
.auth-field.is-invalid .auth-input input { border-color: var(--accent-red); }
.auth-field.is-invalid .auth-input input:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-red) 18%, transparent);
}
.auth-field.is-invalid .auth-input-icon { color: var(--accent-red); }
.auth-error {
    margin: 0;
    padding: 0 4px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--accent-red);
}
.auth-error:empty { display: none; }
.auth-error a { color: inherit; font-weight: 600; text-decoration: underline; }

.auth-field-row { display: flex; justify-content: flex-end; margin-top: -2px; padding: 0 4px; }
.auth-field-row a { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); text-decoration: none; }
.auth-field-row a:hover { color: var(--accent-blue); }

/* ---------- Submit ------------------------------------------------------ */
.auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin-top: 2px;
    width: 100%;
    min-height: var(--auth-ctl-h);
    padding: 0 16px;
    border: none;
    border-radius: var(--auth-r);
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    /* the crushly CTA gradient (matches the logo + the pink header buttons) */
    background: linear-gradient(135deg, #ff6b9d, #c084fc);
    box-shadow: 0 6px 18px -8px #ff6b9d;
    transition: filter .18s ease, transform .16s ease, opacity .2s ease;
}
.auth-submit:hover { filter: brightness(1.05); transform: translateY(-1px); }
.auth-submit:active { transform: scale(.99); }
.auth-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 40%, transparent);
}
.auth-submit[disabled] { opacity: .7; cursor: default; transform: none; }

/* ---------- Legal line + footer link ------------------------------------ */
.auth-legal {
    margin: 16px 0 0;
    text-align: center;
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-secondary);
    text-wrap: balance;
}
.auth-legal strong { color: var(--text-primary); }
.auth-legal a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 2px; }
.auth-legal a:hover { color: var(--accent-blue); }

.auth-alt {
    margin: 20px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.auth-alt a { color: var(--text-primary); font-weight: 600; text-decoration: none; }
.auth-alt a:hover { color: var(--accent-blue); text-decoration: underline; }

/* ---------- Messages ---------------------------------------------------- */
.auth-messages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.auth-message {
    padding: 11px 14px;
    border-radius: var(--auth-r);
    font-size: 13.5px;
    line-height: 1.4;
    background: var(--bg-hover);
    border: 1px solid var(--border-main);
    color: var(--text-primary);
}
.auth-message.error {
    background: color-mix(in srgb, var(--accent-red) 12%, var(--bg-container-solid));
    color: var(--accent-red);
    border-color: color-mix(in srgb, var(--accent-red) 40%, transparent);
}
.auth-message.success {
    background: color-mix(in srgb, var(--accent-green) 12%, var(--bg-container-solid));
    color: var(--accent-green);
    border-color: color-mix(in srgb, var(--accent-green) 40%, transparent);
}

/* ---------- In-chat modal ----------------------------------------------- */
/* The modal shell (.signup-modal / .signup-modal-content / .modal-close)
   stays in messenger.css; only its body uses the .auth-* components. */
.signup-modal .auth-main { padding-top: 6px; }
.signup-modal .auth-head { margin-bottom: 18px; }
.signup-modal .auth-title { font-size: 21px; padding: 0 20px; }

/* ---------- Responsive -------------------------------------------------- */
@media (max-width: 560px) {
    .auth { padding: 12px 0 28px; }
    .auth-card {
        max-width: none;
        padding: 20px 18px 24px;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
}
