/* ============================================================
   VPN Admin — design tokens
   Идея: сеть узлов в темноте — приглушённый графитово-синий фон,
   сигналы читаются как мягкое неоновое свечение (аква = активность/
   успех, фиолетовый = акцент/действие), а не декоративная подсветка.
   ============================================================ */
:root {
  --bg:            #0A0E16;
  --bg-elevated:   #0F1420;
  --surface:       #131A29;
  --surface-hover: #1A2436;
  --border:        #212B3D;
  --border-soft:   #1A2334;

  --text:          #E7ECF6;
  --text-muted:    #8792A6;
  --text-faint:    #566079;

  --accent:        #5EEAD4;   /* аква — активность, успех, primary-действия */
  --accent-soft:   rgba(94, 234, 212, 0.14);
  --accent2:       #A78BFA;   /* мягкий фиолет — второстепенный акцент */
  --accent2-soft:  rgba(167, 139, 250, 0.14);

  --danger:        #FB7185;
  --danger-soft:   rgba(251, 113, 133, 0.14);
  --warn:          #FBBF24;
  --warn-soft:     rgba(251, 191, 36, 0.14);

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.35);
  --shadow-glow-accent: 0 0 0 1px rgba(94, 234, 212, 0.25), 0 0 24px rgba(94, 234, 212, 0.18);
  --shadow-glow-accent2: 0 0 0 1px rgba(167, 139, 250, 0.25), 0 0 24px rgba(167, 139, 250, 0.16);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 15% -10%, rgba(94,234,212,0.06), transparent 60%),
              radial-gradient(1000px 500px at 100% 0%, rgba(167,139,250,0.05), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, .brand, nav.sidebar .label {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: -0.01em;
}

code, .mono, .status-ip, pre { font-family: "JetBrains Mono", ui-monospace, monospace; }

a { color: var(--accent); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: #8ff5e3; }

::selection { background: var(--accent-soft); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Layout: sidebar + content ---------- */
.app-shell { display: flex; min-height: 100vh; }

nav.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg));
  border-right: 1px solid var(--border-soft);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

nav.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 22px;
  font-weight: 600; font-size: 16px;
  color: var(--text);
}
nav.sidebar .brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 2px var(--accent);
}
.wordmark { font-family: "Space Grotesk", sans-serif; font-weight: 700; letter-spacing: -0.02em; }
.wordmark-accent { color: var(--accent); text-shadow: 0 0 18px rgba(94,234,212,0.35); }

nav.sidebar .nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 14px; font-weight: 500;
  transition: background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
  position: relative;
}
nav.sidebar .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
nav.sidebar .nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}
nav.sidebar .nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
}
nav.sidebar .nav-item.active svg { opacity: 1; }

nav.sidebar .nav-spacer { flex: 1; }
nav.sidebar .nav-item.danger:hover { background: var(--danger-soft); color: var(--danger); }

main.content { flex: 1; padding: 34px 40px; max-width: 1040px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.card:hover { border-color: var(--border); }

.server-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.server-card .label { font-weight: 600; font-size: 15px; }
.server-card .ip { color: var(--text-muted); font-size: 13px; }

/* ---------- Status pill + signature "pulse" ---------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 9px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  border: 1px solid transparent;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; position: relative; flex-shrink: 0; }

.status-online { background: rgba(52,211,153,0.12); color: #4ADE80; border-color: rgba(52,211,153,0.25); }
.status-online .status-dot { background: #4ADE80; box-shadow: 0 0 8px #4ADE80; }
.status-online .status-dot::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1.5px solid #4ADE80; opacity: 0; animation: pulse-ring 2.2s var(--ease) infinite;
}
@keyframes pulse-ring {
  0%   { transform: scale(0.6); opacity: .55; }
  80%  { transform: scale(1.9); opacity: 0; }
  100% { opacity: 0; }
}

.status-offline { background: var(--danger-soft); color: var(--danger); border-color: rgba(251,113,133,0.25); }
.status-offline .status-dot { background: var(--danger); }

.status-provisioning, .status-unknown { background: var(--warn-soft); color: var(--warn); border-color: rgba(251,191,36,0.25); }
.status-provisioning .status-dot, .status-unknown .status-dot {
  background: var(--warn); animation: soft-blink 1.4s ease-in-out infinite;
}
@keyframes soft-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; color: var(--text-muted); margin: 14px 0 6px; font-weight: 500; }

input, select {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14.5px;
  transition: border-color .22s var(--ease), box-shadow .22s var(--ease), background .22s var(--ease);
}
input::placeholder { color: var(--text-faint); }
input:hover { border-color: #2C3A54; }
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

.password-field { position: relative; }
.password-field input { padding-right: 42px; }
.password-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--text-faint); display: flex; box-shadow: none;
  transition: color .2s var(--ease);
}
.password-toggle:hover { color: var(--accent); }
.password-toggle svg { width: 18px; height: 18px; }

button, .btn {
  background: linear-gradient(135deg, var(--accent), #46C7B4);
  color: #04211C;
  border: none;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14.5px;
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), filter .2s var(--ease);
}
button:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow-accent); filter: brightness(1.05); }
button:active { transform: translateY(0); }

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent2); box-shadow: var(--shadow-glow-accent2); }

/* ---------- Flash messages ---------- */
.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.flash-error { background: var(--danger-soft); color: #FCA5AF; border-color: rgba(251,113,133,0.25); }
.flash-success { background: var(--accent-soft); color: var(--accent); border-color: rgba(94,234,212,0.25); }

/* ---------- Login page ---------- */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-shell::before, .login-shell::after {
  content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%;
  filter: blur(110px); opacity: 0.20; animation: drift 16s ease-in-out infinite alternate;
}
.login-shell::before { background: var(--accent); top: -160px; left: -160px; }
.login-shell::after { background: var(--accent2); bottom: -180px; right: -160px; animation-delay: -8s; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.08); }
}

.login-card {
  position: relative; z-index: 1;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  box-shadow: var(--shadow-soft);
  animation: rise .5s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 19px; }
.login-card .brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.login-card .subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
.login-card button { width: 100%; margin-top: 20px; }

small.hint { color: var(--text-faint); font-size: 12px; }
hr { border: none; border-top: 1px solid var(--border-soft); margin: 22px 0; }
pre { background: var(--bg-elevated); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 12.5px; color: #FCA5AF; }
ol { color: var(--text-muted); font-size: 14px; line-height: 1.8; }
