/* =============================================================================
   Auth — login / register / OAuth / password reset.
   Rooted under `.luna .auth`; all colour comes from the design tokens, so light
   and dark follow the theme automatically with no per-rule hex. Field height is
   the shared --field-height. No !important.
   ============================================================================= */

/* --- Card shell ----------------------------------------------------------- */
.luna.auth {
    display: block;
}

.luna .auth__card {
    width: 100%;
    max-width: var(--width-narrow);
    margin: var(--space-xl) auto;
    padding: var(--space-xl);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    text-align: left;
}

.luna .auth__title {
    margin: 0 0 var(--space-lg);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    text-align: center;
    color: var(--heading);
}

/* --- Fields --------------------------------------------------------------- */
.luna .auth-form .field-group {
    margin-bottom: var(--space);
    text-align: left;
}

.luna .auth-form .field-group:last-of-type {
    margin-bottom: 0;
}

.luna .field-error {
    display: flex;
    align-items: center;
    font-size: var(--font-size-xs);
    color: var(--status-danger);
    margin: 0;
}

/* Inline warning note inside a success message (e.g. verification email failed). */
.luna .auth-note-warn {
    color: var(--status-danger);
}

/* Availability / match status (auth.js). */
.luna .availability-message,
.luna .email-validation,
.luna .password-match-status {
    display: flex;
    align-items: center;
    font-size: var(--font-size-xs);
    animation: authFadeIn .3s ease;
}

.luna .availability-message.checking { color: var(--body-text); }
.luna .availability-message.available { color: var(--status-success); }
.luna .availability-message.unavailable,
.luna .availability-message.error { color: var(--status-danger); }

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Password field ------------------------------------------------------- */
.luna .password-field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.luna .password-field-wrapper input {
    flex: 1;
    padding-right: var(--space-xl);
}

/* Hide native reveal buttons so there is only our toggle. */
.luna input[type="password"]::-ms-reveal,
.luna input[type="password"]::-webkit-credentials-auto-fill-button,
.luna input[type="password"]::-webkit-password-reveal-button {
    display: none;
}

.luna .password-toggle {
    position: absolute;
    right: var(--space-xs);
    border: none;
    cursor: pointer;
    padding: var(--space-2xs);
    border-radius: var(--radius-xs);
    color: var(--body-text);
    transition: color .2s ease, background .2s ease;
}

.luna .password-toggle:hover { color: var(--heading); }

.luna .password-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.luna .password-toggle-icon {
    display: block;
    width: var(--space);
    height: var(--space);
}

/* Password requirement checklist (auth.js toggles .met / .unmet). */
.luna .requirement {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
    transition: color .2s ease;
}

.luna .requirement:last-child { margin-bottom: 0; }

.luna .requirement-icon {
    width: 1rem;
    text-align: center;
    font-weight: var(--font-weight-bold);
}

.luna .requirement.unmet { color: var(--status-danger); }
.luna .requirement.met { color: var(--status-success); }

/* --- Buttons -------------------------------------------------------------- */
.luna .auth-btn {
    width: auto;
    min-width: 15ch;
    display: inline-block;
}

.luna .button-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space);
    margin-top: var(--space);
}

/* Forms whose submit button is a direct child (reset, oauth) get the same top
   gap the .button-group gives the login button. */
.luna .auth-form > .auth-btn {
    margin-top: var(--space);
}

.luna .btn-spinner {
    display: inline-block;
    margin-left: var(--space-xs);
    animation: authSpin 1s linear infinite;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

.luna .auth-form button[disabled] {
    opacity: .7;
    cursor: not-allowed;
}

.luna .auth-form {
    text-align: center;
}

/* --- Divider + social ----------------------------------------------------- */
.luna .divider-container {
    display: flex;
    align-items: center;
    gap: var(--space);
    margin: var(--space) 0;
}

.luna .divider-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.luna .divider-text {
    font-size: var(--font-size-sm);
    color: var(--body-text);
}

.luna .social-login-container {
    display: flex;
    justify-content: center;
    margin: var(--space) 0;
}

.luna .social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    text-decoration: none;
    border: 1px solid var(--border);
}

.luna .social-icon {
    flex-shrink: 0;
    width: var(--space);
    height: var(--space);
}

/* --- OAuth banners (Google sign-up / username fix / verified email) ------- */
.luna .oauth-register-header > div,
.luna .oauth-info-box {
    display: flex;
    align-items: center;
    gap: var(--space);
    padding: var(--space);
    margin-bottom: var(--space);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    color: var(--body-text);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.luna .oauth-register-header svg.oauth-register-header__icon {
    flex-shrink: 0;
}

.luna .oauth-register-header strong,
.luna .oauth-info-box strong {
    color: var(--heading);
}

/* --- Links ---------------------------------------------------------------- */
.luna .auth-links {
    text-align: center;
    margin: var(--space) 0;
    font-size: var(--font-size-sm);
}

.luna .auth-links a {
    color: var(--accent);
    text-decoration: none;
    transition: color .2s ease;
}

.luna .auth-links a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.luna .auth__welcome {
    text-align: center;
}

.luna .auth__actions {
    display: flex;
    flex-direction: column;
    gap: var(--space);
    margin-top: var(--space);
}

/* Screen-reader-only (auth.js status messages). */
.luna .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Mobile --------------------------------------------------------------- */
@media (max-width: 480px) {
    .luna .auth__card {
        max-width: 100%;
        margin: var(--space-xs);
        padding: var(--space);
    }
}

/* =============================================================================
   LEGACY — global .section-title, still emitted by inc/shipping/shipping-main.php.
   Retained until that view is migrated; do not extend.
   ============================================================================= */
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.5rem;
}
