/* Auth pages - centered card layout, works on all screen sizes */

.auth-page {
    min-height: calc(100vh - 220px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(32px, 6vw, 72px) var(--sp-4);
    background: var(--c-bg);
}

.auth-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .08);
    padding: clamp(28px, 4vw, 40px);
    width: 100%;
    max-width: 460px;
}

.auth-card--register {
    max-width: 540px;
}

.auth-title {
    font-size: var(--text-2xl);
    font-weight: var(--fw-bold);
    text-align: center;
    color: var(--c-text);
    margin-bottom: var(--sp-1);
}

.auth-subtitle {
    font-size: var(--text-sm);
    color: var(--c-text-muted);
    text-align: center;
    margin-bottom: var(--sp-6);
}

.auth-form {
    display: grid;
    gap: var(--sp-4);
    margin-top: var(--sp-5);
}

.auth-form .form-group {
    margin: 0;
}

/* Turnstile widget full width */
.cf-turnstile {
    margin-top: var(--sp-4);
}

.cf-turnstile iframe {
    width: 100% !important;
    max-width: 100%;
}

.auth-submit {
    margin-top: var(--sp-1);
}

.auth-channel-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-2);
}

.auth-channel-options--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-channel-option {
    position: relative;
    min-width: 0;
}

.auth-channel-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.auth-channel-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-1);
    min-height: 44px;
    padding: var(--sp-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    background: var(--c-surface);
    color: var(--c-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.auth-channel-option svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.auth-channel-option input:checked + span {
    border-color: rgba(var(--c-primary-rgb), .55);
    background: rgba(var(--c-primary-rgb), .08);
    color: var(--c-text);
}

.auth-channel-option input:focus-visible + span {
    outline: 2px solid rgba(var(--c-primary-rgb), .34);
    outline-offset: 2px;
}

.auth-error {
    background: var(--c-error-light);
    color: var(--c-error);
    border-radius: var(--r-sm);
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--text-sm);
    margin-bottom: var(--sp-3);
    display: none;
}

.auth-success {
    background: var(--c-success-light);
    color: var(--c-success);
    border-radius: var(--r-sm);
    padding: var(--sp-4);
    font-size: var(--text-sm);
    text-align: center;
}

.auth-message {
    border-radius: var(--r-sm);
    padding: var(--sp-4);
    font-size: var(--text-sm);
    text-align: center;
    line-height: 1.5;
}

.auth-message--success {
    background: var(--c-success-light);
    color: var(--c-success);
}

.auth-message--error {
    background: var(--c-error-light);
    color: var(--c-error);
}

.auth-footer {
    text-align: center;
    margin-top: var(--sp-4);
    font-size: var(--text-sm);
    color: var(--c-text-muted);
}

.auth-footer--compact {
    margin-top: var(--sp-2);
}

.auth-footer a {
    color: var(--c-primary);
    font-weight: var(--fw-medium);
}

.auth-links {
    display: grid;
    gap: var(--sp-3);
    margin-top: var(--sp-5);
    text-align: center;
}

.auth-links__muted {
    justify-self: center;
    color: var(--c-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    text-decoration: none;
    transition: color var(--t-fast) var(--ease);
}

.auth-links__muted:hover {
    color: var(--c-text);
}

.auth-links__back {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
}

.auth-links__back svg {
    width: 15px;
    height: 15px;
}

.auth-links__signup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    justify-self: center;
    min-height: 42px;
    padding: var(--sp-2) var(--sp-4);
    border: 1px solid rgba(var(--c-primary-rgb), .16);
    border-radius: 999px;
    background: rgba(var(--c-primary-rgb), .045);
    color: var(--c-text-muted);
    font-size: var(--text-sm);
}

.auth-links__signup a {
    color: var(--c-primary);
    font-weight: var(--fw-semibold);
    text-decoration: none;
}

.auth-links__signup a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.form-label-hint {
    margin-left: var(--sp-1);
    color: var(--c-text-muted);
    font-size: var(--text-xs);
    font-weight: var(--fw-regular);
}

.auth-phone-row {
    display: flex;
    gap: var(--sp-2);
}

.auth-country-select {
    width: 100px;
    flex-shrink: 0;
}

.auth-terms {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-2);
    color: var(--c-text-muted);
    font-size: var(--text-sm);
    line-height: 1.45;
}

.auth-terms__check {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--c-primary);
}

.auth-terms a {
    color: var(--c-text);
    font-weight: var(--fw-medium);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Password toggle */
.input-password-wrap {
    position: relative;
}

.input-password-wrap .form-input {
    padding-right: 44px;
}

.btn-toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--c-text-muted);
    padding: var(--sp-1);
    line-height: 0;
}

.btn-toggle-password:hover {
    color: var(--c-text);
}

.btn-toggle-password svg {
    width: 18px;
    height: 18px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin: var(--sp-5) 0 var(--sp-4);
    color: var(--c-text-muted);
    font-size: var(--text-xs);
    font-weight: var(--fw-medium);
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--c-border);
}

.auth-google {
    display: grid;
    justify-items: center;
    min-height: 44px;
}

.auth-google__button {
    display: flex;
    justify-content: center;
    width: 100%;
}

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

.auth-phone-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: grid;
    place-items: center;
    padding: var(--sp-4);
}

.auth-phone-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .46);
    backdrop-filter: blur(10px);
}

.auth-phone-modal__box {
    position: relative;
    width: min(100%, 420px);
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: var(--r-lg);
    box-shadow: 0 30px 90px rgba(15, 23, 42, .28);
    padding: var(--sp-6);
}

.auth-phone-modal__title {
    margin: 0 0 var(--sp-2);
    font-size: var(--text-xl);
    color: var(--c-text);
}

.auth-phone-modal__text {
    margin: 0 0 var(--sp-4);
    color: var(--c-text-muted);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.auth-phone-modal__hint {
    margin: var(--sp-2) 0 0;
    color: var(--c-text-muted);
    font-size: var(--text-xs);
    line-height: 1.45;
}

.auth-phone-modal__error {
    min-height: 1.25rem;
    margin: var(--sp-2) 0 var(--sp-3);
    color: var(--c-error);
    font-size: var(--text-sm);
}

.auth-modal-open {
    overflow: hidden;
}

@media (max-width: 520px) {
    .auth-page {
        min-height: auto;
        padding: var(--sp-5) var(--sp-3);
    }

    .auth-card {
        padding: var(--sp-5);
        border-radius: 16px;
        box-shadow: 0 14px 34px rgba(15, 23, 42, .07);
    }

    .auth-phone-row {
        display: grid;
        grid-template-columns: 104px minmax(0, 1fr);
    }

    .auth-channel-options {
        grid-template-columns: 1fr;
    }

    .auth-country-select {
        width: 100%;
    }
}
