/* =====================================================
   Стили страниц авторизации
   ===================================================== */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: 
        radial-gradient(ellipse at top, var(--accent-primary-light) 0%, transparent 60%),
        radial-gradient(ellipse at bottom right, var(--accent-purple-light) 0%, transparent 50%),
        var(--bg-primary);
    position: relative;
}

/* Фоновая анимация */
.auth-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, var(--accent-primary-light) 0%, transparent 30%),
        radial-gradient(circle at 80% 20%, var(--accent-purple-light) 0%, transparent 30%);
    opacity: 0.5;
    pointer-events: none;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

.auth-logo-icon {
    width: 56px;
    height: 56px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.auth-logo-icon svg {
    width: 32px;
    height: 32px;
}

.auth-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-lg);
}

.auth-logo-text {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
}

.auth-subtitle {
    font-size: 0.9375rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* Сообщения об ошибках и успехе */
.auth-error,
.auth-success {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    animation: slideUp 0.3s ease;
}

.auth-error {
    background: var(--accent-danger-light);
    border: 1px solid var(--accent-danger);
    color: var(--accent-danger);
}

.auth-success {
    background: var(--accent-success-light);
    border: 1px solid var(--accent-success);
    color: var(--accent-success);
}

.auth-error svg,
.auth-success svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.auth-link {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    font-family: inherit;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-form .btn-primary {
    margin-top: var(--space-2);
    padding: var(--space-4);
    font-size: 1rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-6) 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.auth-footer a {
    font-weight: 600;
}

/* Поле телефона */
.phone-input-wrapper {
    position: relative;
}

.phone-input-wrapper .phone-prefix {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9375rem;
}

.phone-input-wrapper .form-input {
    padding-left: 2.5rem;
}

/* Код подтверждения */
.code-inputs {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
}

.code-input {
    width: 60px;
    height: 72px;
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    transition: all var(--transition);
}

.code-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-primary-light);
}

.code-input.filled {
    border-color: var(--accent-success);
    background: var(--accent-success-light);
}

.code-input.error {
    border-color: var(--accent-danger);
    box-shadow: 0 0 0 4px var(--accent-danger-light);
    animation: shake 0.5s ease;
}

.code-input:disabled,
.code-input.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Таймер повторной отправки */
.resend-timer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.resend-timer .timer {
    font-weight: 700;
    color: var(--accent-primary);
    font-size: 1rem;
}

.bot-fallback {
    margin-top: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: center;
    text-align: center;
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
}

.bot-fallback-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.bot-fallback-timer {
    font-weight: 700;
    color: var(--accent-primary);
}

.bot-fallback .auth-link[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    text-decoration: none;
}

.resend-link {
    font-weight: 600;
    cursor: pointer;
    color: var(--accent-primary);
    transition: color var(--transition);
}

.resend-link:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

.resend-link.disabled {
    color: var(--text-muted);
    pointer-events: none;
}

/* Обратный отсчёт на кнопке */
.btn .countdown-icon {
    display: inline-block;
    margin-right: var(--space-1);
    font-size: 1rem;
    animation: pulse-icon 1s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.btn:disabled {
    cursor: not-allowed;
}

/* Шаги регистрации */
.auth-steps {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-8);
}

.auth-step {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--border-color);
    transition: all var(--transition-slow);
}

.auth-step.active {
    width: 32px;
    border-radius: 5px;
    background: var(--gradient-primary);
}

.auth-step.completed {
    background: var(--accent-success);
}

/* Переключатель темы на странице авторизации */
.auth-theme-toggle {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    z-index: 10;
}

.auth-theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.auth-theme-toggle svg {
    width: 22px;
    height: 22px;
}

.auth-theme-toggle .icon-sun,
.auth-theme-toggle .icon-moon {
    display: none;
}

[data-theme="light"] .auth-theme-toggle .icon-moon {
    display: block;
}

[data-theme="dark"] .auth-theme-toggle .icon-sun,
:root:not([data-theme]) .auth-theme-toggle .icon-sun {
    display: block;
}

/* Опции формы (Запомнить + Забыли пароль) */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    user-select: none;
}

.auth-remember-box {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.auth-remember-box svg {
    width: 14px;
    height: 14px;
    stroke: white;
    opacity: 0;
    transform: scale(0.5);
    transition: all var(--transition);
}

.auth-remember input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.auth-remember input:checked + .auth-remember-box {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.auth-remember input:checked + .auth-remember-box svg {
    opacity: 1;
    transform: scale(1);
}

.auth-remember input:focus-visible + .auth-remember-box {
    box-shadow: 0 0 0 3px var(--accent-primary-light);
}

.auth-remember-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    transition: color var(--transition);
}

.auth-remember:hover .auth-remember-text {
    color: var(--text-primary);
}

.auth-remember:hover .auth-remember-box {
    border-color: var(--accent-primary);
}

.auth-forgot {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--accent-primary);
    white-space: nowrap;
    transition: color var(--transition);
}

.auth-forgot:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

/* Password Visibility Toggle */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-1);
    transition: color var(--transition);
}

.password-toggle:hover {
    color: var(--text-primary);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

/* Social Login Buttons */
.social-login {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-social:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-social svg {
    width: 22px;
    height: 22px;
}

/* Адаптивность */
@media (max-width: 480px) {
    .auth-page {
        padding: var(--space-4);
        align-items: flex-start;
        padding-top: 10vh;
    }
    
    .auth-card {
        padding: var(--space-5);
        border-radius: var(--radius-xl);
    }
    
    .auth-logo {
        margin-bottom: var(--space-5);
    }
    
    .auth-logo-icon {
        width: 48px;
        height: 48px;
    }
    
    .auth-logo-icon svg {
        width: 26px;
        height: 26px;
    }
    
    .auth-logo-text {
        font-size: 1.5rem;
    }
    
    .auth-title {
        font-size: 1.25rem;
    }
    
    .auth-subtitle {
        font-size: 0.875rem;
        margin-bottom: var(--space-6);
    }
    
    .code-input {
        width: 50px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .auth-theme-toggle {
        top: var(--space-4);
        right: var(--space-4);
        width: 44px;
        height: 44px;
    }
    
    .auth-form {
        gap: var(--space-4);
    }
    
    .auth-form .btn-primary {
        padding: var(--space-4);
        font-size: 0.9375rem;
    }
    
    .auth-footer {
        font-size: 0.875rem;
    }
    
    /* Опции авторизации на мобильных */
    .auth-options {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }
    
    .auth-remember {
        padding: var(--space-3) var(--space-4);
        background: var(--bg-input);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        transition: all var(--transition);
    }
    
    .auth-remember:active {
        background: var(--bg-hover);
    }
    
    .auth-remember:has(input:checked) {
        border-color: var(--accent-primary);
        background: var(--accent-primary-light);
    }
    
    .auth-remember-box {
        width: 24px;
        height: 24px;
    }
    
    .auth-remember-box svg {
        width: 16px;
        height: 16px;
    }
    
    .auth-remember-text {
        font-size: 0.9375rem;
        flex: 1;
    }
    
    .auth-forgot {
        text-align: center;
        padding: var(--space-2);
        font-size: 0.9375rem;
    }
}

/* Очень маленькие экраны */
@media (max-width: 375px) {
    .auth-page {
        padding: var(--space-3);
        padding-top: 5vh;
    }
    
    .auth-card {
        padding: var(--space-4);
    }
    
    .auth-logo {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .auth-logo-icon {
        width: 44px;
        height: 44px;
    }
    
    .auth-logo-text {
        font-size: 1.25rem;
    }
    
    .auth-title {
        font-size: 1.125rem;
    }
    
    .code-inputs {
        gap: var(--space-2);
    }
    
    .code-input {
        width: 42px;
        height: 52px;
        font-size: 1.25rem;
    }
    
    .auth-theme-toggle {
        top: var(--space-3);
        right: var(--space-3);
        width: 40px;
        height: 40px;
    }
    
    .form-input,
    .form-select {
        padding: 0.75rem;
    }
    
    .auth-remember {
        padding: var(--space-3);
    }
    
    .auth-remember-text {
        font-size: 0.875rem;
    }
    
    .auth-forgot {
        font-size: 0.875rem;
    }
}

/* Блок поддержки */
.support-block {
    margin-top: var(--space-6);
    padding: var(--space-4) var(--space-5);
    background: var(--accent-warning-light);
    border: 1px solid var(--accent-warning);
    border-radius: var(--radius-lg);
    animation: slideUp 0.3s ease;
}

.support-block-content {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.support-block-content svg {
    width: 28px;
    height: 28px;
    color: var(--accent-warning);
    flex-shrink: 0;
}

.support-block-content div {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.support-block-content span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.support-block-content a {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: color var(--transition);
}

.support-block-content a:hover {
    color: var(--accent-primary);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .support-block {
        padding: var(--space-3) var(--space-4);
    }
    
    .support-block-content svg {
        width: 24px;
        height: 24px;
    }
    
    .support-block-content span {
        font-size: 0.8125rem;
    }
    
    .support-block-content a {
        font-size: 1rem;
    }
}
