/*
 * Auth UI: login / register / forgot-password modal and the OTP / reset pages.
 * Everything lives under .auth so it never leaks into the rest of the site.
 * Behaviour: public/assets/js/auth.js
 */

.auth {
    --auth-primary: #8145d8;
    --auth-primary-dark: #6a34bd;
    --auth-tint: #f6f1fe;
    --auth-border: #e3dcf1;
    --auth-text: #1e1e1e;
    --auth-muted: #6e6a7c;
    --auth-danger: #d12a45;
    --auth-danger-tint: #fdeef1;
    --auth-success: #167a52;
    --auth-success-tint: #e8f6ef;

    color: var(--auth-text);
    font-size: 22px;
    line-height: 1.6;
}

/* ---------- Containers ---------- */

.auth-modal .modal-dialog {
    max-width: 480px;
}

.auth-modal .modal-content.auth {
    position: relative;
    padding: 36px 32px 32px;
    background: #fff;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(48, 22, 92, 0.22);
}

.auth-page {
    display: flex;
    justify-content: center;
    padding: 24px 16px 48px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    padding: 36px 32px 32px;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(48, 22, 92, 0.08);
}

.auth-close {
    position: absolute;
    inset-block-start: 14px;
    inset-inline-end: 14px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--auth-muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.auth-close:hover {
    color: var(--auth-primary);
    background: var(--auth-tint);
}

/* ---------- Header ---------- */

.auth-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.auth-brand img {
    width: auto;
    max-width: 200px;
    height: 96px;
    object-fit: contain;
}

.auth-head {
    margin-bottom: 24px;
    text-align: center;
}

.auth-title {
    margin: 0 0 6px;
    color: var(--auth-text);
    font-size: 36px;
    font-weight: 700;
}

.auth-subtitle {
    margin: 0 0 20px;
    color: var(--auth-muted);
    font-size: 22px;
    text-align: center;
}

.auth-head .auth-subtitle {
    margin: 0;
}

.auth-phone {
    color: var(--auth-text);
    font-weight: 700;
}

/* ---------- Fields ---------- */

.auth-field {
    margin-bottom: 20px;
}

.auth-label {
    display: block;
    margin-bottom: 8px;
    color: var(--auth-text);
    font-size: 22px;
    font-weight: 400;
}

.auth-control {
    position: relative;
}

.auth-input {
    display: block;
    width: 100%;
    height: 56px;
    padding: 0 16px;
    color: var(--auth-text);
    font: inherit;
    font-size: 22px;
    background: #fff;
    border: 1.5px solid var(--auth-border);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input::placeholder {
    color: #aaa6b8;
}

.auth-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px rgba(129, 69, 216, 0.14);
}

/* Latin / numeric values are typed left-to-right but should sit on the right edge. */
.auth-input[dir="ltr"] {
    text-align: right;
}

.auth-input[dir="ltr"]::placeholder {
    text-align: right;
}

.auth-select {
    appearance: none;
    padding-inline-end: 40px;
    background: #fff url("../images/icons/arrow-down.svg") no-repeat left 14px center / 14px;
}

.auth-input--otp {
    height: 68px;
    font-size: 38px;
    font-weight: 700;
    letter-spacing: 0.5em;
    text-align: center !important;
}

.auth-input--otp::placeholder {
    letter-spacing: 0.3em;
    text-align: center !important;
}

.auth-input--toggle {
    padding-inline-end: 48px;
}

.auth-toggle {
    position: absolute;
    inset-block: 0;
    inset-inline-end: 4px;
    display: grid;
    place-items: center;
    width: 44px;
    color: var(--auth-muted);
    font-size: 22px;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.auth-toggle:hover,
.auth-toggle[aria-pressed="true"] {
    color: var(--auth-primary);
}

.auth-hint {
    margin: 6px 0 0;
    color: var(--auth-muted);
    font-size: 19px;
}

.auth-error {
    min-height: 0;
    margin: 6px 0 0;
    color: var(--auth-danger);
    font-size: 19px;
}

.auth-error:empty {
    display: none;
}

.auth-field.has-error .auth-input {
    border-color: var(--auth-danger);
}

.auth-field.has-error .auth-input:focus {
    box-shadow: 0 0 0 4px rgba(209, 42, 69, 0.14);
}

.auth-field.has-error .auth-hint {
    display: none;
}

/* ---------- Rows, links, text ---------- */

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 20px;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
}

.auth-check input {
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: var(--auth-primary);
}

.auth-link {
    padding: 0;
    color: var(--auth-primary);
    font: inherit;
    font-weight: 400;
    background: none;
    border: 0;
    text-decoration: none;
    cursor: pointer;
}

.auth-link:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

.auth-link:disabled {
    color: var(--auth-muted);
    font-weight: 400;
    text-decoration: none;
    cursor: default;
}

.auth-switch {
    margin: 20px 0 0;
    color: var(--auth-muted);
    font-size: 20px;
    text-align: center;
}

.auth-terms {
    margin: 14px 0 0;
    color: var(--auth-muted);
    font-size: 19px;
    text-align: center;
}

.auth-terms a {
    color: var(--auth-primary);
}

/* ---------- Alerts ---------- */

.auth-alert {
    margin-bottom: 16px;
    padding: 10px 14px;
    font-size: 20px;
    border-radius: 10px;
}

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

.auth-alert--error {
    color: var(--auth-danger);
    background: var(--auth-danger-tint);
}

.auth-alert--success {
    color: var(--auth-success);
    background: var(--auth-success-tint);
}

/* ---------- Button ---------- */

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 56px;
    color: #fff;
    font: inherit;
    font-size: 24px;
    font-weight: 700;
    background: var(--auth-primary);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.auth-btn:hover {
    background: var(--auth-primary-dark);
}

.auth-btn:active {
    transform: translateY(1px);
}

.auth-btn:focus-visible {
    outline: 3px solid rgba(129, 69, 216, 0.35);
    outline-offset: 2px;
}

.auth-btn:disabled,
.auth-btn.is-loading {
    cursor: progress;
    opacity: 0.85;
    pointer-events: none;
}

.auth-btn__spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}

.auth-btn.is-loading .auth-btn__spinner {
    display: block;
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-btn__spinner {
        animation-duration: 2s;
    }
}

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
    .auth-modal .modal-dialog {
        margin-inline: 12px;
    }

    .auth-modal .modal-content.auth,
    .auth-card {
        padding: 28px 20px 22px;
    }

    .auth-title {
        font-size: 32px;
    }

    /* 16px+ stops iOS from zooming into the field */
    .auth-input {
        font-size: 22px;
    }
}
