/* ==========================================
   Переменные и базовые стили
   Дизайн: Тёмный минимализм с голубыми акцентами
   ========================================== */
:root {
    /* Основные цвета фона */
    --bg-primary: #09090b;
    --bg-secondary: #0f0f12;
    --bg-tertiary: #151518;
    --bg-card: #13131a;
    --bg-input: #1a1a24;
    --bg-input-hover: #1f1f2a;
    --bg-input-focus: #1e2a3a;

    /* Текст */
    --text-primary: #f4f4f5;
    --text-secondary: #9898a6;
    --text-muted: #5c5c6d;
    --text-placeholder: #4a4a5a;

    /* Границы */
    --border-color: rgba(56, 189, 248, 0.15);
    --border-hover: rgba(56, 189, 248, 0.3);
    --border-focus: rgba(56, 189, 248, 0.6);

    /* Акцентные цвета - Голубой-синий */
    --accent-primary: #0ea5e9;
    --accent-secondary: #3b82f6;
    --accent-tertiary: #38bdf8;
    --accent-glow: rgba(14, 165, 233, 0.25);
    --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 50%, #6366f1 100%);
    --accent-gradient-hover: linear-gradient(135deg, #38bdf8 0%, #60a5fa 50%, #818cf8 100%);

    /* Статусы */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Тени */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 60px rgba(14, 165, 233, 0.12);
    --shadow-btn: 0 4px 20px rgba(14, 165, 233, 0.4);
    --shadow-btn-hover: 0 8px 30px rgba(14, 165, 233, 0.5);

    /* Размеры */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Анимации */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Сброс стилей */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==========================================
   Контейнер авторизации
   ========================================== */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

/* Фоновые декоративные элементы */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(14, 165, 233, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse 40% 30% at 0% 80%, rgba(56, 189, 248, 0.08) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.bg-blur-circle {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.circle-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    top: -300px;
    left: 50%;
    transform: translateX(-50%);
    animation: pulse-slow 8s ease-in-out infinite;
}

.circle-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-tertiary);
    bottom: -200px;
    right: -100px;
    animation: pulse-slow 10s ease-in-out infinite reverse;
}

@keyframes pulse-slow {

    0%,
    100% {
        opacity: 0.4;
        transform: translateX(-50%) scale(1);
    }

    50% {
        opacity: 0.6;
        transform: translateX(-50%) scale(1.1);
    }
}

/* ==========================================
   Карточка авторизации
   ========================================== */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    animation: fadeIn 0.6s ease-out;
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    padding: 1px;
    background: linear-gradient(135deg,
            rgba(14, 165, 233, 0.3) 0%,
            transparent 50%,
            rgba(56, 189, 248, 0.2) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   Заголовок
   ========================================== */
.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.logo {
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-btn);
    position: relative;
    overflow: hidden;
}

.logo::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {

    0%,
    100% {
        left: -100%;
    }

    50% {
        left: 100%;
    }
}

.logo svg {
    width: 32px;
    height: 32px;
}

.auth-title {
    font-size: 1.625rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.025em;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}

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

.auth-form.hidden {
    display: none;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 2px;
}

/* Поля ввода */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
    width: 18px;
    height: 18px;
}

.input-wrapper input {
    width: 100%;
    padding: 13px 44px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.input-wrapper input::placeholder {
    color: var(--text-placeholder);
}

.input-wrapper input:hover {
    background: var(--bg-input-hover);
    border-color: var(--border-hover);
}

.input-wrapper input:focus {
    outline: none;
    background: var(--bg-input-focus);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrapper:focus-within .input-icon {
    color: var(--accent-primary);
}

/* Кнопка показа пароля */
.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
    border-radius: var(--radius-sm);
}

.toggle-password:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-password svg {
    width: 18px;
    height: 18px;
}

/* Опции формы */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: -4px;
}

/* Чекбокс */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 16px;
    height: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    position: relative;
}

.checkmark::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 2px;
    transform: scale(0);
    transition: transform var(--transition-fast);
}

.checkbox-wrapper input:checked+.checkmark {
    border-color: var(--accent-primary);
    background: rgba(14, 165, 233, 0.15);
}

.checkbox-wrapper input:checked+.checkmark::after {
    transform: scale(1);
}

.checkbox-wrapper:hover .checkmark {
    border-color: var(--border-hover);
}

.forgot-password {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.forgot-password:hover {
    color: var(--accent-tertiary);
}

/* ==========================================
   Кнопки
   ========================================== */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-btn);
    margin-top: 4px;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--accent-gradient-hover);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn-primary span,
.btn-primary svg {
    position: relative;
    z-index: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-btn-hover);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-arrow {
    transition: transform var(--transition-fast);
    width: 18px;
    height: 18px;
}

.btn-primary:hover .btn-arrow {
    transform: translateX(3px);
}

/* Состояние загрузки */
.btn-primary.loading {
    pointer-events: none;
}

.btn-primary.loading span,
.btn-primary.loading .btn-arrow {
    opacity: 0;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    z-index: 1;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   Уведомление о смене пароля
   ========================================== */
.password-warning {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.password-warning.visible {
    display: flex;
}

.password-warning-icon {
    color: var(--warning);
    flex-shrink: 0;
}

.password-warning-text {
    font-size: 0.8125rem;
    color: var(--warning);
    line-height: 1.4;
}

/* ==========================================
   Уведомления (Toast)
   ========================================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastIn 0.35s ease-out;
    max-width: 340px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.toast.hiding {
    animation: toastOut 0.3s ease-out forwards;
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
}

.toast-icon {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.toast.warning .toast-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
    transition: color var(--transition-fast);
    border-radius: var(--radius-sm);
}

.toast-close:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================
   Адаптивность
   ========================================== */
@media (max-width: 480px) {
    .auth-container {
        padding: 16px;
    }

    .auth-card {
        padding: 28px 20px;
        border-radius: var(--radius-lg);
    }

    .auth-title {
        font-size: 1.375rem;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .logo {
        width: 48px;
        height: 48px;
    }

    .logo svg {
        width: 28px;
        height: 28px;
    }
}

/* ==========================================
   Доступность
   ========================================== */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

::selection {
    background: rgba(14, 165, 233, 0.4);
    color: var(--text-primary);
}