/* =====================================================================
   auth.css — login & register (mobile + WhatsApp OTP)
   Semantic tokens only; explicit spacing.
   ===================================================================== */

.auth-body {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--brand) 30%, #050B1F),
        color-mix(in srgb, var(--brand) 85%, #050B1F));
}

.auth-page {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
    font-family: var(--font-sans);
    color: var(--text);
}
.auth-page__motif {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.auth-card {
    --auth-error: var(--error-500);
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 32px 24px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 28px 70px rgba(3, 8, 24, 0.42);
    animation: auth-card-in 0.28s ease-out both;
}
@keyframes auth-card-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-card__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.auth-card__logo { max-height: 56px; max-width: 200px; object-fit: contain; }
.auth-card__business {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text);
}

.auth-card__title {
    margin: 0 0 8px;
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-align: center;
    color: var(--text);
}
.auth-card__subtitle {
    margin: 0 0 28px;
    font-size: 0.9375rem;
    line-height: 1.6;
    text-align: center;
    color: var(--text-muted);
}
.auth-masked { display: block; margin-top: 6px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; white-space: nowrap; text-align: center; }

.auth-offline {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-900);
    background: var(--warning-100);
    border-bottom: 1px solid var(--warning-500);
}
.auth-offline[hidden] { display: none; }

.auth-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 14px;
}
.auth-banner[hidden] { display: none; }
.auth-banner i { margin-top: 3px; }
.auth-banner--error { color: var(--error-text); background: var(--error-100); }
.auth-banner--warn  { color: var(--primary-900); background: var(--warning-100); }

.auth-step { display: block; }
.auth-step[hidden] { display: none; }

.auth-field-label {
    display: block;
    margin: 0 0 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.auth-phone {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.auth-phone:focus-within {
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}
.auth-phone__chip {
    display: inline-flex;
    align-items: center;
    min-height: 52px;
    padding: 0 16px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-3);
    border-right: 1px solid var(--border);
}
.auth-phone__input {
    flex: 1;
    min-width: 0;
    min-height: 52px;
    padding: 0 16px;
    font: inherit;
    font-size: 1.125rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: none;
    box-shadow: none;
}
.auth-phone__input::placeholder { color: var(--text-muted); letter-spacing: 0.04em; }

.auth-input {
    display: block;
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.auth-input:focus,
.auth-input:focus-visible {
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}
.auth-input.is-invalid,
.auth-phone.is-invalid,
.auth-phone__input.is-invalid { border-color: var(--auth-error, var(--error-500)); }

/* spacing between stacked form groups */
.auth-step form > .auth-field-label:not(:first-child) { margin-top: 20px; }

.auth-field-error {
    margin: 8px 0 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--error-text);
}
.auth-field-error[hidden] { display: none; }

.auth-consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 20px;
    padding: 14px;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
}
.auth-consent input {
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    flex: 0 0 auto;
    accent-color: var(--brand);
}
.auth-consent a { color: var(--brand); font-weight: 600; }

.auth-submit {
    position: relative;
    width: 100%;
    min-height: 52px;
    margin-top: 24px;
}
.auth-submit .ant-spinner { display: none; }
.auth-submit.is-loading { pointer-events: none; opacity: 0.85; }
.auth-submit.is-loading .ant-spinner { display: inline-block; }

.auth-alt {
    margin-top: 24px;
    padding-top: 20px;
    font-size: 0.9375rem;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.auth-alt[hidden] { display: none; }
.auth-alt a { margin-left: 4px; font-weight: 700; color: var(--brand); }

/* ------------------------------------------------------------- OTP boxes */
.otp-input { margin: 4px 0 8px; }
.otp-input.is-busy { opacity: 0.7; }

.otp-boxes { display: flex; justify-content: center; gap: 10px; }
.otp-box {
    width: 48px;
    height: 58px;
    padding: 0;
    font-family: var(--font-display);
    font-size: 1.625rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.otp-box:focus,
.otp-box:focus-visible {
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}
.otp-box:disabled { opacity: 0.6; }

.otp-input.is-shake { animation: otp-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes otp-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

.otp-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.otp-resend { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.otp-resend__countdown { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.otp-resend__btn {
    min-height: 44px;
    padding: 0 4px;
    font: inherit;
    font-weight: 600;
    color: var(--brand);
    background: none;
    border: 0;
    cursor: pointer;
}
.otp-resend__btn:disabled { color: var(--text-muted); cursor: not-allowed; }
.otp-edit {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    color: var(--brand);
    white-space: nowrap;
}
.otp-error { margin-top: 12px; font-size: 0.8125rem; line-height: 1.4; text-align: center; color: var(--error-text); }
.otp-spinner {
    display: none;
    width: 22px;
    height: 22px;
    margin: 12px auto 0;
    border: 2px solid color-mix(in srgb, var(--brand) 25%, transparent);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: otp-spin 0.7s linear infinite;
}
@keyframes otp-spin { to { transform: rotate(360deg); } }

@media (min-width: 480px) {
    .auth-card { padding: 40px 36px 32px; }
}
@media (max-width: 380px) {
    .auth-card { padding: 28px 18px 24px; }
    .otp-boxes { gap: 6px; }
    .otp-box { width: 42px; height: 52px; font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-card { animation: none; }
    .otp-input.is-shake { animation: none; }
    .otp-spinner { animation-duration: 1.4s; }
}
