/* ================================================================
   Sulton Tex Group — Login  |  #9c0294 brand purple
   ================================================================ */

:root {
  --brand:        #9c0294;
  --brand-dark:   #6b0165;
  --brand-deep:   #3d0550;   /* medium-dark purple bg */
  --brand-mid:    #4a0a60;
  --brand-glow:   rgba(156,2,148,.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: linear-gradient(160deg, #3d0550 0%, #5a1278 50%, #3d0550 100%);
}

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

.auth-card {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: min(980px, 100%);
  min-height: 600px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(156,2,148,.25),
    0 40px 80px rgba(0,0,0,.55),
    0 0 60px rgba(156,2,148,.15);
}

/* ================================================================
   ЛЕВАЯ ПАНЕЛЬ — тёмный пурпур + ромбовый орнамент
   ================================================================ */
.auth-brand {
  position: relative;
  padding: 52px 44px;
  color: #fff;
  background: linear-gradient(155deg, #1a0028 0%, #280038 60%, #1e0030 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}

/* Ромбиковый узор — слой 1: сама сетка */
.ornament-bg {
  position: absolute;
  inset: 0;
  z-index: 0;

  /* Ромбы из двух диагональных линий */
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(156,2,148,.18) 0px, rgba(156,2,148,.18) 1px,
      transparent 1px, transparent 28px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(156,2,148,.18) 0px, rgba(156,2,148,.18) 1px,
      transparent 1px, transparent 28px
    );

  /* Маска: узор появляется слева и растворяется вправо */
  -webkit-mask-image: linear-gradient(
    to right,
    black 0%,
    black 40%,
    transparent 85%
  );
  mask-image: linear-gradient(
    to right,
    black 0%,
    black 40%,
    transparent 85%
  );
}

/* Плавное свечение за логотипом */
.ornament-bg::after {
  content: "";
  position: absolute;
  top: 30px; left: 30px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(156,2,148,.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 0 12px rgba(156,2,148,.7));
}

.brand-title {
  margin: 0 0 6px;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  letter-spacing: .3px;
  color: #fff;
}

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

/* Разделитель */
.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: #d966d6;
  font-size: 13px;
  flex-shrink: 0;
}

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

/* ================================================================
   ПРАВАЯ ПАНЕЛЬ — форма
   ================================================================ */
.auth-form {
  padding: 52px 44px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

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

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

.form-header p {
  margin: 0 0 24px;
  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: 18px; }

.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: #c0a8c8; }
.form-control:focus  {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(156,2,148,.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: #f3e8ff; color: var(--brand); }

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

.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%, #c024b8 100%);
  box-shadow: 0 4px 18px rgba(156,2,148,.35);
  transition: filter .15s, transform .08s, box-shadow .15s;
}

.btn-primary:hover {
  filter: brightness(1.07);
  box-shadow: 0 6px 24px rgba(156,2,148,.45);
}

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

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

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

/* --- 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) {
  .auth-card {
    grid-template-columns: 1fr;
    min-height: auto;
    width: min(460px, 100%);
  }

  .auth-brand { padding: 36px 32px 28px; }

  .ornament-bg {
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 100%);
  }

  .brand-footer { margin-top: 20px; }
  .auth-brand::after { display: none; }
}

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

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

  .auth-brand { padding: 28px 24px 20px; }
  .auth-form  { padding: 28px 24px; }

  .auth-form::before { margin-bottom: 20px; }
  .form-header h2 { font-size: 21px; }
}
