/* ===================================================================
   auth-modal.css — Единая стилизация auth-модалок (signin, signup, pass reset)
   Дизайн-система OND: #12294B / #3657CD / border-radius 16px
   Bootstrap modal JS сохранён — переопределяем только внешний вид.
   =================================================================== */

/* ── Modal container ─────────────────────────────────────────────── */
.auth-modal .modal-dialog {
    max-width: 440px;
    margin: 80px auto;
}

.auth-modal .modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(18, 41, 75, 0.18);
    padding: 0;
    overflow: hidden;
}

.auth-modal .modal-header,
.auth-modal .modal-body,
.auth-modal .modal-footer {
    border: none;
    padding: 0;
}

/* ── Inner wrapper ───────────────────────────────────────────────── */
.auth-modal-inner {
    padding: 40px 36px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Title ────────────────────────────────────────────────────────── */
.auth-modal-title {
    font-size: 26px;
    font-weight: 700;
    color: #12294B;
    text-align: center;
    margin: 0;
    line-height: 1.2;
}

/* ── Form groups ─────────────────────────────────────────────────── */
.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form-check {
    display: flex;
    align-items: center;
}

.auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #12294B;
    user-select: none;
}

.auth-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.auth-label {
    font-size: 14px;
    font-weight: 600;
    color: #12294B;
}

/* ── Inputs ───────────────────────────────────────────────────────── */
.auth-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1.5px solid #e0e6ee;
    border-radius: 10px;
    font-size: 15px;
    color: #12294B;
    background: #f8f9fb;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.auth-input:focus {
    outline: none;
    border-color: #3657CD;
    box-shadow: 0 0 0 3px rgba(54, 87, 205, 0.12);
    background: #fff;
}

.auth-input::placeholder {
    color: #9aa5b4;
    font-weight: 400;
}

.auth-input.field-invalid {
    border-color: #e53935;
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.10);
}

/* ── Password wrapper ─────────────────────────────────────────────── */
.auth-password-wrap {
    position: relative;
}

.auth-password-wrap .auth-input {
    padding-right: 48px;
}

.auth-password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #9aa5b4;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-password-toggle:hover {
    color: #3657CD;
}

.auth-password-toggle svg {
    width: 22px;
    height: 22px;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, opacity 0.2s;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
}

.auth-btn--primary {
    background: linear-gradient(135deg, #3657CD 0%, #12294B 100%);
    color: #fff;
}

.auth-btn--primary:hover {
    box-shadow: 0 4px 16px rgba(54, 87, 205, 0.3);
}

.auth-btn--primary:active {
    opacity: 0.9;
}

.auth-btn--primary:disabled {
    background: #9aa5b4;
    cursor: not-allowed;
    box-shadow: none;
}

.auth-btn--secondary {
    background: #f0f2f7;
    color: #12294B;
}

.auth-btn--secondary:hover {
    background: #e0e6ee;
}

.auth-btn--secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-btn--sm {
    height: 40px;
    font-size: 14px;
    border-radius: 8px;
}

/* ── Error messages ───────────────────────────────────────────────── */
.auth-error {
    color: #e53935;
    font-size: 13px;
    min-height: 18px;
}

.auth-info {
    color: #2e7d32;
    font-size: 14px;
    text-align: center;
}

.auth-hint {
    color: #e53935;
    font-size: 14px;
    text-align: center;
}

/* ── Divider ──────────────────────────────────────────────────────── */
.auth-divider {
    height: 1px;
    background: #e0e6ee;
    border: none;
    margin: 4px 0;
}

/* ── Footer links ─────────────────────────────────────────────────── */
.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0 0 8px;
}

.auth-footer-link {
    color: #3657CD;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    padding: 8px 16px;
    transition: color 0.2s;
    cursor: pointer;
}

.auth-footer-link:hover {
    color: #12294B;
    text-decoration: underline;
}

.auth-footer-sep {
    width: 1px;
    height: 20px;
    background: #e0e6ee;
}

/* ── Consent text ─────────────────────────────────────────────────── */
.auth-consent-text {
    font-size: 13px;
    color: #5a6a7e;
    line-height: 1.5;
}

.auth-consent-text a {
    color: #3657CD;
    text-decoration: underline;
}

.auth-consent-text a:hover {
    color: #12294B;
}

/* ── Countdown ────────────────────────────────────────────────────── */
.auth-countdown {
    text-align: center;
    font-size: 13px;
    color: #5a6a7e;
}

/* ── Code step (signup) ───────────────────────────────────────────── */
.auth-code-step {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-code-hint {
    text-align: center;
    font-size: 14px;
    color: #5a6a7e;
}

.auth-resend-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* ── Turnstile CAPTCHA ────────────────────────────────────────────── */
.auth-captcha {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 4px 0;
}
.auth-captcha .cf-turnstile {
    transform: scale(0.85);
    transform-origin: center center;
}
.turnstile-warning {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.turnstile-warning > div {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 8px;
    font-size: 13px;
    color: #664d03;
    line-height: 1.45;
    word-wrap: break-word;
}
.turnstile-warning-list {
    margin: 6px 0 8px;
    padding-left: 20px;
}
.turnstile-warning-list li {
    margin-bottom: 2px;
}
.turnstile-warning-body code {
    background: rgba(102, 77, 3, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    color: #664d03;
    word-break: break-all;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .auth-modal .modal-dialog {
        margin: 20px 12px;
        max-width: none;
    }

    .auth-modal-inner {
        padding: 28px 20px 24px;
        gap: 20px;
    }

    .auth-modal-title {
        font-size: 22px;
    }
}

/* ── Phone input component ───────────────────────────────────────── */
.phone-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Country selector */
.phone-country-select {
    position: relative;
    flex-shrink: 0;
}

.phone-country-selected {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 38px;
    padding: 0 6px;
    border: 1.5px solid #e0e6ee;
    border-radius: 8px;
    background: #f8f9fb;
    cursor: pointer;
    font-size: 13px;
    color: #12294B;
    transition: border-color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.phone-country-selected:hover,
.phone-country-selected:focus {
    border-color: #3657CD;
    box-shadow: 0 0 0 3px rgba(54, 87, 205, 0.12);
    outline: none;
}

.phone-country-flag {
    font-size: 18px;
    line-height: 1;
}

.phone-country-code {
    font-weight: 600;
    font-size: 14px;
    color: #12294B;
}

.phone-country-name {
    font-size: 13px;
    color: #5a6a7e;
}

.phone-chevron {
    width: 10px;
    height: 10px;
    color: #9aa5b4;
    margin-left: 2px;
    flex-shrink: 0;
}

/* Dropdown list */
.phone-country-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1050;
    min-width: 180px;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1.5px solid #e0e6ee;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(18, 41, 75, 0.14);
    padding: 4px 0;
}

.phone-country-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
}

.phone-country-item:hover {
    background: #f0f2f7;
}

/* Digit boxes container */
.phone-digits-container {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.phone-digit-group {
    display: flex;
    gap: 2px;
}

.phone-digit-box {
    width: 28px;
    height: 38px;
    border: 1.5px solid #e0e6ee;
    border-radius: 7px;
    background: #f8f9fb;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #12294B;
    caret-color: #3657CD;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    padding: 0;
    outline: none;
    box-sizing: border-box;
}

.phone-digit-box:focus {
    border-color: #3657CD;
    box-shadow: 0 0 0 3px rgba(54, 87, 205, 0.12);
    background: #fff;
}

.phone-digit-box.filled {
    background: #fff;
    border-color: #c8d0dc;
}

/* Invalid state */
.phone-input-wrap.field-invalid .phone-digit-box {
    border-color: #e53935;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.10);
}

/* Responsive: shrink boxes on small screens */
@media (max-width: 480px) {
    .phone-digit-box {
        width: 24px;
        height: 34px;
        font-size: 14px;
        border-radius: 5px;
    }

    .phone-digits-container {
        gap: 3px;
    }

    .phone-digit-group {
        gap: 1px;
    }

    .phone-country-selected {
        height: 34px;
        padding: 0 5px;
        font-size: 12px;
    }

    .phone-country-flag {
        font-size: 15px;
    }
}

/* Underscore-стиль на узких экранах (≤395px).
   На iPhone SE / Android compact 10 ячеек 24px не помещаются —
   overflow ~22px ровно последняя ячейка. Заменяем filled-боксы
   на тонкую underscore-линию: компактнее, читабельнее цифры
   (font 15px вместо 14px), освобождает ~57px горизонтали. */
@media (max-width: 395px) {
    .phone-digit-box {
        width: 18px;
        height: 30px;
        border: none;
        border-bottom: 2px solid #c8d0dc;
        border-radius: 0;
        background: transparent;
        font-size: 15px;
        padding: 0;
    }

    .phone-digit-box:focus {
        border-bottom-color: #3657CD;
        box-shadow: none;
        background: transparent;
    }

    .phone-digit-box.filled {
        background: transparent;
        border-bottom-color: #3657CD;
    }

    .phone-input-wrap.field-invalid .phone-digit-box {
        border-bottom-color: #e53935;
        box-shadow: none;
    }

    .phone-digit-group { gap: 3px; }
    .phone-digits-container { gap: 6px; }

    /* +12px к доступной горизонтали (20→14px) — запас для country-selector */
    .auth-modal-inner { padding: 24px 14px 20px; }
}

/* ── Utility classes ─────────────────────────────────────────────── */
.auth-mt-8 { margin-top: 8px; }
.auth-mt-16 { margin-top: 16px; }
.auth-text-center { text-align: center; }
.auth-btn--full { width: 100%; }
.auth-divider--full { width: 100%; }
