/**
 * ============================================================================
 * V2 AUTH — Стили страниц авторизации
 * ============================================================================
 * 
 * СОДЕРЖИМОЕ:
 * - Фоновые эффекты (северное сияние, звёзды, снег)
 * - Layout страницы (двухколоночная структура)
 * - Карточка формы
 * - Поля ввода и кнопки
 * - Информационная колонка
 * - Адаптивность
 * 
 * СТРАНИЦЫ:
 * - /v2/auth/login
 * - /v2/auth/register
 * - /v2/auth/recovery
 * 
 * ============================================================================
 */

/* ==========================================================================
   ФОНОВЫЕ ЭФФЕКТЫ
   ========================================================================== */

.v2-auth-page {
    min-height: 100vh;
    background: var(--v2-bg-deep, #0a0f1a);
    font-family: 'Quicksand', sans-serif;
    color: var(--v2-text, #f1f5f9);
    overflow-x: hidden;
}

.v2-auth-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
}

/* Северное сияние */
.v2-auth-aurora {
    position: absolute;
    top: -100px;
    left: -100px;
    right: 0;
    width: calc(110vw + 100px);
    height: calc(110vh + 100px);
    background: radial-gradient(ellipse at 20% 80%, rgb(126 18 18 / 30%) 0%, transparent 50%), radial-gradient(ellipse at 80% 20%, #1092b94d 0%, transparent 50%), radial-gradient(ellipse at 50% 50%, #425cf54d 0%, transparent 60%);
    animation: auroraShift 4s ease-in-out infinite;
    will-change: transform, opacity;
}

/* Звёзды */
.v2-auth-stars {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 90px 40px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(2px 2px at 130px 80px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 160px 120px, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(2px 2px at 200px 60px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 250px 150px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(2px 2px at 300px 90px, rgba(255, 255, 255, 0.6), transparent);
    background-size: 350px 200px;
    animation: starsTwinkle 6s ease-in-out infinite;
    will-change: opacity;
}

/* Снег */
.v2-auth-snow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(3px 3px at 100px 50px, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 200px 150px, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(3px 3px at 300px 100px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(2px 2px at 400px 200px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(3px 3px at 500px 80px, rgba(255, 255, 255, 0.6), transparent);
    background-size: 600px 400px;
    animation: snowfall 20s linear infinite;
}

/* Low power режим — активируется через .v2-low-power на <html> */
.v2-low-power .v2-auth-aurora {
    animation-duration: 18s;
    opacity: 0.45;
}

.v2-low-power .v2-auth-stars {
    display: none;
}

.v2-low-power .v2-auth-snow {
    animation-duration: 30s;
    opacity: 0.6;
}

@keyframes snowfall {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 400px;
    }
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.v2-auth-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.v2-auth-header {
    padding: 24px 32px;
    display: flex;
    justify-content: center;
}

.v2-auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.v2-auth-logo:hover {
    transform: scale(1.02);
}

.v2-auth-logo-img {
    height: 48px;
    width: auto;
}

.v2-auth-logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--v2-text, #f1f5f9);
    letter-spacing: -0.5px;
}

.v2-auth-logo-accent {
    color: var(--v2-gold, #f5c842);
}

.v2-auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.v2-auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    max-width: 1100px;
    width: 100%;
    align-items: center;
}

.v2-auth-footer {
    padding: 24px;
    text-align: center;
    color: var(--v2-text-muted, #94a3b8);
    font-size: 13px;
}

.v2-auth-footer a {
    color: var(--v2-gold, #f5c842);
    text-decoration: none;
}

.v2-auth-footer a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   ФОРМА — КАРТОЧКА
   ========================================================================== */

.v2-auth-form-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.v2-auth-form-card {
    background: var(--v2-bg-card, #1a2332);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3),
    0 0 80px rgba(245, 200, 66, 0.05);
    animation: cardAppear 0.6s ease-out;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.v2-auth-form-header {
    text-align: center;
    margin-bottom: 32px;
}

.v2-auth-form-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--v2-text, #f1f5f9);
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.v2-auth-form-icon {
    font-size: 32px;
}

.v2-auth-form-subtitle {
    color: var(--v2-text-muted, #94a3b8);
    margin: 0;
    font-size: 15px;
}

/* ==========================================================================
   ФОРМА — ПОЛЯ ВВОДА
   ========================================================================== */

.v2-auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.v2-auth-field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.v2-auth-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--v2-text, #f1f5f9);
}

.v2-auth-label-icon {
    font-size: 16px;
}

.v2-auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.v2-auth-forgot-link {
    font-size: 13px;
    color: var(--v2-gold, #f5c842);
    text-decoration: none;
    transition: color 0.2s;
}

.v2-auth-forgot-link:hover {
    color: var(--v2-gold-light, #fde68a);
    text-decoration: underline;
}

.v2-auth-field {
    margin: 0;
}

.v2-auth-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--v2-bg-elevated, #243044);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--v2-text, #f1f5f9);
    font-size: 15px;
    font-family: 'Quicksand', sans-serif;
    transition: all 0.2s ease;
}

.v2-auth-input::placeholder {
    color: var(--v2-text-dim, #64748b);
}

.v2-auth-input:focus {
    outline: none;
    border-color: var(--v2-gold, #f5c842);
    box-shadow: 0 0 0 3px rgba(245, 200, 66, 0.15);
    background: var(--v2-bg-card, #1a2332);
}

.v2-auth-input:hover:not(:focus) {
    border-color: rgba(255, 255, 255, 0.15);
}

.v2-auth-field-hint {
    font-size: 12px;
    color: var(--v2-text-dim, #64748b);
    margin: 4px 0 0;
}

.v2-auth-field-error {
    font-size: 13px;
    color: var(--v2-red, #e7515a);
    margin-top: 4px;
}

/* ==========================================================================
   ФОРМА — ОШИБКИ
   ========================================================================== */

.v2-auth-errors {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: rgba(231, 81, 90, 0.1);
    border: 1px solid rgba(231, 81, 90, 0.3);
    border-radius: 12px;
    margin-bottom: 8px;
}

.v2-auth-errors-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.v2-auth-errors-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 14px;
    color: var(--v2-red, #e7515a);
}

.v2-auth-errors-list li {
    margin-bottom: 4px;
}

.v2-auth-errors-list li:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   ФОРМА — CHECKBOX
   ========================================================================== */

.v2-auth-remember,
.v2-auth-terms {
    margin-top: 4px;
}

.v2-auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--v2-text-muted, #94a3b8);
}

.v2-auth-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.v2-auth-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: var(--v2-bg-elevated, #243044);
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
}

.v2-auth-checkbox:checked + .v2-auth-checkbox-custom {
    background: var(--v2-gold, #f5c842);
    border-color: var(--v2-gold, #f5c842);
}

.v2-auth-checkbox:checked + .v2-auth-checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: var(--v2-bg-deep, #0a0f1a);
}

.v2-auth-checkbox:focus + .v2-auth-checkbox-custom {
    box-shadow: 0 0 0 3px rgba(245, 200, 66, 0.15);
}

.v2-auth-checkbox-text {
    line-height: 1.4;
}

.v2-auth-terms-link {
    color: var(--v2-gold, #f5c842);
    text-decoration: none;
}

.v2-auth-terms-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   ФОРМА — КНОПКИ И ДЕЙСТВИЯ
   ========================================================================== */

.v2-auth-actions {
    margin-top: 8px;
}

.v2-auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--v2-text-dim, #64748b);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.v2-auth-divider::before,
.v2-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.v2-auth-alt-action {
    text-align: center;
}

.v2-auth-alt-text {
    margin: 0 0 12px;
    color: var(--v2-text-muted, #94a3b8);
    font-size: 14px;
}

/* ==========================================================================
   ФОРМА — ФУТЕР
   ========================================================================== */

.v2-auth-form-footer {
    text-align: center;
    font-size: 13px;
    color: var(--v2-text-dim, #64748b);
}

.v2-auth-form-footer a {
    color: var(--v2-gold, #f5c842);
    text-decoration: none;
}

.v2-auth-form-footer a:hover {
    text-decoration: underline;
}

.v2-auth-help-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
    background: var(--v2-bg-card, #1a2332);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.v2-auth-help-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.v2-auth-help-message p {
    margin: 0;
    line-height: 1.5;
}

/* ==========================================================================
   ПРЕИМУЩЕСТВА (страница регистрации)
   ========================================================================== */

.v2-auth-benefits {
    background: var(--v2-bg-card, #1a2332);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 24px;
    animation: cardAppear 0.6s ease-out 0.2s both;
}

.v2-auth-benefits-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--v2-text-muted, #94a3b8);
    margin: 0 0 16px;
}

.v2-auth-benefits-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.v2-auth-benefits-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--v2-text, #f1f5f9);
}

.v2-auth-benefit-icon {
    font-size: 18px;
}

/* ==========================================================================
   ИНФОРМАЦИОННАЯ КОЛОНКА
   ========================================================================== */

.v2-auth-info-column {
    animation: infoAppear 0.8s ease-out 0.3s both;
}

@keyframes infoAppear {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.v2-auth-info-card {
    background: linear-gradient(135deg, var(--v2-bg-card, #1a2332) 0%, var(--v2-bg-elevated, #243044) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.2);
}

/* Placeholder для изображения персонажей */
.v2-auth-characters-placeholder {
    margin-bottom: 10px;
    background: url(https://app.secret-santa.ru/theme/mascot/common/all-welcome.png);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: top;
}

.v2-auth-characters-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    height: 200px;
    background: linear-gradient(135deg, rgba(245, 200, 66, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    /*border: 2px dashed rgba(245, 200, 66, 0.3);*/
    border-radius: 20px;
    transition: all 0.3s ease;
}

.v2-auth-characters-emoji {
    font-size: 48px;
    letter-spacing: 8px;
}

.v2-auth-characters-label {
    font-size: 14px;
    color: var(--v2-text-dim, #64748b);
    font-weight: 500;
}

.v2-auth-info-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--v2-text, #f1f5f9);
    margin: 0 0 16px;
    line-height: 1.3;
}

.v2-text-gold {
    color: var(--v2-gold, #f5c842);
}

.v2-auth-info-description {
    font-size: 16px;
    color: var(--v2-text-muted, #94a3b8);
    line-height: 1.6;
    margin: 0 0 32px;
}

/* Список преимуществ */
.v2-auth-features {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.v2-auth-feature {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.v2-auth-feature-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 200, 66, 0.1);
    border-radius: 12px;
}

.v2-auth-feature-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.v2-auth-feature-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--v2-text, #f1f5f9);
}

.v2-auth-feature-text {
    font-size: 13px;
    color: var(--v2-text-muted, #94a3b8);
}

.v2-auth-info-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.v2-auth-info-cta {
    font-size: 16px;
    font-weight: 600;
    color: var(--v2-gold, #f5c842);
    margin: 0;
    text-align: center;
}

/* ==========================================================================
   КНОПКИ (специфичные для auth)
   ========================================================================== */

.v2-auth-form-card .v2-btn {
    font-family: 'Quicksand', sans-serif;
    color: white;
}

.v2-btn-block {
    display: block;
    width: 100%;
}

.v2-btn-lg {
    padding: 16px 24px;
    font-size: 16px;
}

/* ==========================================================================
   АДАПТИВНОСТЬ
   ========================================================================== */

@media (max-width: 992px) {
    .v2-auth-container {
        grid-template-columns: 1fr;
        max-width: 480px;
    }

    /* Форма первая, информация о сервисе — после */
    .v2-auth-form-column {
        order: 1;
    }

    .v2-auth-info-column {
        order: 2;
    }

    .v2-auth-info-card {
        padding: 24px;
    }

    .v2-auth-characters-frame {
        height: 140px;
    }

    .v2-auth-characters-emoji {
        font-size: 36px;
    }

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

    .v2-auth-features {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .v2-auth-feature {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
    }

    .v2-auth-feature-icon {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }

    .v2-auth-info-footer {
        display: none;
    }
}

@media (max-width: 600px) {
    .v2-auth-header {
        padding: 16px 20px;
    }

    .v2-auth-logo-img {
        height: 36px;
    }

    .v2-auth-logo-text {
        font-size: 20px;
    }

    .v2-auth-main {
        padding: 16px;
    }

    .v2-auth-form-card {
        padding: 28px 24px;
        border-radius: 20px;
    }

    .v2-auth-form-title {
        font-size: 22px;
        flex-direction: column;
        gap: 8px;
    }

    .v2-auth-form-icon {
        font-size: 28px;
    }

    .v2-auth-input {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .v2-auth-info-card {
        padding: 20px;
        border-radius: 16px;
    }

    .v2-auth-characters-frame {
        height: 120px;
    }

    .v2-auth-characters-emoji {
        font-size: 28px;
        letter-spacing: 4px;
    }

    .v2-auth-info-title {
        font-size: 18px;
    }

    .v2-auth-info-description {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .v2-auth-features {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .v2-auth-feature {
        flex-direction: row;
        text-align: left;
    }

    .v2-auth-benefits-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 380px) {
    .v2-auth-form-card {
        padding: 24px 20px;
    }

    .v2-auth-form-title {
        font-size: 20px;
    }
}

/* ==========================================================================
   СВЕТЛАЯ ТЕМА
   ========================================================================== */

.v2-light-theme .v2-auth-page,
body.v2-light-theme.v2-auth-page {
    background: #f1f5f9;
}

.v2-light-theme .v2-auth-aurora {
    background: radial-gradient(ellipse 80% 50% at 20% 20%, rgba(56, 189, 248, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 30%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 10%, rgba(245, 200, 66, 0.1) 0%, transparent 50%);
}

.v2-light-theme .v2-auth-stars {
    opacity: 0.3;
}

.v2-light-theme .v2-auth-snow {
    opacity: 0.4;
}

.v2-light-theme .v2-auth-logo-text {
    color: #1e293b;
}

.v2-light-theme .v2-auth-form-card,
.v2-light-theme .v2-auth-info-card,
.v2-light-theme .v2-auth-benefits {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.v2-light-theme .v2-auth-form-title,
.v2-light-theme .v2-auth-info-title,
.v2-light-theme .v2-auth-feature-title,
.v2-light-theme .v2-auth-label,
.v2-light-theme .v2-auth-benefits-list li {
    color: #1e293b;
}

.v2-light-theme .v2-auth-form-subtitle,
.v2-light-theme .v2-auth-info-description,
.v2-light-theme .v2-auth-feature-text,
.v2-light-theme .v2-auth-alt-text,
.v2-light-theme .v2-auth-checkbox-text {
    color: #64748b;
}

.v2-light-theme .v2-auth-input {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

.v2-light-theme .v2-auth-input::placeholder {
    color: #94a3b8;
}

.v2-light-theme .v2-auth-input:focus {
    background: #ffffff;
    border-color: var(--v2-gold, #f5c842);
}

.v2-light-theme .v2-auth-checkbox-custom {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.15);
}

.v2-light-theme .v2-auth-divider {
    color: #94a3b8;
}

.v2-light-theme .v2-auth-divider::before,
.v2-light-theme .v2-auth-divider::after {
    background: rgba(0, 0, 0, 0.1);
}

.v2-light-theme .v2-auth-characters-frame {
    background: linear-gradient(135deg, rgba(245, 200, 66, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    border-color: rgba(245, 200, 66, 0.4);
}

.v2-light-theme .v2-auth-feature-icon {
    background: rgba(245, 200, 66, 0.15);
}

.v2-light-theme .v2-auth-footer {
    color: #64748b;
}

.v2-light-theme .v2-auth-help-message {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.05);
}

.v2-auth-errors ul {
    margin-bottom: 0px;
}
