/* =============================================================
   login.css — Стили страницы login.php
   Glass-морф welcome screen. Использует canonical Alpha-палитру
   через variables.css для brand-цветов, но имеет собственный
   layout (animated bg, glass cards) — это намеренно отдельная
   эстетика "premium entry point".
   Login всегда тёмный (force html.dark-theme в login.php).
   ============================================================= */

/* Reset (login.php не подключает Bootstrap) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Glass-морф локальная палитра — page-specific */
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-hover: rgba(255, 255, 255, 0.10);
    --text-primary: #f0f0f0;
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-muted: rgba(255, 255, 255, 0.35);

    /* Brand цвета — ссылки на canonical из variables.css */
    --accent: var(--accent-blue, #5dade2);
    --accent-glow: rgba(93, 173, 226, 0.30);
    --danger: #f87171;       /* glass-context light red, оставляем — на тёмном фоне читается лучше canonical */
    --success: #4ade80;      /* то же */

    /* Glass-style инпуты */
    --input-bg: rgba(0, 0, 0, 0.25);
    --input-border: rgba(255, 255, 255, 0.10);
    --input-focus: rgba(93, 173, 226, 0.40);
    --radius: 16px;
    --radius-sm: 10px;
}

html, body {
    height: 100%; width: 100%;
    overflow: hidden;
    font-family: 'Outfit', -apple-system, sans-serif;
    color: var(--text-primary);
    background: #0a0e17;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-scene {
    position: fixed; inset: 0; z-index: 0;
    overflow: hidden;
}

.bg-scene::before {
    content: '';
    position: absolute; inset: -50%;
    width: 200%; height: 200%;
    background:
        radial-gradient(ellipse 600px 600px at 20% 30%, rgba(96, 165, 250, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 75% 60%, rgba(139, 92, 246, 0.10) 0%, transparent 70%),
        radial-gradient(ellipse 400px 400px at 50% 80%, rgba(244, 63, 94, 0.06) 0%, transparent 70%);
    animation: bgDrift 25s ease-in-out infinite alternate;
}

@keyframes bgDrift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    50%  { transform: translate(-30px, 20px) rotate(1deg); }
    100% { transform: translate(20px, -15px) rotate(-0.5deg); }
}

/* Floating orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: orbFloat 20s ease-in-out infinite alternate;
}
.orb-1 { width: 300px; height: 300px; background: rgba(96,165,250,0.3); top: 10%; left: 15%; animation-duration: 22s; }
.orb-2 { width: 250px; height: 250px; background: rgba(139,92,246,0.25); bottom: 15%; right: 10%; animation-delay: -7s; animation-duration: 18s; }
.orb-3 { width: 200px; height: 200px; background: rgba(251,191,36,0.15); top: 60%; left: 60%; animation-delay: -12s; animation-duration: 26s; }

@keyframes orbFloat {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(40px, -30px) scale(1.1); }
    66%  { transform: translate(-20px, 40px) scale(0.95); }
    100% { transform: translate(30px, 20px) scale(1.05); }
}

/* Grid pattern overlay */
.bg-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 30%, transparent 80%);
}

/* ===== MAIN LAYOUT ===== */
.login-page {
    position: relative; z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* ===== GLASS CARD ===== */
.login-card {
    width: 100%; max-width: 420px;
    background: var(--glass-bg);
    backdrop-filter: blur(40px) saturate(1.4);
    -webkit-backdrop-filter: blur(40px) saturate(1.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 40px 36px 32px;
    position: relative;
    overflow: hidden;
    animation: cardAppear 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardAppear {
    from { opacity: 0; transform: translateY(30px) scale(0.97); filter: blur(10px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.login-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

/* ===== LOGO / HEADER ===== */
.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-family: 'JetBrains Mono', monospace;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* ===== BUG STATS BAR ===== */
.bug-stats {
    display: flex;
    gap: 3px;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 28px;
    opacity: 0.7;
    transition: opacity 0.3s;
}
.bug-stats:hover { opacity: 1; }

.bug-stat-segment {
    height: 100%;
    border-radius: 2px;
    transition: flex 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.bug-stats-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    z-index: 50;
    pointer-events: none;
}
.bug-stats:hover .bug-stats-tooltip { display: block; }

/* ===== ALERT ===== */
.login-alert {
    background: rgba(248, 113, 113, 0.10);
    border: 1px solid rgba(248, 113, 113, 0.25);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #fca5a5;
    display: none;
    animation: alertShake 0.4s ease;
}
.login-alert.show { display: block; }

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

/* ===== FORM ===== */
.form-field {
    margin-bottom: 16px;
    position: relative;
}

.form-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 1;
}

.input-wrap svg {
    position: absolute;
    left: 14px;
    width: 18px; height: 18px;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    transition: color 0.25s;
    z-index: 2;
}

.form-input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.form-input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

/* Автозаполнение браузера — принудительно тёмный фон и белый текст */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary) !important;
    -webkit-box-shadow: 0 0 0 1000px rgba(15, 20, 35, 0.95) inset !important;
    box-shadow: 0 0 0 1000px rgba(15, 20, 35, 0.95) inset !important;
    border-color: var(--input-border) !important;
    transition: background-color 5000s ease-in-out 0s;
    caret-color: var(--text-primary);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(0, 0, 0, 0.35);
}

.form-input:focus ~ svg,
.form-input:focus + .pwd-toggle svg:first-child { /* adjacent icon stays muted */ }
.input-wrap:focus-within svg { color: var(--accent); }

/* Password toggle */
.pwd-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 3;
    border-radius: 6px;
}
.pwd-toggle:hover { color: rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, 0.08); }
.pwd-toggle svg { width: 18px; height: 18px; pointer-events: none; position: static; color: inherit; }

/* ===== REMEMBER & FORGOT ===== */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 13px;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    user-select: none;
    transition: color 0.2s;
}
.remember-label:hover { color: var(--text-primary); }

.remember-label input[type="checkbox"] {
    appearance: none;
    width: 16px; height: 16px;
    border: 1.5px solid var(--input-border);
    border-radius: 4px;
    background: var(--input-bg);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}
.remember-label input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.remember-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4.5px; top: 1.5px;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.forgot-link:hover { color: var(--accent); text-decoration: none; }

/* ===== SUBMIT BUTTON ===== */
.btn-login {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--color-primary, #3b6cb4), var(--accent-blue, #5dade2));
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 108, 180, 0.45);
}

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

.btn-login:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.btn-login .btn-text { transition: opacity 0.2s; }
.btn-login.loading .btn-text { opacity: 0; }

.btn-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.btn-login.loading .btn-spinner { opacity: 1; }

.btn-spinner::after {
    content: '';
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Shimmer effect on button */
.btn-login::after {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: none;
}
.btn-login:hover::after {
    animation: shimmer 0.8s ease;
}
@keyframes shimmer {
    from { left: -100%; }
    to   { left: 100%; }
}

/* ===== FOOTER ===== */
.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== FORGOT MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}
.modal-overlay.active { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
    width: 90%; max-width: 400px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 32px;
    animation: modalSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}
.modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.btn-secondary {
    flex: 1;
    padding: 11px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-secondary:hover { background: var(--glass-hover); color: var(--text-primary); }

.btn-accent {
    flex: 1;
    padding: 11px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #0a0e17;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}
.btn-accent:hover { filter: brightness(1.1); }
.btn-accent:disabled { opacity: 0.5; cursor: wait; }

/* ===== TOAST ===== */
.toast-msg {
    position: fixed;
    bottom: 24px; right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    z-index: 200;
    animation: toastIn 0.35s ease, toastOut 0.35s ease 2.6s forwards;
    backdrop-filter: blur(12px);
    max-width: 360px;
}
.toast-success { background: rgba(74,222,128,0.15); border: 1px solid rgba(74,222,128,0.3); color: #4ade80; }
.toast-error   { background: rgba(248,113,113,0.15); border: 1px solid rgba(248,113,113,0.3); color: #fca5a5; }

@keyframes toastIn  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* ===== MOBILE ===== */
@media (max-width: 480px) {
    .login-card { padding: 28px 22px 24px; margin: 10px; }
    .login-logo { font-size: 26px; }
    .form-row { flex-direction: column; gap: 10px; align-items: flex-start; }
}

/* ===== SEASON ICON ===== */
.season-icon {
    position: fixed;
    top: 20px; right: 24px;
    font-size: 36px;
    opacity: 0;
    animation: seasonFade 1.5s ease 1s forwards, seasonFloat 3s ease-in-out 1s infinite alternate;
    pointer-events: none;
    z-index: 10;
}
@keyframes seasonFade { to { opacity: 0.7; } }
@keyframes seasonFloat { from { transform: translateY(0) rotate(-5deg); } to { transform: translateY(-6px) rotate(5deg); } }
