/* ═══════════════════════════════════════════════════════════════
   КОМПАНЬОН — Auth pages (login / register / verify)
   Единый стиль на дизайн-токенах. Светлая тема по умолчанию,
   тёмная — автоматически через html.dark (design-tokens.css).
   ═══════════════════════════════════════════════════════════════ */

/* ─── PAGE ─── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-sans);
    position: relative;
    overflow-x: hidden;
}
/* Мягкий фоновый акцент (без внешних картинок) */
.auth-page::before,
.auth-page::after {
    content: '';
    position: fixed;
    width: 42vw;
    height: 42vw;
    max-width: 560px;
    max-height: 560px;
    border-radius: 9999px;
    filter: blur(90px);
    z-index: 0;
    pointer-events: none;
}
.auth-page::before {
    top: -12%;
    left: -8%;
    background: var(--accent-ghost);
}
.auth-page::after {
    bottom: -14%;
    right: -10%;
    background: var(--accent2-ghost);
}

.auth-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
}

/* ─── HEADER (logo + title) ─── */
.auth-head {
    text-align: center;
    margin-bottom: 28px;
}
.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--brand), var(--accent));
    color: #fff;
    font-weight: 900;
    font-size: 24px;
    box-shadow: var(--shadow-lg);
    animation: authLogoIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.auth-title {
    margin: 14px 0 2px;
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.auth-subtitle {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}
.auth-ai-badge {
    display: inline-block;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.5px;
    line-height: 1.3;
    color: #fff;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--brand), var(--accent2), var(--accent));
    box-shadow: 0 0 8px var(--accent2-ghost);
}

/* ─── CARD ─── */
.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    padding: 28px 24px;
}
@media (min-width: 640px) {
    .auth-card { padding: 32px; }
}
.auth-card .dv-btn { width: 100%; }

/* Иконка-хедер карточки */
.auth-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
    border-radius: var(--radius-xl);
    font-size: 22px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    box-shadow: var(--shadow-md);
}
.auth-icon.is-success { background: linear-gradient(135deg, var(--success), var(--accent)); }
.auth-icon.is-brand   { background: linear-gradient(135deg, var(--accent2), var(--brand)); }

/* Пульс-кольцо вокруг иконки (verify) */
.auth-icon-ring { position: relative; }
.auth-icon-ring::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: var(--radius-2xl);
    border: 2px solid var(--accent-ring);
    animation: authRing 2s ease-out infinite;
}

.auth-card-title {
    margin: 0 0 4px;
    font-size: var(--text-lg);
    font-weight: 700;
    text-align: center;
    color: var(--text-heading);
}
.auth-card-sub {
    margin: 0 0 22px;
    font-size: var(--text-sm);
    text-align: center;
    color: var(--text-secondary);
}
.auth-card-sub strong { color: var(--text-primary); font-weight: 700; }

/* ─── FIELDS ─── */
.auth-field { margin-bottom: 16px; }
.auth-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.auth-label .req { color: var(--danger); margin-left: 2px; }

/* Телефон */
.auth-phone {
    display: flex;
    align-items: center;
    height: 52px;
    padding: 0 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}
.auth-phone:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.auth-phone-flag { font-size: 20px; margin-right: 8px; }
.auth-phone-prefix { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.auth-phone-divider { width: 1px; height: 22px; margin: 0 12px; background: var(--border-strong); }
.auth-phone-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}
.auth-phone-input::placeholder { color: var(--text-tertiary); font-weight: 400; letter-spacing: 0; }

/* ─── OTP ─── */
.otp-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 22px;
}
.otp-box {
    width: 58px;
    height: 68px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    outline: none;
    caret-color: var(--accent);
    transition: all var(--transition-fast);
    font-family: var(--font-mono);
}
.otp-box:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.otp-box.filled {
    border-color: var(--success);
    background: var(--success-ghost);
}
.otp-box.error {
    border-color: var(--danger);
    background: var(--danger-ghost);
    animation: authShake 0.5s;
}
@media (max-width: 380px) {
    .otp-box { width: 52px; height: 62px; font-size: 24px; }
    .otp-row { gap: 8px; }
}

/* ─── TIMER / RESEND ─── */
.auth-timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    background: var(--info-ghost);
    border: 1px solid var(--info-light);
    color: var(--info);
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition-fast);
}
.auth-timer.is-urgent {
    background: var(--danger-ghost);
    border-color: var(--danger-light);
    color: var(--danger);
    animation: authPulse 1s ease-in-out infinite;
}

/* ─── LINKS ─── */
.auth-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}
.auth-link:hover { color: var(--accent-hover); }
.auth-link-muted { color: var(--text-tertiary); font-weight: 500; }
.auth-link-muted:hover { color: var(--text-secondary); }
.auth-center { text-align: center; }
.mt-18 { margin-top: 18px; }
.mt-22 { margin-top: 22px; }

/* ─── ERROR ─── */
.auth-error {
    display: none;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--danger-ghost);
    border: 1px solid var(--danger-light);
    color: var(--danger);
    font-size: var(--text-sm);
    text-align: center;
}
.auth-error.is-visible { display: block; }

/* ─── PROGRESS STEPS ─── */
.auth-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}
.auth-step-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg-inset);
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}
.auth-step-dot.is-active {
    background: linear-gradient(135deg, var(--brand), var(--accent));
    color: #fff;
    box-shadow: var(--shadow-md);
}
.auth-step-dot.is-done {
    background: var(--success);
    color: #fff;
}
.auth-step-line {
    width: 34px;
    height: 2px;
    border-radius: 2px;
    background: var(--border-default);
    transition: background var(--transition-fast);
}
.auth-step-line.is-done { background: var(--success); }

/* ─── SECTIONS (requisites) ─── */
.auth-section { margin-bottom: 22px; }
.auth-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}
.auth-section-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    background: var(--accent-ghost);
    color: var(--accent);
    font-size: 14px;
    flex-shrink: 0;
}
.auth-section-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-primary);
}
.auth-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 520px) {
    .auth-grid-2 { grid-template-columns: 1fr; }
}

/* ─── FOOTER ─── */
.auth-footer {
    margin-top: 22px;
    text-align: center;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}
.auth-footer a { color: var(--text-tertiary); text-decoration: none; transition: color var(--transition-fast); }
.auth-footer a:hover { color: var(--text-secondary); }
.auth-footer .sep { margin: 0 8px; }

/* ─── THEME TOGGLE ─── */
.auth-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}
.auth-theme-toggle:hover {
    color: var(--accent);
    border-color: var(--border-strong);
}

/* ─── CAPTCHA ─── */
.auth-captcha {
    display: flex;
    justify-content: center;
    min-height: 100px;
}

/* ─── ANIMATIONS ─── */
@keyframes authLogoIn { 0% { transform: scale(0); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes authShake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes authPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes authRing { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
@keyframes authFadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.auth-fade { animation: authFadeUp 0.35s ease-out; }

@media (prefers-reduced-motion: reduce) {
    .auth-logo, .otp-box.error, .auth-timer.is-urgent, .auth-icon-ring::before, .auth-fade { animation: none !important; }
}
