/* ============================================================
   TnP Auth v2 — вхід / реєстрація (Stage 2.5 «Cinematic»)
   Подключается ПОСЛЕ /fonts/fonts.css и /css/brand.css.
   Контракт auth.js сохранён: .toggle-password (fa-eye/fa-eye-slash),
   .password-strength > .strength-bar (weak/medium/strong),
   .error-message/.success-message (.show).
   ============================================================ */

/* ---- Сцена: чёрный кинозал ---- */
body.auth-page {
    min-height: 100vh;
    display: flex;
    padding: 28px 24px;
    overflow-x: hidden;
}

.stage {
    position: fixed; inset: 0; z-index: 0;
    overflow: hidden; pointer-events: none;
}

/* ---- Зациклена ТнП-заставка день↔ніч (фон під сценою) ---- */
.scene-video { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.scene-video video {
    position: absolute; top: 50%; left: 50%;
    width: 100%; height: 100%;
    transform: translate(-50%, -50%);
    object-fit: cover;
    opacity: 0; transition: opacity 1.4s ease;
    will-change: opacity;
}
.scene-video video.visible { opacity: 0.5; }
/* Затемнення поверх відео, щоб форма/картка лишались читабельними */
.scene-video::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.72) 100%);
}
@media (prefers-reduced-motion: reduce) {
    .scene-video video { transition: none; }
}

/* Дышащие radial-градиенты — heroBreath (brand.css) анимирует --glow-alpha */
.breath-orb {
    position: absolute; border-radius: 50%;
    animation: heroBreath 9s ease-in-out infinite;
}
.orb-a {
    width: 72vmax; height: 72vmax; top: -32vmax; left: -26vmax;
    background: radial-gradient(circle,
        hsla(var(--ambient-hue), var(--ambient-sat), var(--ambient-light), var(--glow-alpha)) 0%,
        transparent 62%);
}
.orb-b {
    width: 62vmax; height: 62vmax; bottom: -28vmax; right: -22vmax;
    animation-duration: 12s; animation-delay: -4s;
    background: radial-gradient(circle,
        hsla(calc(var(--ambient-hue) + 22), var(--ambient-sat), var(--ambient-light), var(--glow-alpha)) 0%,
        transparent 60%);
}

/* Лёгкое звёздное поле */
.stars {
    position: absolute; inset: 0;
    background-image:
        radial-gradient(1px 1px at 20px 30px, rgba(255, 255, 255, 0.55) 50%, transparent 51%),
        radial-gradient(1px 1px at 130px 95px, rgba(255, 255, 255, 0.4) 50%, transparent 51%),
        radial-gradient(1.4px 1.4px at 270px 45px, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
        radial-gradient(1px 1px at 85px 185px, rgba(255, 255, 255, 0.3) 50%, transparent 51%),
        radial-gradient(1.2px 1.2px at 330px 150px, rgba(255, 255, 255, 0.35) 50%, transparent 51%),
        radial-gradient(1px 1px at 205px 225px, rgba(255, 255, 255, 0.45) 50%, transparent 51%);
    background-size: 380px 260px;
    opacity: 0.45;
    animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.28; } to { opacity: 0.6; } }
:root.night-theme .stars { opacity: 0.65; }

/* Виньетка: фокус на карточке + дневной/ночной tint */
.vignette {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.72) 100%),
        linear-gradient(var(--overlay-tint), var(--overlay-tint));
}

/* ---- «На головну» ---- */
.back-home {
    position: fixed; top: 22px; left: 24px; z-index: 2;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px 8px 10px; border-radius: 999px;
    font-size: 13.5px; color: var(--text-muted);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s;
}
.back-home:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateX(-2px);
}

/* ---- Карточка ---- */
.auth-card {
    position: relative; z-index: 1;
    width: min(420px, 100%);
    margin: auto;                 /* центр + корректный overflow-скролл */
    padding: 42px 40px 34px;
}

.auth-head { text-align: center; margin-bottom: 26px; }
.auth-head .tnp-logo { margin-bottom: 18px; }
.auth-head h1 {
    font-family: var(--font-display);
    font-size: 30px; font-weight: 400; letter-spacing: 0.3px;
    color: #fff;
    text-shadow:
        0 0 20px rgba(99, 102, 241, var(--glow-intensity)),
        0 2px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 6px;
}
.auth-head p { color: var(--text-muted); font-size: 14px; }

/* ---- Форма ---- */
.auth-form { display: flex; flex-direction: column; gap: 18px; }

.form-group label { display: block; margin-bottom: 8px; }

.field-wrap { position: relative; }
.field-wrap .field { padding-left: 44px; }
.field-wrap.has-toggle .field { padding-right: 48px; }

.field-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 17px; height: 17px;
    color: var(--text-dim); pointer-events: none;
    transition: color 0.3s;
}
.field-wrap:focus-within .field-icon { color: var(--primary); }

/* Глазок: auth.js переключает классы fa-eye / fa-eye-slash */
.toggle-password {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px;
    background: transparent; border: none;
    color: var(--text-dim);
    transition: color 0.3s;
}
.toggle-password:hover { color: var(--text); }
.toggle-password .icon { width: 18px; height: 18px; vertical-align: 0; }
.toggle-password .icon-eye-off { display: none; }
.toggle-password.fa-eye-slash .icon-eye-off { display: block; }
.toggle-password.fa-eye-slash .icon-eye { display: none; }

/* Индикатор силы пароля */
.password-strength {
    position: relative;
    height: 4px; margin: 10px 2px 12px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
}
.strength-bar {
    display: block; height: 100%; width: 0;
    border-radius: 2px;
    transition: width 0.35s ease, background 0.35s ease;
}
.strength-bar.weak   { width: 33%;  background: var(--danger); }
.strength-bar.medium { width: 66%;  background: var(--warning); }
.strength-bar.strong { width: 100%; background: var(--success); }
.strength-bar::after {
    position: absolute; right: 0; top: 9px;
    font-size: 11px; letter-spacing: 0.4px;
}
.strength-bar.weak::after   { content: 'слабкий';  color: var(--danger); }
.strength-bar.medium::after { content: 'середній'; color: var(--warning); }
.strength-bar.strong::after { content: 'надійний'; color: var(--success); }

/* Опции */
.form-options {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; flex-wrap: wrap;
    font-size: 13.5px;
}
.checkbox-label {
    display: inline-flex; align-items: center; gap: 9px;
    color: var(--text-muted); cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--primary); cursor: pointer;
}
.checkbox-label a { color: var(--primary); }
.checkbox-label a:hover { text-decoration: underline; }
.forgot-password { color: var(--text-muted); transition: color 0.3s; }
.forgot-password:hover { color: var(--primary); }

/* Сообщения (auth.js вешает .show) */
.error-message, .success-message {
    display: none;
    padding: 12px 14px; border-radius: 10px;
    font-size: 13.5px; line-height: 1.45;
}
.error-message.show, .success-message.show { display: block; }
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: var(--danger);
}
.success-message {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--success);
}

/* Кнопки */
.btn-block { width: 100%; }
.auth-form .btn-primary { padding: 14px 28px; font-size: 15px; }

/* Разделитель */
.divider {
    display: flex; align-items: center; gap: 14px;
    color: var(--text-dim);
    font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px;
}
.divider::before, .divider::after {
    content: ''; flex: 1; height: 1px;
    background: var(--glass-border);
}

/* Соц-кнопки */
.social-auth { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.social-auth .btn { padding: 11px 10px; font-size: 14px; }
.social-auth .icon { width: 18px; height: 18px; }

/* Футер */
.auth-footer {
    text-align: center; margin-top: 4px;
    color: var(--text-muted); font-size: 14px;
}
.auth-footer a { color: var(--primary); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* ---- Мобильная адаптация ---- */
@media (max-width: 480px) {
    body.auth-page { padding: 74px 14px 26px; }
    .back-home { top: 14px; left: 14px; }
    .auth-card { padding: 30px 20px 26px; }
    .auth-head h1 { font-size: 26px; }
    .form-options { font-size: 13px; }
}
