/**
 * Dealer Auth — page CSS.
 *
 * Scope: the unified phone auth form for guests, plus the logged-in
 * email-verification banner when it is visible.
 *
 * These screens render OUTSIDE the `.dealer-account` shell (audit §2.1).
 * Selectors here therefore do NOT chain through `.dealer-account` — they
 * scope to `body.woocommerce-account` directly.
 *
 * Cascade position:
 *   tokens.css → base.css → components.css → auth.css
 *
 * Naming convention (BEM-ish, parallels .dealer-footer / .dealer-account):
 *   .dealer-auth                    outer wrapper
 *   .dealer-auth-form               the <form> (variant via --request / --verify)
 *   .dealer-auth-form__title        H2
 *   .dealer-auth-form__lead         intro paragraph
 *   .dealer-auth-form__label        identifier label
 *   .dealer-auth-form__identifier   phone input
 *   .dealer-auth-form__code-input   single OTP text input (no-JS fallback)
 *   .dealer-auth-form__hint         explanatory text before submit
 *   .dealer-auth-form__submit       submit button (uses .btn-auth-dark/.btn-full)
 *   .dealer-auth-form__alt          secondary action footer
 *   .dealer-auth-form__resend       resend wrapper
 *   .dealer-auth-form__resend-timer countdown text
 *   .dealer-auth-form__resend-link  the actual "resend" anchor
 *   .dealer-auth-form__otp          (JS-only) segmented OTP boxes wrapper
 *   .dealer-auth-form__otp-digit    (JS-only) one digit input
 *
 * Source of truth: docs/systems/AUTH-SYSTEM.md.
 */

/* =========================================================================
 * 1. Page chrome + outer wrapper
 * ========================================================================= */

body.woocommerce-account:not(.logged-in) .entry-header {
    display: none;
}

body.woocommerce-account:not(.logged-in) .site-main {
    padding-top: 100px;
    padding-bottom: 100px;
}

.site-main {
    margin-bottom: 0px !important;
}

body.woocommerce-account .dealer-auth {
    display: block;
    width: 100%;
    max-width: 630px;
    margin: 0 auto;
}

body.woocommerce-account .dealer-auth > .dealer-auth-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background-color: transparent;
    border: 0;
    border-radius: 0;
}

/* =========================================================================
 * 2. Typography inside the auth form
 * ========================================================================= */

body.woocommerce-account .dealer-auth > .dealer-auth-form .dealer-auth-form__title {
    margin: 0 0 15px;
    font-size: 30px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--color-black);
    text-align: center;
}

body.woocommerce-account .dealer-auth > .dealer-auth-form .dealer-auth-form__lead {
    width: 50%;
    max-width: 420px;
    margin: 0 auto 30px;
    font-size: 14px;
    font-weight: 300;
    color: var(--color-black);
    line-height: 1.2;
    text-align: center;
}

body.woocommerce-account .dealer-auth-form__lead strong {
    font-weight: var(--font-weight-medium);
    color: var(--color-black);
}

body.woocommerce-account .dealer-auth > .dealer-auth-form .dealer-auth-form__label {
    margin: 0 0 15px;
    font-size: 16px;
    font-weight: 300;
    line-height: 1.2;
    color: var(--color-black);
    text-align: center;
}

body.woocommerce-account .dealer-auth-form__required {
    color: var(--color-error);
    margin-left: 2px;
}

/* =========================================================================
 * 3. Identifier input (Step 1)
 * ========================================================================= */

body.woocommerce-account .dealer-auth-form__identifier {
    display: block;
    width: 50%;
    margin-right: auto;
    margin-left: auto;
}

body.woocommerce-account .dealer-auth-form__identifier::placeholder {
    color: rgba(0, 0, 0, 0.28);
    opacity: 1;
}

body.woocommerce-account .dealer-auth-form__honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    min-height: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* =========================================================================
 * 4. OTP input (Step 2)
 *
 * Default rendering: single text field, full width, large monospace digits.
 * JS upgrades it to a segmented 6-box UI (see §5). Both modes look right
 * without each other.
 * ========================================================================= */

body.woocommerce-account .dealer-auth-form__code-input {
    width: 100%;
    text-align: center;
    letter-spacing: 0.4em;
    font-size: 24px;
    font-weight: var(--font-weight-medium);
    font-variant-numeric: tabular-nums;
}

/* =========================================================================
 * 5. Segmented OTP (JS-enhanced)
 * ========================================================================= */

body.woocommerce-account .dealer-auth-form__otp {
    display: flex;
    justify-content: center;
    padding-bottom: 30px;
    gap: 8px;
}

body.woocommerce-account .dealer-auth-form__otp-digit {
    width: 50px;
    height: 50px;
    min-height: 0;
    padding: 0;
    font-size: 20px;
    font-weight: 500;
    text-align: center;
    font-variant-numeric: tabular-nums;
    /* Inherit the base.css input border / focus from §base. */
}

@media (min-width: 480px) {
    body.woocommerce-account .dealer-auth-form__otp-digit {
        width: 48px;
        height: 60px;
        font-size: 28px;
    }
}

/* =========================================================================
 * 6. Submit + footers
 * ========================================================================= */

body.woocommerce-account .dealer-auth-form__submit {
    margin: 0 auto;
    width: 50%;
    border-radius: 99px;
}

body.woocommerce-account .dealer-auth-form__hint {
    width: 50%;
    max-width: 430px;
    margin: 15px auto 50px;
    font-size: 14px;
    font-weight: 300;
    line-height: 1.2;
    color: rgba(0, 0, 0, 0.72);
    text-align: center;
}

body.woocommerce-account .dealer-auth-form__alt {
    margin: 0;
    text-align: center;
    font-size: var(--font-size-small);
    color: rgba(0, 0, 0, 0.7);
}

body.woocommerce-account .dealer-auth-form__alt a {
    margin-left: 4px;
}

/* =========================================================================
 * 7. Resend row
 *
 * Visible-when-running timer vs visible-when-ready link.
 * `hidden` attribute is the single source of truth — no inline styles.
 * ========================================================================= */

body.woocommerce-account .dealer-auth-form__resend {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding-top: 15px;
    padding-bottom: 5px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.7);
    min-height: 1.5;
}

body.woocommerce-account .dealer-auth-form__resend-timer {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.content-area, .widget-area {
    margin-bottom: 0px !important;
}

body.woocommerce-account [data-dealer-auth-countdown] {
    font-weight: var(--font-weight-medium);
    color: var(--color-black);
}

/* =========================================================================
 * 8. Notices on guest auth views
 *
 * WC notices render below the active auth form inside `.dealer-auth__notices`.
 * They intentionally read as inline validation text, not page-level banners.
 * ========================================================================= */

body.woocommerce-account:not(.logged-in) .dealer-auth__notices {
    width: 50%;
    margin: 18px auto 0;
}

body.woocommerce-account:not(.logged-in) .dealer-auth__notice {
    margin: 0;
    padding: 0;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-light);
    line-height: 1.35;
    text-align: center;
}

body.woocommerce-account:not(.logged-in) .dealer-auth__notice--success {
    color: var(--color-primary);
}

body.woocommerce-account:not(.logged-in) .dealer-auth__notice--error {
    color: var(--color-error);
}

body.woocommerce-account:not(.logged-in) .dealer-auth__notice--info {
    color: var(--color-black);
}

/* =========================================================================
 * 9. Tablet auth rhythm
 * ========================================================================= */

@media (min-width: 768px) and (max-width: 1023px) {
    body.woocommerce-account:not(.logged-in) .site-main {
        padding-top: 72px;
        padding-bottom: 72px;
    }

    body.woocommerce-account .dealer-auth {
        max-width: 560px;
    }

    body.woocommerce-account .dealer-auth > .dealer-auth-form .dealer-auth-form__title {
        margin-bottom: 15px;
        font-size: 30px;
    }

    body.woocommerce-account .dealer-auth > .dealer-auth-form .dealer-auth-form__lead {
        width: 70%;
        max-width: 390px;
        margin-bottom: 30px;
        font-size: 14px;
    }

    body.woocommerce-account .dealer-auth > .dealer-auth-form .dealer-auth-form__label {
        margin-bottom: 15px;
        font-size: 14px;
    }

    body.woocommerce-account .dealer-auth-form__identifier {
        width: 100%;
    }

    body.woocommerce-account .dealer-auth-form__hint {
        width: 80%;
        max-width: 420px;
        margin: 15px auto 30px;
        font-size: 14px;
    }

    body.woocommerce-account .dealer-auth-form__submit {
        width: 100%;
    }

    body.woocommerce-account:not(.logged-in) .dealer-auth__notices {
        width: 100%;
    }

    body.woocommerce-account .dealer-auth-form__code-input {
        font-size: 22px;
    }

    body.woocommerce-account .dealer-auth-form__alt,
    body.woocommerce-account .dealer-auth-form__resend {
        font-size: 14px;
    }
}

/* =========================================================================
 * 10. Mobile auth rhythm
 * ========================================================================= */

@media (max-width: 767px) {
    body.woocommerce-account:not(.logged-in) .site-main {
        padding-top: 60px;
        padding-bottom: 60px;
    }

    body.woocommerce-account .dealer-auth {
        max-width: 100%;
    }

    body.woocommerce-account .dealer-auth > .dealer-auth-form .dealer-auth-form__title {
        margin-bottom: 15px;
        font-size: 30px;
    }

    body.woocommerce-account .dealer-auth > .dealer-auth-form .dealer-auth-form__lead {
        width: 100%;
        max-width: 320px;
        margin-bottom: 15px;
        font-size: 14px;
    }

    body.woocommerce-account .dealer-auth > .dealer-auth-form .dealer-auth-form__label {
        margin-bottom: 15px;
        font-size: 14px;
    }

    body.woocommerce-account .dealer-auth-form__identifier {
        width: 100%;
    }

    body.woocommerce-account .dealer-auth-form__hint {
        width: 100%;
        max-width: 320px;
        margin: 15px auto 30px;
        font-size: 14px;
    }

    body.woocommerce-account .dealer-auth-form__submit {
        width: 100%;
    }

    body.woocommerce-account:not(.logged-in) .dealer-auth__notices {
        width: 100%;
        margin-top: 14px;
    }

    body.woocommerce-account .dealer-auth-form__code-input {
        font-size: 20px;
    }

    body.woocommerce-account .dealer-auth-form__otp {
        gap: 5px;
    }

    body.woocommerce-account .dealer-auth-form__otp-digit {
        width: 40px;
        height: 52px;
        font-size: 22px;
    }

    body.woocommerce-account .dealer-auth-form__alt,
    body.woocommerce-account .dealer-auth-form__resend {
        font-size: 14px;
    }

}
