/* ======================================== */
/* 1. СТРАНИЦА АВТОРИЗАЦИИ – СТЕКЛЯННЫЙ ЭФФЕКТ */
/* ======================================== */

/* Контейнер на весь экран */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    overflow: hidden;
    z-index: 0;
}

/* Анимированный градиентный фон – эффект волны */
.auth-gradient-bg {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460, #1a1a2e, #16213e);
    background-size: 400% 400%;
    animation: waveGradient 25s ease-in-out infinite;
    z-index: -1;
}

@keyframes waveGradient {
    0%   { background-position: 0% 0%; }
    10%  { background-position: 20% 30%; }
    20%  { background-position: 40% 10%; }
    30%  { background-position: 60% 50%; }
    40%  { background-position: 80% 30%; }
    50%  { background-position: 100% 0%; }
    60%  { background-position: 80% 70%; }
    70%  { background-position: 60% 100%; }
    80%  { background-position: 40% 70%; }
    90%  { background-position: 20% 100%; }
    100% { background-position: 0% 0%; }
}

body.light-theme .auth-gradient-bg {
    background: linear-gradient(135deg, #e0e5ec, #f0f4f8, #d9e2ec, #e0e5ec, #f0f4f8);
    background-size: 400% 400%;
}

/* ======================================== */
/* 2. КАРТОЧКА ВХОДА */
/* ======================================== */

.auth-card {
    position: relative;
    width: 420px;
    max-width: 92%;
    padding: 40px 36px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    color: var(--text);
    transition: all 0.3s ease;
    z-index: 1;
}

body.light-theme .auth-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

/* ======================================== */
/* 3. ЛОГОТИП */
/* ======================================== */

.auth-logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.auth-logo {
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
    transition: all 0.3s ease;
}

body.light-theme .auth-logo {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.08));
}

/* ======================================== */
/* 4. ЗАГОЛОВОК */
/* ======================================== */

.auth-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 28px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.light-theme .auth-title {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ======================================== */
/* 5. ПОЛЯ ВВОДА */
/* ======================================== */

.auth-input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    color: var(--text);
    font-size: 16px;
    transition: all 0.25s ease;
    margin-bottom: 16px;
    outline: none;
}

.auth-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 154, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.auth-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.auth-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

body.light-theme .auth-input {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: #1e2a3a;
}

body.light-theme .auth-input:focus {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(42, 108, 187, 0.15);
}

/* ======================================== */
/* 6. ПОЛЕ ПАРОЛЯ С ГЛАЗИКОМ */
/* ======================================== */

.auth-password-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 16px;
}

.auth-input-password {
    padding-right: 44px;
    margin-bottom: 0;
}

.auth-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 8px;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.auth-password-toggle:hover {
    color: var(--text);
}

/* ======================================== */
/* 7. КНОПКИ */
/* ======================================== */

.auth-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.auth-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 16px rgba(76, 154, 255, 0.3);
}

.auth-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(76, 154, 255, 0.4);
}

.auth-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.auth-btn-link {
    background: transparent;
    color: var(--primary);
    font-size: 14px;
    text-decoration: underline;
    padding: 8px;
    margin-top: -4px;
}

.auth-btn-link:hover {
    color: var(--primary-light);
}

body.light-theme .auth-btn-secondary {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #1e2a3a;
}

body.light-theme .auth-btn-secondary:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.08);
}

/* ======================================== */
/* 8. ИКОНКИ В ПРАВОМ ВЕРХНЕМ УГЛУ */
/* ======================================== */

.auth-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 20;
}

/* Кнопка переключения темы */
.auth-theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 22px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.auth-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05);
}

body.light-theme .auth-theme-toggle {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .auth-theme-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* Иконка тестового входа (космонавт) */
.auth-btn-demo-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    opacity: 0.5;
}

.auth-btn-demo-icon:hover:not(:disabled) {
    color: var(--primary);
    opacity: 1;
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.05);
}

.auth-btn-demo-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

body.light-theme .auth-btn-demo-icon:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.04);
}

/* ======================================== */
/* 9. ОШИБКА */
/* ======================================== */

.auth-error {
    background: rgba(244, 67, 54, 0.12);
    border-left: 4px solid var(--danger);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    color: var(--danger);
    font-size: 14px;
}

body.light-theme .auth-error {
    background: rgba(244, 67, 54, 0.06);
}

/* ======================================== */
/* 10. МОДАЛКА СИНХРОНИЗАЦИИ */
/* ======================================== */

.sync-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.sync-modal {
    background: var(--bg-secondary, #1e2a3a);
    border-radius: 16px;
    padding: 40px 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    color: var(--text, #fff);
    border: 1px solid rgba(255,255,255,0.08);
}

body.light-theme .sync-modal {
    background: #ffffff;
    border-color: rgba(0,0,0,0.08);
    color: #1e2a3a;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
}

.sync-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.sync-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.sync-message {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 20px;
    min-height: 2.4em;
}

.sync-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    overflow: hidden;
    margin: 16px 0;
}

body.light-theme .sync-progress-bar {
    background: rgba(0,0,0,0.1);
}

.sync-progress-fill {
    height: 100%;
    background: var(--primary, #4c9aff);
    transition: width 0.5s ease;
    border-radius: 2px;
}

/* ======================================== */
/* 11. МОДАЛКА ДЕМО-АККАУНТА */
/* ======================================== */

.auth-demo-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-demo-modal {
    background: var(--bg-surface);
    padding: 32px 36px;
    border-radius: 28px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
}

.auth-demo-modal h3 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.auth-demo-modal p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

.auth-demo-credentials {
    background: var(--bg-elevated);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 24px;
}

.auth-demo-credentials div {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 15px;
}

.auth-demo-credentials .label {
    color: var(--text-secondary);
}

.auth-demo-credentials .value {
    font-weight: 600;
    color: var(--text);
    font-family: monospace;
}

.auth-demo-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.auth-demo-actions button {
    padding: 10px 24px;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-demo-actions .btn-primary {
    background: var(--primary);
    color: white;
}

.auth-demo-actions .btn-primary:hover {
    background: var(--primary-dark);
}

.auth-demo-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid var(--border);
}

.auth-demo-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

body.light-theme .auth-demo-modal {
    background: #ffffff;
    border-color: rgba(0,0,0,0.1);
}

body.light-theme .auth-demo-actions .btn-secondary {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .auth-demo-actions .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* ======================================== */
/* 12. АНИМАЦИИ */
/* ======================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ======================================== */
/* 13. АДАПТИВНОСТЬ */
/* ======================================== */

@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px;
        border-radius: 28px;
    }
    .auth-title {
        font-size: 24px;
    }
    .auth-input {
        padding: 12px 14px;
        font-size: 15px;
    }
    .auth-btn {
        padding: 12px;
        font-size: 15px;
    }
    .auth-theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    .auth-btn-demo-icon {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    .auth-top-right {
        top: 12px;
        right: 12px;
        gap: 8px;
    }
    .auth-demo-modal {
        padding: 24px 20px;
    }
}

/* ======================================== */
/* 14. ОТКЛЮЧЕНИЕ АНИМАЦИЙ ДЛЯ ПРЕДПОЧТЕНИЙ */
/* ======================================== */

@media (prefers-reduced-motion: reduce) {
    .auth-gradient-bg {
        animation: none;
    }
    .auth-btn {
        transition: none;
    }
    .auth-btn-primary:hover:not(:disabled) {
        transform: none;
    }
    .auth-btn-secondary:hover:not(:disabled) {
        transform: none;
    }
}