/* ================================================================
   WINVPN Stream — админ-панель
   ================================================================ */

:root {
  --bg: #07070f;
  --surface: rgba(255, 255, 255, 0.045);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f2f1fa;
  --text-dim: rgba(242, 241, 250, 0.62);
  --text-faint: rgba(242, 241, 250, 0.4);
  --gold-2: #f5c26b;
  --gold-3: #d4973a;
  --violet-2: #8b5cf6;
  --grad-gold: linear-gradient(120deg, #ffe3a3, #d4973a);
  --danger: #ef4444;
  --ok: #34d399;
  --radius-md: 20px;
  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(139, 92, 246, 0.45); }

/* ---------- Фон ---------- */

.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1000px 600px at 80% -10%, rgba(109, 40, 217, 0.16), transparent 60%),
    var(--bg);
}
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.45; }
.orb-gold {
  width: 420px; height: 420px; top: -140px; right: -60px;
  background: radial-gradient(circle at 30% 30%, rgba(245, 194, 107, 0.45), transparent 70%);
  animation: drift 24s ease-in-out infinite alternate;
}
.orb-violet {
  width: 520px; height: 520px; bottom: -180px; left: -120px;
  background: radial-gradient(circle at 60% 40%, rgba(139, 92, 246, 0.4), transparent 70%);
  animation: drift 28s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(-60px, 50px); }
}

/* ---------- Экран входа ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 44px 40px;
  border-radius: 26px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8), 0 0 80px rgba(139, 92, 246, 0.12);
  animation: card-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  text-align: center;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.login-logo {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #16101f;
  background: var(--grad-gold);
  box-shadow: 0 12px 30px -8px rgba(245, 194, 107, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.login-logo svg { width: 26px; height: 26px; }
.login-logo.small { width: 42px; height: 42px; margin: 0; border-radius: 13px; }
.login-logo.small svg { width: 19px; height: 19px; }

.login-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-sub {
  color: var(--text-dim);
  font-size: 13.5px;
  margin-bottom: 28px;
}

.login-back {
  display: inline-block;
  margin-top: 18px;
  color: var(--text-faint);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.25s;
}
.login-back:hover { color: var(--gold-2); }

/* ---------- Поля ---------- */

.field {
  display: block;
  text-align: left;
  margin-bottom: 16px;
}

.field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 7px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(245, 194, 107, 0.55);
  box-shadow: 0 0 0 3px rgba(245, 194, 107, 0.14);
  background: rgba(0, 0, 0, 0.4);
}

.form-error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14.5px;
  padding: 13px 24px;
  border-radius: 13px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s, background 0.3s, opacity 0.3s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  color: #16101f;
  background: var(--grad-gold);
  box-shadow: 0 12px 28px -10px rgba(245, 194, 107, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 36px -10px rgba(245, 194, 107, 0.65); }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); border-color: var(--border-strong); }

.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 13.5px; border-radius: 11px; }

/* ---------- Панель ---------- */

.dash { animation: card-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }

.dash-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(18px, 4vw, 44px);
  background: rgba(7, 7, 15, 0.7);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dash-brand { display: flex; align-items: center; gap: 13px; }
.dash-brand-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.dash-brand-sub { color: var(--text-faint); font-size: 12.5px; }
.dash-actions { display: flex; gap: 10px; }

.dash-main {
  width: min(860px, 100% - 36px);
  margin: 34px auto 80px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.card {
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.card h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.card-subtitle {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-2);
  margin: 26px 0 14px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.card-actions { margin-top: 26px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.security-note {
  margin-top: 12px;
  color: var(--text-faint);
  font-size: 13px;
}

/* ---------- Статус-пилюля ---------- */

.status-pill {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--surface);
  white-space: nowrap;
  transition: all 0.4s;
}
.status-pill.live {
  color: #d1fae5;
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.12);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.2);
}
.status-pill.off {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
}

/* ---------- Переключатели ---------- */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 18px;
}
.switch-row.compact { padding: 14px 20px; }

.switch-info strong { display: block; font-size: 15px; margin-bottom: 3px; }
.switch-info p { color: var(--text-dim); font-size: 13px; max-width: 52ch; }

.switch { position: relative; display: inline-block; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-track {
  display: block;
  width: 56px;
  height: 31px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.35s, border-color 0.35s, box-shadow 0.35s;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.35s;
}

.switch input:checked + .switch-track {
  background: linear-gradient(120deg, rgba(245, 194, 107, 0.9), rgba(139, 92, 246, 0.9));
  border-color: transparent;
  box-shadow: 0 0 22px rgba(245, 194, 107, 0.35);
}
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(25px);
  background: #fff;
}

/* ---------- Редактор списков ---------- */

.list-editor { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }

.list-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  animation: card-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.list-item-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.list-item input,
.list-item textarea,
.list-item select {
  width: 100%;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
  resize: vertical;
}
.list-item input:focus,
.list-item textarea:focus,
.list-item select:focus {
  border-color: rgba(245, 194, 107, 0.5);
  box-shadow: 0 0 0 3px rgba(245, 194, 107, 0.12);
}

.list-item select option { background: #14142a; }

.mini-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-faint);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.25s, transform 0.25s;
}
.icon-btn:hover { background: rgba(239, 68, 68, 0.22); transform: scale(1.05); }

/* ---------- Тосты ---------- */

.toasts {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: rgba(20, 20, 40, 0.9);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.8);
  animation: toast-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toast.ok { border-color: rgba(52, 211, 153, 0.5); }
.toast.err { border-color: rgba(239, 68, 68, 0.5); }
.toast.out { animation: toast-out 0.4s ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(30px); }
}

/* ---------- Адаптив ---------- */

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .list-item-row { grid-template-columns: 1fr; }
  .list-item-row .icon-btn { justify-self: end; }
  .dash-header { flex-wrap: wrap; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

/* Атрибут hidden должен побеждать display из правил компонентов */
[hidden] { display: none !important; }
