/* Страницы входа, регистрации и восстановления пароля.
   Всё внутри .hm-auth; поля и кнопки берут hm-input, hm-label, hm-btn из дизайн-системы. */

.hm-auth {
    background: var(--hm-ivory);
    padding: var(--hm-sp-7) 0;
}

.hm-auth__card {
    position: relative;
    max-width: 440px;
    margin: 0 auto;
    background: var(--hm-surface);
    border: 1px solid var(--hm-border);
    border-radius: var(--hm-r-xl);
    box-shadow: var(--hm-sh-lg);
    padding: var(--hm-sp-6);
    overflow: hidden;
}

.hm-auth__card::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--hm-bronze), transparent);
}

.hm-auth__head {
    text-align: center;
    margin-bottom: var(--hm-sp-5);
}

.hm-auth .hm-eyebrow {
    justify-content: center;
}

.hm-auth__title {
    font-family: var(--hm-display);
    font-size: var(--hm-fs-h2);
    font-weight: 400;
    line-height: 1.15;
    color: var(--hm-text-strong);
    margin: var(--hm-sp-3) 0 var(--hm-sp-2);
}

.hm-auth__title em {
    font-style: italic;
    color: var(--hm-bronze-text);
}

.hm-auth__sub {
    font-size: var(--hm-fs-sm);
    color: var(--hm-muted);
    margin: 0;
}

.hm-auth__hint,
.hm-auth .form-hint {
    font-size: var(--hm-fs-xs);
    color: var(--hm-muted-light);
    margin: var(--hm-sp-2) 0 0;
}

.hm-auth .hm-field {
    margin-bottom: var(--hm-sp-4);
}

.hm-auth__submit {
    margin-top: var(--hm-sp-2);
}

.hm-auth__foot {
    text-align: center;
    margin: var(--hm-sp-5) 0 0;
    font-size: var(--hm-fs-sm);
    color: var(--hm-muted);
}

.hm-auth__foot p {
    margin: 0 0 var(--hm-sp-2);
}

.hm-auth__foot a {
    color: var(--hm-green);
    font-weight: 600;
    text-decoration: none;
}

.hm-auth__foot a:hover {
    text-decoration: underline;
}

/* ===== Сообщения об ошибке и успехе (JS ставит классы show + error/success) ===== */
.hm-auth .message,
.hm-auth .auth-msg {
    display: none;
    font-size: var(--hm-fs-sm);
    border-radius: var(--hm-r);
    padding: 10px 14px;
    margin-bottom: var(--hm-sp-4);
}

.hm-auth .message.show,
.hm-auth .auth-msg.show {
    display: block;
}

.hm-auth .message.error,
.hm-auth .auth-msg.error {
    color: var(--hm-danger);
    background: var(--hm-danger-soft);
}

.hm-auth .message.success,
.hm-auth .auth-msg.success {
    color: var(--hm-success);
    background: var(--hm-success-soft);
}

/* ===== Шаги ===== */
.hm-auth .step {
    display: none;
}

.hm-auth .step.active {
    display: block;
}

.hm-auth .step-indicator {
    position: relative;
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--hm-sp-5);
}

.hm-auth .step-indicator::before {
    content: '';
    position: absolute;
    top: 11px;
    left: 16%;
    right: 16%;
    height: 2px;
    background: var(--hm-ivory-3);
}

.hm-auth .step-dot {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.hm-auth .step-dot .circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--hm-surface);
    border: 2px solid var(--hm-border);
    transition: all var(--hm-t) var(--hm-ease-out);
}

.hm-auth .step-dot.active .circle {
    border-color: var(--hm-green);
    box-shadow: 0 0 0 4px var(--hm-green-soft-2);
}

.hm-auth .step-dot.done .circle {
    background: var(--hm-green);
    border-color: var(--hm-green);
}

.hm-auth .step-dot .label {
    font-size: var(--hm-fs-label);
    font-weight: 600;
    letter-spacing: var(--hm-ls-label);
    text-transform: uppercase;
    color: var(--hm-muted-light);
}

.hm-auth .step-dot.active .label,
.hm-auth .step-dot.done .label {
    color: var(--hm-green);
}

.hm-auth .phone-display,
.hm-auth #prPhoneDisplay {
    text-align: center;
    font-family: var(--hm-display);
    font-size: 1.25rem;
    color: var(--hm-green);
    margin-bottom: var(--hm-sp-4);
}

/* ===== Код из SMS: 4 ячейки ===== */
.hm-auth .code-inputs,
.hm-auth .auth-code-inputs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: var(--hm-sp-2);
}

.hm-auth .code-input,
.hm-auth .auth-code {
    width: 60px;
    height: 68px;
    text-align: center;
    font-family: var(--hm-display);
    font-size: 1.75rem;
    color: var(--hm-text-strong);
    background: var(--hm-surface);
    border: 1px solid var(--hm-border);
    border-radius: var(--hm-r-lg);
    transition: border-color var(--hm-t-fast), box-shadow var(--hm-t-fast);
}

.hm-auth .code-input:focus,
.hm-auth .auth-code:focus {
    outline: none;
    border-color: var(--hm-green);
    box-shadow: 0 0 0 3px var(--hm-green-soft-2);
}

.hm-auth .code-input:disabled,
.hm-auth .auth-code:disabled {
    background: var(--hm-ivory-2);
}

.hm-auth .timer-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: var(--hm-sp-4) 0;
    font-size: var(--hm-fs-sm);
    color: var(--hm-muted);
}

.hm-auth .timer-section .gold {
    font-weight: 600;
    color: var(--hm-green);
}

.hm-auth .resend-btn {
    display: none;
    background: none;
    border: 0;
    padding: 0;
    color: var(--hm-bronze-text);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.hm-auth .resend-btn.show {
    display: inline-block;
}

/* ===== Соглашение ===== */
.hm-auth .terms-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: var(--hm-sp-4) 0 var(--hm-sp-3);
    font-size: var(--hm-fs-sm);
    color: var(--hm-text);
}

.hm-auth .terms-checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--hm-green);
    flex-shrink: 0;
}

.hm-auth .terms-checkbox-wrapper a {
    color: var(--hm-bronze-text);
    font-weight: 600;
}

.hm-auth .terms-error {
    display: none;
    font-size: var(--hm-fs-sm);
    color: var(--hm-danger);
    background: var(--hm-danger-soft);
    border-radius: var(--hm-r);
    padding: 8px 12px;
    margin-bottom: var(--hm-sp-3);
}

.hm-auth .terms-error.show {
    display: block;
}

.hm-auth__exists {
    display: none;
    font-size: var(--hm-fs-sm);
    color: var(--hm-text);
    background: var(--hm-green-soft);
    border: 1px solid var(--hm-green-line);
    border-radius: var(--hm-r);
    padding: 10px 14px;
    margin-bottom: var(--hm-sp-4);
}

.hm-auth__exists a {
    color: var(--hm-green);
    font-weight: 600;
}

.hm-auth .back-link {
    margin-top: var(--hm-sp-3);
}

/* ===== Модальное окно соглашения ===== */
#termsModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: var(--hm-z-modal);
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(18, 24, 21, 0.55);
}

#termsModal.show {
    display: flex;
}

#termsModal .modal-content {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--hm-surface);
    border-radius: var(--hm-r-xl);
    box-shadow: var(--hm-sh-lg);
    padding: var(--hm-sp-6);
}

#termsModal .modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: 0;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--hm-muted);
    cursor: pointer;
}

#termsModal .modal-title {
    font-family: var(--hm-display);
    font-size: var(--hm-fs-h3);
    color: var(--hm-text-strong);
    margin: 0;
}

#termsModal .modal-divider {
    width: 48px;
    height: 2px;
    background: var(--hm-bronze);
    margin: var(--hm-sp-3) 0 var(--hm-sp-4);
}

#termsModal .modal-text {
    font-size: var(--hm-fs-sm);
    color: var(--hm-muted);
    line-height: 1.6;
}

#termsModal .modal-text h3 {
    font-size: var(--hm-fs-body);
    color: var(--hm-text-strong);
    margin: var(--hm-sp-4) 0 var(--hm-sp-2);
}

#termsModal .modal-footer {
    margin-top: var(--hm-sp-5);
    text-align: right;
}

@media (max-width: 575.98px) {
    .hm-auth {
        padding: var(--hm-sp-5) 0;
    }

    .hm-auth__card {
        padding: var(--hm-sp-5) var(--hm-sp-4);
        border-radius: var(--hm-r-lg);
    }

    .hm-auth .code-input,
    .hm-auth .auth-code {
        width: 52px;
        height: 60px;
    }
}
