/* ============================================================
   AUTH (Login / Signup) — matches Maple brand tokens
============================================================ */

body[data-theme="auth"] {
    background: var(--bg-sand);
    color: var(--text-primary);
}

.auth-main {
    min-height: calc(100vh - var(--header-h, 72px));
    padding-block: clamp(3rem, 8vw, 6rem);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.auth-shell {
    width: 100%;
    max-width: 560px;
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 4vw, 2rem);
}
.auth-card { width: 100%; }
.auth-card--wide { max-width: 640px; margin-inline: auto; }

.auth-card__head {
    margin-bottom: 2.25rem;
    text-align: center;
}
.auth-card__title {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: clamp(2.25rem, 4vw, 3rem);
    line-height: 1.05;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}
.auth-card__sub {
    font-family: 'Geist', sans-serif;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== Form ===== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.auth-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 720px) { .auth-grid { grid-template-columns: 1fr 1fr; } }

.auth-field { display: flex; flex-direction: column; gap: 0.5rem; }
.auth-field__label {
    font-family: 'Geist', sans-serif;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-primary);
}
.auth-field__req { color: var(--brand-orange); margin-left: 2px; }
.auth-field__hint {
    font-family: 'Geist', sans-serif;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

.auth-field__input {
    width: 100%;
    height: 52px;
    padding: 0 1rem;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius-btn);
    font-family: 'Geist', sans-serif;
    font-size: 0.9375rem;
    color: var(--text-primary);
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.auth-field__input::placeholder { color: var(--text-tertiary); }
.auth-field__input:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(22, 22, 24, 0.08);
}
.auth-field__input.is-invalid {
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(252, 122, 74, 0.15);
}

.auth-field__row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}
.auth-field__row .auth-field__input { flex: 1; min-width: 0; }
.auth-field__row--phone { flex-wrap: nowrap; }

/* Password input + eye toggle */
.auth-field__pw { position: relative; }
.auth-field__pw .auth-field__input { padding-right: 48px; }
.auth-field__eye {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: transparent;
    border: 0;
    color: var(--text-tertiary);
    cursor: pointer;
    display: grid;
    place-items: center;
    border-radius: 4px;
    transition: color var(--t-fast) var(--ease);
}
.auth-field__eye:hover { color: var(--text-primary); }

/* Action buttons (Check, Verify) */
.auth-action {
    flex: 0 0 auto;
    height: 52px;
    padding: 0 1.25rem;
    background: var(--text-primary);
    border: 1px solid var(--text-primary);
    border-radius: var(--radius-btn);
    font-family: 'Geist', sans-serif;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-reversed);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
    white-space: nowrap;
}
.auth-action:hover { background: #000; }
.auth-action.is-verified {
    background: #ffffff;
    color: var(--brand-orange);
    border-color: var(--brand-orange);
    pointer-events: none;
}
.auth-action.is-verified::before {
    content: '✓ ';
    margin-right: 2px;
}

/* Country code dropdown */
.auth-cc {
    position: relative;
    flex: 0 0 auto;
}
.auth-cc__btn {
    height: 52px;
    min-width: 100px;
    padding: 0 0.85rem;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius-btn);
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-family: 'Geist', sans-serif;
    font-size: 0.9375rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color var(--t-fast) var(--ease);
}
.auth-cc__btn:hover { border-color: var(--text-tertiary); }
.auth-cc__btn[aria-expanded="true"] {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(22, 22, 24, 0.08);
}
.auth-cc__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 280px;
    max-height: 300px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius-btn);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    list-style: none;
    margin: 0;
    padding: 4px;
    z-index: 50;
}
.auth-cc__menu[hidden] { display: none; }
.auth-cc__menu li {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Geist', sans-serif;
    font-size: 0.9375rem;
    color: var(--text-primary);
}
.auth-cc__menu li:hover { background: var(--bg-sand); }
.auth-cc__menu li[aria-selected="true"] { background: var(--bg-sand-strong); }
.auth-cc__iso { font-weight: 600; font-size: 0.8125rem; color: var(--text-secondary); }
.auth-cc__code { color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

/* Agreement */
.auth-agree {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-family: 'Geist', sans-serif;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    margin-top: 0.25rem;
}
.auth-agree input {
    margin-top: 3px;
    accent-color: var(--brand-orange);
    width: 16px;
    height: 16px;
}

/* ===== Buttons ===== */
.auth-btn {
    height: 56px;
    border-radius: var(--radius-btn);
    font-family: 'Geist', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
    text-decoration: none;
    width: 100%;
}
.auth-btn--primary {
    color: var(--text-reversed);
    background: var(--text-primary);
    border-color: var(--text-primary);
}
.auth-btn--primary:hover { background: #000; border-color: #000; }
.auth-btn--google {
    background: #ffffff;
    border-color: var(--line);
    color: var(--text-primary);
    font-weight: 500;
}
.auth-btn--google:hover { background: var(--bg-subtle); }
.auth-btn--google[disabled] { cursor: not-allowed; opacity: 0.85; }
.auth-btn--google .auth-btn__g { display: inline-grid; place-items: center; }
.auth-btn--ghost {
    background: #ffffff;
    border-color: var(--line);
    color: var(--text-primary);
    font-weight: 500;
}
.auth-btn--ghost:hover { border-color: var(--text-primary); }
.auth-btn--continue { margin-top: 0.5rem; }

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--text-tertiary);
    font-family: 'Geist', sans-serif;
    font-size: 0.875rem;
    margin-block: 0.25rem;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* ===== Modal (Notice + Loading) ===== */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    background: rgba(22, 22, 24, 0.45);
    padding: 1rem;
    animation: auth-modal-fade 0.18s ease-out;
}
.auth-modal[hidden] { display: none; }
@keyframes auth-modal-fade { from { opacity: 0; } to { opacity: 1; } }

.auth-modal__box {
    background: #ffffff;
    border-radius: 14px;
    width: min(420px, 100%);
    padding: 1.5rem;
    box-shadow: 0 24px 60px rgba(22, 22, 24, 0.18);
}
.auth-modal__box--loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding-block: 2.25rem;
}
.auth-modal__head {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.5rem;
}
.auth-modal__icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}
.auth-modal__icon--ok { background: #16a34a; }
.auth-modal__icon--ok::before { content: '✓'; }
.auth-modal__icon--err { background: #ef4444; }
.auth-modal__icon--err::before { content: '✕'; }
.auth-modal__title {
    font-family: 'Geist', sans-serif;
    font-weight: 600;
    font-size: 1.0625rem;
    color: var(--text-primary);
}
.auth-modal__msg {
    font-family: 'Geist', sans-serif;
    color: var(--text-secondary);
    margin: 0.4rem 0 1.25rem;
    line-height: 1.5;
    font-size: 0.9375rem;
}
.auth-modal__foot {
    display: flex;
    justify-content: flex-end;
}
.auth-modal__ok {
    height: 38px;
    padding: 0 1.6rem;
    background: var(--text-primary);
    color: var(--text-reversed);
    border: 0;
    border-radius: var(--radius-btn);
    font-family: 'Geist', sans-serif;
    font-weight: 500;
    cursor: pointer;
}
.auth-modal__ok:hover { background: #000; }

/* Spinner — 8 dots */
.auth-spinner {
    position: relative;
    width: 56px;
    height: 56px;
}
.auth-spinner span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 18px;
    margin-top: -9px;
    margin-left: -3px;
    background: var(--brand-orange);
    border-radius: 3px;
    opacity: 0.15;
    animation: auth-spin 1s linear infinite;
}
.auth-spinner span:nth-child(1) { transform: rotate(0deg)   translateY(-18px); animation-delay: -0.875s; }
.auth-spinner span:nth-child(2) { transform: rotate(45deg)  translateY(-18px); animation-delay: -0.75s; }
.auth-spinner span:nth-child(3) { transform: rotate(90deg)  translateY(-18px); animation-delay: -0.625s; }
.auth-spinner span:nth-child(4) { transform: rotate(135deg) translateY(-18px); animation-delay: -0.5s; }
.auth-spinner span:nth-child(5) { transform: rotate(180deg) translateY(-18px); animation-delay: -0.375s; }
.auth-spinner span:nth-child(6) { transform: rotate(225deg) translateY(-18px); animation-delay: -0.25s; }
.auth-spinner span:nth-child(7) { transform: rotate(270deg) translateY(-18px); animation-delay: -0.125s; }
.auth-spinner span:nth-child(8) { transform: rotate(315deg) translateY(-18px); animation-delay: 0s; }
@keyframes auth-spin {
    0%   { opacity: 1; }
    100% { opacity: 0.15; }
}
.auth-loading__msg {
    text-align: center;
    color: var(--text-secondary);
    font-family: 'Geist', sans-serif;
    line-height: 1.5;
}
