/* === AUTH.CSS ===
 * Путь: assets/css/auth.css
 * НАЗНАЧЕНИЕ: Стили страницы авторизации admin-панели
 * РАЗМЕР: ~160 строк
 */

/* ============================================================================
   CSS ПЕРЕМЕННЫЕ — ТЕМНАЯ ТЕМА (дефолт)
   ============================================================================ */
:root {
    --auth-bg: hsl(10, 10%, 4%);
    --auth-card-bg: hsl(10, 10%, 7%);
    --auth-border: hsl(10, 10%, 14%);
    --auth-text: hsl(0, 0%, 95%);
    --auth-muted: hsl(0, 0%, 55%);
    --auth-accent: #10b981;
    --auth-accent-hover: #0ea472;
    --auth-error-bg: hsla(0, 84%, 60%, 0.12);
    --auth-error-border: hsla(0, 84%, 60%, 0.4);
    --auth-error-text: hsl(0, 84%, 70%);
    --auth-input-bg: hsl(10, 10%, 10%);
    --auth-input-border: hsl(10, 10%, 18%);
    --auth-input-focus: #10b981;
    --auth-toggle-bg: hsl(10, 10%, 10%);
    --auth-toggle-hover: hsl(10, 10%, 15%);
    --auth-font: 'JetBrains Mono', monospace;
}

/* СВЕТЛАЯ ТЕМА */
html.light-theme {
    --auth-bg: hsl(0, 0%, 94%);
    --auth-card-bg: #ffffff;
    --auth-border: hsl(0, 0%, 84%);
    --auth-text: hsl(0, 0%, 10%);
    --auth-muted: hsl(0, 0%, 45%);
    --auth-input-bg: hsl(0, 0%, 97%);
    --auth-input-border: hsl(0, 0%, 80%);
    --auth-toggle-bg: hsl(0, 0%, 88%);
    --auth-toggle-hover: hsl(0, 0%, 82%);
}

/* ============================================================================
   БАЗОВЫЙ СБРОС
   ============================================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--auth-font);
    background: var(--auth-bg);
    color: var(--auth-text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* Фоновая сетка */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(16, 185, 129, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 185, 129, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

/* ============================================================================
   ОБЕРТКА И КАРТОЧКА
   ============================================================================ */
.auth-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-card {
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(16,185,129,0.06);
}

/* ============================================================================
   ЛОГОТИП И ЗАГОЛОВОК
   ============================================================================ */
.auth-logo {
    margin-bottom: 16px;
}

.auth-title {
    font-family: var(--auth-font);
    font-size: 22px;
    font-weight: 700;
    color: var(--auth-text);
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    text-align: center;
}

.auth-subtitle {
    font-size: 12px;
    color: var(--auth-muted);
    text-align: center;
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}

/* ============================================================================
   ОШИБКА
   ============================================================================ */
.auth-error {
    width: 100%;
    background: var(--auth-error-bg);
    border: 1px solid var(--auth-error-border);
    color: var(--auth-error-text);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    margin-bottom: 16px;
    text-align: center;
    animation: authShake 0.4s ease;
}

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ============================================================================
   ФОРМА
   ============================================================================ */
.auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-field {
    position: relative;
    width: 100%;
}

.auth-input {
    width: 100%;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 8px;
    color: var(--auth-text);
    font-family: var(--auth-font);
    font-size: 14px;
    padding: 12px 44px 12px 14px;
    outline: none;
    transition: border-color 0.2s;
    letter-spacing: 0.05em;
}

.auth-input:focus {
    border-color: var(--auth-input-focus);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.auth-input--error {
    border-color: var(--auth-error-border);
    animation: authShake 0.4s ease;
}

.auth-toggle-pass {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--auth-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.auth-toggle-pass:hover {
    color: var(--auth-text);
}

.auth-btn {
    width: 100%;
    background: var(--auth-accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: var(--auth-font);
    font-size: 14px;
    font-weight: 600;
    padding: 13px;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: background 0.2s, transform 0.1s;
    margin-top: 4px;
}

.auth-btn:hover {
    background: var(--auth-accent-hover);
}

.auth-btn:active {
    transform: scale(0.98);
}

/* ============================================================================
   FOOTER
   ============================================================================ */
.auth-footer {
    margin-top: 24px;
    text-align: center;
}

.auth-footer-label {
    font-size: 11px;
    color: var(--auth-muted);
    letter-spacing: 0.04em;
    opacity: 0.6;
}

/* ============================================================================
   КНОПКА ПЕРЕКЛЮЧЕНИЯ ТЕМЫ (угол экрана)
   ============================================================================ */
.auth-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    background: var(--auth-toggle-bg);
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    color: var(--auth-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
}

.auth-theme-toggle:hover {
    background: var(--auth-toggle-hover);
    color: var(--auth-text);
}

/* Иконки темы: sun скрыта в темном, moon скрыта в светлом */
.auth-theme-toggle .icon-sun { display: none; }
.auth-theme-toggle .icon-moon { display: block; }
html.light-theme .auth-theme-toggle .icon-sun { display: block; }
html.light-theme .auth-theme-toggle .icon-moon { display: none; }

/* ============================================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================================ */
@media (max-width: 440px) {
    .auth-wrap {
        padding: 16px;
    }
    .auth-card {
        padding: 28px 20px;
    }
    .auth-title {
        font-size: 20px;
    }
}

/* Touch targets 44px (WCAG 2.5.8) */
@media (pointer: coarse), (max-width: 768px) {
    .auth-theme-toggle { width: 44px; height: 44px; }
    .auth-btn { min-height: 44px; }
    .auth-input { min-height: 44px; }
}
