/* ================================================================
   auth.css — единые стили страниц авторизации (v1)
   Используется: register / login / forgot / reset / verify
   ================================================================ */

.auth-page {
    min-height: calc(100vh - 220px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2.5rem 1rem 6rem;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: linear-gradient(180deg, var(--bg-panel, #12121f), var(--bg-card, #12121f));
    border: 1px solid var(--border, #2a2a40);
    border-radius: 20px;
    padding: 2.2rem 2rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
    position: relative;
    overflow: hidden;
}

/* Светящаяся линия сверху карточки */
.auth-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #7a6aff, #00e6ff, transparent);
}

.auth-title {
    font-size: 1.65rem;
    font-weight: 800;
    text-align: center;
    margin: 0 0 .35rem;
    background: linear-gradient(90deg, #7a6aff, #00e6ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1.25;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted, #aaa);
    font-size: .93rem;
    margin: 0 0 1.6rem;
    line-height: 1.5;
}

/* ==================== Поля ==================== */

.form-field { margin-bottom: 1.15rem; }

.form-field > label {
    display: block;
    margin-bottom: .45rem;
    font-weight: 600;
    font-size: .88rem;
    color: var(--text-muted, #aaa);
}

.input-wrap { position: relative; }

.input-wrap input {
    width: 100%;
    padding: .85rem 1rem;
    border: 1px solid var(--border, #2a2a40);
    border-radius: 12px;
    background: var(--bg, #0a0a12);
    color: #fff;
    font-size: 16px; /* 16px — iOS не зумит при фокусе */
    font-family: inherit;
    min-height: 48px;
    transition: border-color .2s, box-shadow .2s;
}

.input-wrap input::placeholder { color: #55556d; }

.input-wrap input:focus {
    outline: none;
    border-color: #7a6aff;
    box-shadow: 0 0 0 3px rgba(122, 106, 255, .18);
}

.form-field.invalid .input-wrap input {
    border-color: #ff5464;
    box-shadow: 0 0 0 3px rgba(255, 84, 100, .12);
}

.form-field.valid .input-wrap input { border-color: #2ee6a8; }

.input-wrap.has-toggle input { padding-right: 3.2rem; }

/* Текст ошибки под полем */
.field-error {
    display: none;
    color: #ff8a94;
    font-size: .83rem;
    margin-top: .45rem;
    line-height: 1.4;
    align-items: flex-start;
    gap: .35rem;
}
.field-error::before { content: "⚠"; flex: none; }
.form-field.invalid .field-error { display: flex; }

/* Динамические заметки (email свободен/занят, пароли совпадают…) */
.field-note {
    font-size: .8rem;
    margin-top: .4rem;
    color: var(--text-muted, #aaa);
    min-height: 1.1em;
    transition: color .2s;
}
.field-note.ok  { color: #2ee6a8; }
.field-note.bad { color: #ff8a94; }

/* ==================== Кнопка «показать пароль» ==================== */

.toggle-pass {
    position: absolute;
    right: .45rem;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #7f7f99;
    cursor: pointer;
    transition: color .2s, background .2s;
}
.toggle-pass:hover { color: #00e6ff; background: rgba(122, 106, 255, .1); }
.toggle-pass svg { width: 20px; height: 20px; }

/* ==================== Индикатор надёжности ==================== */

.strength { display: flex; gap: 6px; margin-top: .65rem; }
.strength i {
    height: 4px; flex: 1;
    border-radius: 2px;
    background: #26263c;
    transition: background .25s;
}
.strength[data-score="1"] i:nth-child(-n+1) { background: #ff5464; }
.strength[data-score="2"] i:nth-child(-n+2) { background: #ffb020; }
.strength[data-score="3"] i:nth-child(-n+3) { background: #7dd956; }
.strength[data-score="4"] i:nth-child(-n+4) { background: #2ee6a8; }

.strength-label {
    font-size: .78rem;
    color: var(--text-muted, #aaa);
    margin-top: .35rem;
    min-height: 1em;
}

.req-list {
    list-style: none;
    margin: .65rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .35rem .8rem;
}
.req-list li {
    font-size: .8rem;
    color: #7f7f99;
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    transition: color .2s;
}
.req-list li::before { content: "○"; font-size: .75rem; }
.req-list li.ok { color: #2ee6a8; }
.req-list li.ok::before { content: "✓"; }

/* ==================== Чекбоксы согласий ==================== */

.consent {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .6rem .7rem;
    margin-bottom: .55rem;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    min-height: 44px; /* тач-цель */
    transition: background .2s, border-color .2s;
}
.consent:hover { background: rgba(122, 106, 255, .06); }
.consent input[type="checkbox"] {
    width: 20px; height: 20px;
    min-width: 20px;
    margin: 2px 0 0;
    accent-color: #7a6aff;
    cursor: pointer;
}
.consent span { font-size: .87rem; color: var(--text-muted, #aaa); line-height: 1.45; }
.consent a { color: #7a6aff; text-decoration: underline; text-underline-offset: 2px; }
.consent.invalid {
    border-color: rgba(255, 84, 100, .55);
    background: rgba(255, 84, 100, .06);
}
.consent .consent-error {
    display: none;
    color: #ff8a94;
    font-size: .8rem;
    margin-top: .3rem;
}
.consent.invalid .consent-error { display: block; }

/* ==================== Алерты ==================== */

.alert {
    padding: .9rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    font-size: .9rem;
    line-height: 1.5;
    display: flex;
    gap: .6rem;
    align-items: flex-start;
}
.alert-error {
    background: rgba(255, 84, 100, .1);
    border: 1px solid rgba(255, 84, 100, .35);
    color: #ff8a94;
}
.alert-success {
    background: rgba(46, 230, 168, .08);
    border: 1px solid rgba(46, 230, 168, .35);
    color: #7ef0c4;
}
.alert-info {
    background: rgba(0, 230, 255, .07);
    border: 1px solid rgba(0, 230, 255, .3);
    color: #8ce9f7;
}

/* ==================== Кнопки ==================== */

.btn-auth {
    width: 100%;
    padding: .95rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(90deg, #7a6aff, #5a6bff);
    color: #fff;
    font-size: 1.02rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    min-height: 50px;
    position: relative;
    transition: transform .15s, box-shadow .25s, opacity .2s;
}
.btn-auth:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(122, 106, 255, .4); }
.btn-auth:active { transform: translateY(0); }
.btn-auth:disabled { opacity: .65; cursor: wait; transform: none; }
.btn-auth.loading { color: transparent; pointer-events: none; }
.btn-auth.loading::after {
    content: "";
    position: absolute;
    left: 50%; top: 50%;
    width: 20px; height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin .7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    width: 100%;
    padding: .8rem;
    border-radius: 12px;
    border: 1px solid var(--border, #2a2a40);
    background: transparent;
    color: var(--text-muted, #aaa);
    font-size: .92rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    min-height: 46px;
    transition: border-color .2s, color .2s, background .2s;
}
.btn-ghost:hover:not(:disabled) { border-color: #7a6aff; color: #fff; background: rgba(122, 106, 255, .08); }
.btn-ghost:disabled { opacity: .6; cursor: wait; }

/* ==================== Разное ==================== */

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    font-size: .9rem;
    color: var(--text-muted, #aaa);
    line-height: 1.8;
}
.auth-links a { color: #7a6aff; font-weight: 600; }
.auth-links a:hover { color: #00e6ff; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin: 1.3rem 0;
    color: #55556d;
    font-size: .8rem;
}
.auth-divider::before, .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border, #2a2a40);
}

.capslock {
    display: none;
    margin-top: .45rem;
    font-size: .8rem;
    color: #ffd166;
    align-items: center;
    gap: .35rem;
}
.form-field.capslock-on .capslock { display: flex; }

.success-icon {
    width: 76px; height: 76px;
    margin: .5rem auto 1.1rem;
    border-radius: 50%;
    background: rgba(46, 230, 168, .12);
    border: 1px solid rgba(46, 230, 168, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
}

.error-icon {
    width: 76px; height: 76px;
    margin: .5rem auto 1.1rem;
    border-radius: 50%;
    background: rgba(255, 84, 100, .1);
    border: 1px solid rgba(255, 84, 100, .4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
}

/* Honeypot — скрытое поле-ловушка для ботов */
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px; height: 1px;
    opacity: 0;
    overflow: hidden;
}

/* Тряска поля при ошибке отправки */
.form-field.shake { animation: auth-shake .4s; }
@keyframes auth-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-7px); }
    40% { transform: translateX(7px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.resend-status { font-size: .85rem; margin-top: .6rem; text-align: center; min-height: 1.2em; }
.resend-status.ok { color: #2ee6a8; }
.resend-status.bad { color: #ff8a94; }

/* ==================== Мобильная версия ==================== */

@media (max-width: 600px) {
    .auth-page { padding: 1.2rem .85rem 6.5rem; } /* отступ под нижнюю навигацию */
    .auth-card { padding: 1.6rem 1.2rem; border-radius: 16px; }
    .auth-title { font-size: 1.4rem; }
    .req-list { grid-template-columns: 1fr; }
}

/* Уважение к пользователям без анимаций */
@media (prefers-reduced-motion: reduce) {
    .auth-card *, .btn-auth, .form-field { animation: none !important; transition: none !important; }
}