/* ================================================================
   Petlya — Login  |  #0E6E78 brand teal
   ================================================================ */

:root {
  --brand:        #0E6E78;
  --brand-dark:   #0A5058;
  --brand-deep:   #06333A;   /* medium-dark teal bg */
  --brand-mid:    #0A4A52;
  --brand-glow:   rgba(14,110,120,.45);

  --text:    #0f172a;
  --muted:   #6b7280;
  --surface: #ffffff;
  --border:  #dde1ea;
  --error:   #dc2626;

  --radius: 18px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

/* ===== Body ===== */
body {
  font: 15px/1.5 "Segoe UI", Roboto, system-ui, Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  /* Спокойная «дымка» брендовых цветов: три мягких пятна, без повторяющейся
     плитки — на логине у оператора не должно рябить в глазах.
     Фон намеренно темнее карточки: раньше он был одного тона с брендовой
     панелью, и левая половина карточки растворялась в странице. */
  background-color: #021519;
  background-image:
    radial-gradient(62% 56% at 16% 10%, rgba(23,144,156,.24) 0%, transparent 62%),
    radial-gradient(54% 50% at 88% 20%, rgba(14,110,120,.20) 0%, transparent 60%),
    radial-gradient(72% 62% at 74% 98%, rgba(224,138,60,.10) 0%, transparent 58%),
    linear-gradient(160deg, #04232A 0%, #021519 56%, #031E23 100%);
  background-attachment: fixed;
}

/* ===== Центральный контейнер ===== */
.auth {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: min(920px, 100%);
  min-height: 520px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(1,12,15,.62),
              0 0 0 1px rgba(255,255,255,.07);
}

/* ===== Переключатель языка (верхний правый угол панели формы) ===== */
.lang-switch {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(15,23,42,.05);
  border: 1px solid rgba(15,23,42,.1);
}
.lang-switch form { display: inline-flex; margin: 0; }
.lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font: 600 11.5px/1 "Segoe UI", Roboto, system-ui, sans-serif;
  letter-spacing: .04em;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.lang-btn:hover { background: rgba(15,23,42,.07); color: var(--text); }
.lang-btn.active {
  background: linear-gradient(135deg, var(--brand) 0%, #17909C 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(14,110,120,.35);
}

/* ================================================================
   ЛЕВАЯ ПАНЕЛЬ — тёмный петроль
   ================================================================ */
.auth-brand {
  position: relative;
  padding: 40px 40px;
  color: #fff;
  /* Панель светлее фона страницы — именно этим карточка и «отрывается»
     от неё; белая половина формы даёт второй контраст. */
  background:
    radial-gradient(88% 68% at 10% 4%, rgba(63,184,196,.28) 0%, transparent 62%),
    linear-gradient(155deg, #0E6E78 0%, #0A5058 58%, #0C616B 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}

/* Мягкое свечение за логотипом (орнаментная сетка убрана — фон должен быть
   спокойным, а не рябить ромбами за формой входа) */
.ornament-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }

/* Плавное свечение за логотипом */
.ornament-bg::after {
  content: "";
  position: absolute;
  top: 30px; left: 30px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(14,110,120,.35) 0%, transparent 70%);
  filter: blur(30px);
  pointer-events: none;
}

/* Тонкая брендовая полоса снизу карточки */
.auth-brand::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), transparent);
}

.brand-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Логотип — светлая версия, панель тёмная */
.brand-logo { margin-bottom: 20px; }

.logo-img {
  height: 64px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.35));
}

/* Название уже нарисовано в самом логотипе — повторять его текстом не надо.
   Заголовок оставлен в разметке и скрыт визуально: страница должна иметь h1
   для скринридеров. */
.brand-title {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.brand-subtitle {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: rgba(255,255,255,.68);
}

/* Разделитель */
.brand-subtitle::after {
  content: "";
  display: block;
  width: 44px; height: 2px;
  margin-top: 20px;
  background: linear-gradient(90deg, var(--brand), transparent);
  border-radius: 2px;
}

.brand-points {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 13px;
  flex: 1;
}

.brand-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: rgba(255,255,255,.85);
}

.brand-points i {
  color: #3FB8C4;
  font-size: 13px;
  flex-shrink: 0;
}

.brand-footer {
  margin-top: 32px;
  color: rgba(255,255,255,.35);
  font-size: 12px;
}

/* ================================================================
   ПРАВАЯ ПАНЕЛЬ — форма
   ================================================================ */
.auth-form {
  position: relative;
  padding: 40px 40px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

/* Тонкий акцент сверху */
.auth-form::before {
  content: "";
  display: block;
  height: 3px;
  width: 52px;
  background: linear-gradient(90deg, var(--brand), #E08A3C);
  border-radius: 2px;
  margin-bottom: 20px;
}

.form-header h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  color: #06333A;
}

.form-header p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

/* ===== Сообщения ===== */
.messages { margin-bottom: 16px; display: grid; gap: 8px; }

.msg {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.msg i { flex-shrink: 0; }
.msg-error   { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.msg-success { background: #f0fdf4; border-color: #86efac; color: #166534; }
.msg-warning { background: #fffbeb; border-color: #fcd34d; color: #92400e; }

/* ===== Поля ===== */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

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

.input-icon {
  position: absolute;
  left: 14px;
  color: #b0b8c5;
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
  transition: color .15s;
}

.form-control {
  width: 100%;
  height: 46px;
  padding: 0 44px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}

.form-control::placeholder { color: #b8c0cc; }
.form-control:hover  { border-color: #9dc4c8; }
.form-control:focus  {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14,110,120,.12);
}
.form-control:focus + .input-icon,
.input-wrap:focus-within .input-icon { color: var(--brand); }

.form-control.is-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(220,38,38,.10);
}

.field-error {
  display: block;
  margin-top: 5px;
  color: var(--error);
  font-size: 12px;
}

/* Кнопка показа пароля */
.toggle-password {
  position: absolute;
  right: 10px;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.toggle-password:hover { background: #e6f2f3; color: var(--brand); }

/* ===== Запомнить ===== */
.form-row {
  display: flex;
  align-items: center;
  margin: 2px 0 16px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  width: 16px; height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}

/* ===== Кнопка входа ===== */
.btn-primary {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: linear-gradient(135deg, var(--brand) 0%, #17909C 100%);
  box-shadow: 0 4px 18px rgba(14,110,120,.35);
  transition: filter .15s, transform .08s, box-shadow .15s;
}

.btn-primary:hover {
  filter: brightness(1.07);
  box-shadow: 0 6px 24px rgba(14,110,120,.45);
}

.btn-primary:active {
  transform: translateY(1px);
  filter: brightness(.96);
}

/* ===== Низ формы ===== */
.form-footer {
  margin-top: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.visitor-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 14px;
  text-align: left;
  background: #f2f9f9;
  border: 1px solid #d3e7e9;
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.visitor-note i {
  margin-top: 2px;
  color: var(--brand);
  flex-shrink: 0;
}

.btn-site {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 11px 16px;
  border: 1.5px solid var(--brand);
  border-radius: 12px;
  background: var(--surface);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .18s, color .18s;
}

.btn-site:hover {
  background: var(--brand);
  color: #fff;
}

/* ================================================================
   АНИМАЦИИ
   ================================================================ */

/* --- Keyframes --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(32px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

@keyframes glowPulse {
  0%, 100% { opacity: .35; transform: scale(1); }
  50%       { opacity: .55; transform: scale(1.15); }
}

/* --- Карточка целиком --- */
.auth-card {
  animation: cardIn .55s cubic-bezier(.22,.68,0,1.2) both;
}

/* --- Левая панель: элементы появляются слева последовательно --- */
.brand-logo      { animation: fadeLeft .5s .15s ease both; }
.brand-title     { animation: fadeLeft .5s .25s ease both; }
.brand-subtitle  { animation: fadeLeft .5s .32s ease both; }

.brand-points li {
  opacity: 0;
  animation: fadeLeft .45s ease both;
}
.brand-points li:nth-child(1) { animation-delay: .40s; }
.brand-points li:nth-child(2) { animation-delay: .50s; }
.brand-points li:nth-child(3) { animation-delay: .60s; }
.brand-points li:nth-child(4) { animation-delay: .70s; }
.brand-points li:nth-child(5) { animation-delay: .80s; }
.brand-points li:nth-child(6) { animation-delay: .90s; }

.brand-footer { animation: fadeLeft .45s 1s ease both; }

/* --- Правая панель: элементы появляются снизу --- */
.form-header    { animation: fadeUp .45s .30s ease both; }
.messages       { animation: fadeUp .4s  .35s ease both; }
.form-group     {
  opacity: 0;
  animation: fadeUp .45s ease both;
}
/* username — первый инпут */
.form-group:nth-of-type(1) { animation-delay: .40s; }
/* password — второй инпут */
.form-group:nth-of-type(2) { animation-delay: .52s; }

.form-row    { animation: fadeUp .4s  .64s ease both; }
.btn-primary { animation: fadeUp .45s .74s ease both; }
.form-footer { animation: fadeUp .4s  .85s ease both; }

/* --- Пульсация свечения за логотипом (декоративно) --- */
.ornament-bg::after {
  animation: glowPulse 4s ease-in-out infinite;
}

/* Отключаем анимации для пользователей с prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .auth-card, .brand-logo, .brand-title, .brand-subtitle,
  .brand-points li, .brand-footer, .form-header, .messages,
  .form-group, .form-row, .btn-primary, .form-footer,
  .ornament-bg::after {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ================================================================
   АДАПТИВ
   ================================================================ */
@media (max-width: 860px) {
  /* Карточка по центру по вертикали */
  body, .auth { place-items: center; }

  .auth-card {
    grid-template-columns: 1fr;
    min-height: auto;
    width: min(420px, 100%);
  }

  /* Брендовая панель → тонкая горизонтальная полоса: только лого
     (название читается в самом логотипе) */
  .auth-brand { padding: 14px 22px; }
  .brand-top {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .brand-logo { margin-bottom: 0; }
  .logo-img { height: 40px; }
  .brand-subtitle { display: none; }
  .brand-points,
  .brand-footer { display: none; }
  .auth-brand::after { display: none; }

  /* Форма — компактнее */
  .auth-form { padding: 18px 24px 24px; }
  /* Переключатель языка — отдельной строкой сверху справа, без наложения на заголовок */
  .auth-form::before { display: none; }
  .lang-switch {
    position: static;
    align-self: flex-end;
    margin: 0 0 10px;
  }
  .form-header h2 { font-size: 21px; margin-bottom: 4px; }
  .form-header p { font-size: 13px; margin-bottom: 16px; }
  .form-group { margin-bottom: 13px; }
  .form-control { height: 44px; }
  .form-row { margin: 4px 0 14px; }
}

@media (max-width: 480px) {
  body, .auth { padding: 8px; }

  .auth-card { width: 100%; border-radius: 14px; }

  /* Брендовая полоса — минимальная */
  .auth-brand { padding: 9px 14px; }
  .logo-img { height: 30px; }
  .brand-title { font-size: 15px; }

  /* Форма — максимально плотная компоновка */
  .auth-form { padding: 12px 14px 14px; }
  .lang-switch { margin: 0 0 6px; }
  .form-header h2 { font-size: 18px; margin-bottom: 1px; }
  .form-header p { font-size: 11.5px; margin-bottom: 10px; }
  .form-group { margin-bottom: 8px; }
  .form-group label { margin-bottom: 3px; font-size: 12px; }
  .form-control { height: 40px; font-size: 14px; }
  .form-row { margin: 0 0 10px; }
  .btn-primary { height: 44px; }

  /* Подвал — компактно */
  .form-footer { margin-top: 10px; }
  .form-footer > small { font-size: 10.5px; }
  .visitor-note { margin-top: 6px; padding: 7px 9px; font-size: 10.5px; gap: 6px; line-height: 1.35; }
  .btn-site { margin-top: 6px; padding: 8px 12px; font-size: 11.5px; }

  /* Переключатель языка — мельче, чтобы не наезжал на заголовок */
  .lang-switch { top: 10px; right: 10px; padding: 2px; }
  .lang-btn { padding: 5px 9px; font-size: 11px; }
}
