*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --border: 1px solid rgba(148, 163, 184, 0.12);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --error: #ef4444;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #0a0e1a;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image:
    linear-gradient(165deg, #0f172a 0%, #0d1524 30%, #0a1018 60%, #060a10 100%),
    radial-gradient(ellipse 120% 80% at 20% 20%, rgba(0,212,255,.02) 0%, transparent 50%),
    radial-gradient(ellipse 80% 60% at 80% 80%, rgba(72,209,204,.015) 0%, transparent 50%);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'%3E%3Cg fill='none' stroke='%2300d4ff' stroke-opacity='0.04' stroke-width='0.5'%3E%3Cpath d='M0 100 L400 100 M0 200 L400 200 M0 300 L400 300 M100 0 L100 400 M200 0 L200 400 M300 0 L300 400'/%3E%3Crect x='50' y='50' width='60' height='40' rx='2'/%3E%3Crect x='290' y='50' width='60' height='40' rx='2'/%3E%3Crect x='50' y='310' width='60' height='40' rx='2'/%3E%3Cpath d='M170 170 L230 170 L230 230 L170 230 Z'/%3E%3Cpath d='M0 0 L20 20 M380 20 L400 0 M0 380 L20 400 M380 400 L400 380'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 400px 400px;
  background-position: 0 0;
  pointer-events: none;
}

body::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, transparent 35%, rgba(0,212,255,.015) 50%, transparent 65%, transparent 100%);
  pointer-events: none;
}

.login-wrapper { position: relative; z-index: 1; width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 8px; font-size: 1.75rem; font-weight: 700; letter-spacing: 0.05em; }
.login-subtitle { text-align: center; font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 28px; }

.login-card {
  background: var(--bg-card);
  border: var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}

.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-field { position: relative; }
.login-field label { display: block; font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 6px; }

.login-field .input-wrap {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: var(--border); border-radius: 8px;
  padding: 0 14px; transition: border-color .2s;
}
.login-field .input-wrap:focus-within { border-color: var(--accent); outline: none; }
.login-field .input-wrap svg { flex-shrink: 0; opacity: 0.5; }
.login-field input {
  flex: 1; padding: 12px 0; background: transparent; border: none;
  color: var(--text); font-size: 1rem; font-family: inherit;
}
.login-field input::placeholder { color: var(--text-muted); }
.login-field input:focus { outline: none; }

.login-remember { display: flex; align-items: center; gap: 10px; }
.login-remember input { width: 18px; height: 18px; accent-color: var(--accent); }
.login-remember span { font-size: 0.875rem; color: var(--text-muted); }

.login-btn {
  width: 100%; padding: 14px; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: background .2s; margin-top: 8px;
}
.login-btn:hover { background: var(--accent-hover); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  color: var(--error); font-size: 0.875rem; margin-top: 12px;
  padding: 10px 12px; background: rgba(239,68,68,.1);
  border-radius: 8px; display: none;
}
.login-error.visible { display: block; }

.login-loading { display: none; margin-top: 12px; text-align: center; }
.login-loading.visible { display: block; }
.login-loading span {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--text-muted); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) {
  .login-card { padding: 24px 20px; }
  .login-field input { font-size: 16px; }
}


.login-field .input-wrap {
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Эффект свечения при фокусе */
.login-field .input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    outline: none;
}

/* Иконка становится ярче при фокусе */
.login-field .input-wrap:focus-within svg {
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

/* Текст внутри поля */
.login-field input {
    transition: color 0.2s ease;
}

/* Плейсхолдер: делаем чуть более плавное исчезновение при фокусе */
.login-field input::placeholder {
    transition: color 0.2s ease;
}
.login-field input:focus::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

/* Ниже всё то что касается показа пароля на клиенте. */

/* ---------- КНОПКА ГЛАЗА ---------- */
#toggle-visual {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
}

#toggle-visual svg {
  display: block;
  width: 20px;
  height: 20px;
  color: var(--text-muted);      /* серый цвет по умолчанию */
  opacity: 0.6;
  transition: opacity 0.2s ease, color 0.2s ease;
}

#toggle-visual:hover svg {
  opacity: 0.9;
}

#toggle-visual.active svg {
  opacity: 1;
  color: var(--accent);          /* акцентный (синий) цвет при активации */
}

/* Видимость иконок */
#toggle-visual .eye-open  { display: block; }
#toggle-visual .eye-closed { display: none;  }

#toggle-visual.active .eye-open  { display: none;  }
#toggle-visual.active .eye-closed { display: block; }

/* Защита от автозаполнения браузера: фон и цвет текста всегда наши */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  /* Заливаем поверх браузерного фона нашим тёмным цветом */
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset !important;
  /* Цвет текста – наш белый */
  -webkit-text-fill-color: var(--text) !important;
  /* Цвет каретки (курсора) тоже белый */
  caret-color: var(--text) !important;
  /* Убираем возможную границу, которую браузер может добавить */
  border: none !important;
  /* Огромная задержка смены фона, чтобы браузер не анимировал свой цвет */
  transition: background-color 5000s ease-in-out 0s;
}
/* Убираем любую рамку/обводку, которую браузер может добавить */
#toggle-visual:focus,
#toggle-visual:focus-visible,
#toggle-visual:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

/* ---------- Разделитель "или" ---------- */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px 0;   /* отступ сверху и снизу */
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, rgba(148, 163, 184, 0.2));
}

.login-divider span {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  font-weight: 400;
  text-transform: lowercase;
  white-space: nowrap;
}

/* ---------- Кнопка OAuth (Yandex) ---------- */
/* ---------- Кнопка OAuth (Yandex) в стиле GitHub ---------- */
/* ---------- Кнопка OAuth (Yandex) ---------- */
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 0 16px;
  height: 44px;
  margin-top: 16px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
  background-color: #1e293b;
  border: 1px solid #334155;   /* рамка */
  color: #c6cdd6; 
}
.oauth-btn:hover {
  background-color: #f3f4f6;
  border-color: #8b949e;
}

/* ---------- Тёмная тема (безопасное переопределение) ---------- */

  .oauth-btn:hover {
    background-color: #334155;   /* Чуть светлее при наведении */
    border-color: #475569;
    color: #e2e8f0;              /* Текст становится ярче */
  }

.oauth-hint {
  margin: 8px 0 0 0;
  font-size: 13px;
  text-align: center;
  line-height: 1.4;
  color: #57606a; /* Светлая тема */
}

@media (prefers-color-scheme: dark) {
  .oauth-hint {
    color: #64748b; /* Тусклый текст подсказки для тёмной темы */
  }
}