/* ═══════════════════════════════════════════════════════════════
   Arma Reforger Panel · Design System
   Deep dark, single accent, generous whitespace
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Surfaces — tiered like macOS */
  --bg-0: #000000;
  --bg-1: #0b0b0d;
  --bg-2: #131316;
  --bg-3: #1c1c21;
  --bg-4: #26262c;

  /* Text */
  --text-1: rgba(255, 255, 255, 0.94);
  --text-2: rgba(255, 255, 255, 0.62);
  --text-3: rgba(255, 255, 255, 0.38);
  --text-4: rgba(255, 255, 255, 0.22);

  /* Separators */
  --sep-1: rgba(255, 255, 255, 0.06);
  --sep-2: rgba(255, 255, 255, 0.10);
  --sep-3: rgba(255, 255, 255, 0.16);

  /* Accent — single system-blue */
  --accent:        #0a84ff;
  --accent-hover:  #409cff;
  --accent-soft:   rgba(10, 132, 255, 0.14);
  --accent-glow:   rgba(10, 132, 255, 0.35);

  /* Status */
  --ok:    #30d158;
  --warn:  #ff9f0a;
  --err:   #ff453a;
  --info:  #64d2ff;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadows */
  --shadow-1: 0 1px 0 rgba(255,255,255,0.04) inset, 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 1px 0 rgba(255,255,255,0.05) inset, 0 8px 24px rgba(0,0,0,0.4);
  --shadow-focus: 0 0 0 4px var(--accent-soft);

  /* Type */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-0);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  line-height: 1.5;
}
body { min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

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

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sep-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--sep-3); background-clip: padding-box; }

/* ───────────────────────────────────────────────────────────────
   Layout
   ─────────────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--sep-1);
  padding: 28px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 12px 28px;
}
.brand-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent) 0%, #5ab1ff 100%);
  border-radius: 10px;
  display: grid; place-items: center;
  box-shadow: 0 4px 14px -2px var(--accent-glow);
}
.brand-mark svg { width: 20px; height: 20px; color: white; }
.brand-name {
  font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 11px; color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase;
}

.nav-group-label {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sep-1); color: var(--text-1); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.nav-item.active .nav-icon { color: var(--accent-hover); }
.nav-icon { width: 18px; height: 18px; flex: none; color: var(--text-3); }

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--sep-1);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px;
}
.user-chip { color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.user-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.logout-btn {
  background: transparent; border: 0; color: var(--text-3); cursor: pointer;
  font-size: 13px; padding: 6px 10px; border-radius: var(--r-sm);
}
.logout-btn:hover { color: var(--text-1); background: var(--sep-1); }

.main {
  display: flex; flex-direction: column;
  min-width: 0;
  background: var(--bg-0);
}

.topbar {
  height: 64px;
  padding: 0 40px;
  border-bottom: 1px solid var(--sep-1);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 5;
  background: rgba(0,0,0,0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.page-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.status-pill {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--bg-3);
  border: 1px solid var(--sep-2);
  padding: 6px 14px 6px 12px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3);
  transition: background .2s;
}
.status-pill[data-status="running"]  .status-dot { background: var(--ok);   box-shadow: 0 0 0 3px rgba(48,209,88,0.18); animation: pulse 2s ease-in-out infinite; }
.status-pill[data-status="starting"] .status-dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(255,159,10,0.18); animation: pulse 1.2s ease-in-out infinite; }
.status-pill[data-status="stopping"] .status-dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.status-pill[data-status="crashed"]  .status-dot { background: var(--err);  box-shadow: 0 0 0 3px rgba(255,69,58,0.18); }
.status-pill[data-status="stopped"]  .status-dot { background: var(--text-3); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.content {
  padding: 40px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  min-width: 0;
}

/* Pages */
.page { display: none; }
.page.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 28px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.025em; }
.page-header p  { font-size: 14px; color: var(--text-2); margin: 0; }

/* ───────────────────────────────────────────────────────────────
   Cards
   ─────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-2);
  border: 1px solid var(--sep-1);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.card + .card { margin-top: 20px; }

.card-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--sep-1);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card-desc  { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.card-body  { padding: 24px; }

/* Stat grid (dashboard) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat {
  background: var(--bg-2);
  border: 1px solid var(--sep-1);
  border-radius: var(--r-lg);
  padding: 20px 22px;
}
.stat-label { font-size: 12px; color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase; }
.stat-value { font-size: 28px; font-weight: 600; margin-top: 8px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub   { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* ───────────────────────────────────────────────────────────────
   Buttons
   ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit;
  font-size: 14px; font-weight: 500;
  padding: 9px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--sep-2);
  background: var(--bg-3);
  color: var(--text-1);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-4); border-color: var(--sep-3); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger {
  background: rgba(255,69,58,0.12); border-color: rgba(255,69,58,0.3); color: #ff6b61;
}
.btn-danger:hover { background: rgba(255,69,58,0.2); border-color: rgba(255,69,58,0.5); }

.btn-ghost {
  background: transparent; border-color: transparent; color: var(--text-2);
}
.btn-ghost:hover { background: var(--sep-1); color: var(--text-1); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { width: 16px; height: 16px; }

.button-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ───────────────────────────────────────────────────────────────
   Forms
   ─────────────────────────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px 24px;
}
.form-section + .form-section { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--sep-1); }
.form-section-title {
  font-size: 12px; font-weight: 600;
  color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label {
  font-size: 13px; font-weight: 500; color: var(--text-2);
  display: flex; justify-content: space-between; align-items: center;
}
.field .hint { font-size: 12px; color: var(--text-3); font-weight: 400; }

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
select,
textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg-1);
  border: 1px solid var(--sep-2);
  border-radius: var(--r-md);
  padding: 10px 13px;
  transition: border-color .15s, box-shadow .15s, background .15s;
  width: 100%;
}
input:hover, select:hover, textarea:hover { border-color: var(--sep-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
  background: var(--bg-2);
}

textarea { font-family: var(--font-mono); font-size: 13px; resize: vertical; min-height: 160px; }

/* Toggle switch */
.toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle input { display: none; }
.toggle-track {
  width: 38px; height: 22px;
  background: var(--bg-4);
  border-radius: 999px;
  position: relative;
  transition: background .2s;
  border: 1px solid var(--sep-2);
}
.toggle-track::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: white;
  transition: transform .2s cubic-bezier(.4,.2,.2,1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.toggle input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle input:checked + .toggle-track::after {
  transform: translateX(16px);
}
.toggle-label { font-size: 14px; color: var(--text-1); }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--sep-1);
}
.table th {
  font-size: 12px; font-weight: 500;
  color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase;
}
.table tbody tr:hover { background: var(--sep-1); }
.table td.mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); }

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

/* ───────────────────────────────────────────────────────────────
   Console
   ─────────────────────────────────────────────────────────────── */

.console-wrap {
  background: #050507;
  border: 1px solid var(--sep-1);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  height: calc(100vh - 240px);
  min-height: 400px;
}
.console-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--sep-1);
  font-size: 13px;
}
.console-head .dots { display: flex; gap: 6px; }
.console-head .dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-4); }
.console-head .dots span:nth-child(1) { background: #ff5f57; }
.console-head .dots span:nth-child(2) { background: #febc2e; }
.console-head .dots span:nth-child(3) { background: #28c840; }
.console-head .meta { color: var(--text-3); font-family: var(--font-mono); font-size: 12px; }

.console-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: rgba(255,255,255,0.78);
}
.console-body .ln { white-space: pre-wrap; word-break: break-word; }
.console-body .ln .ts { color: var(--text-4); margin-right: 10px; font-size: 11px; }
.console-body .ln.err    { color: #ff8e86; }
.console-body .ln.info   { color: var(--info); }
.console-body .ln.warn   { color: var(--warn); }
.console-body .ln .panel { color: var(--accent-hover); font-weight: 500; }

.console-input {
  display: flex; align-items: center; gap: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--sep-1);
  background: var(--bg-1);
}
.console-input .prompt { color: var(--accent); font-family: var(--font-mono); font-size: 13px; margin-right: 10px; }
.console-input input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 0;
}
.console-input input:focus { outline: none; box-shadow: none; background: transparent; border: none; }

/* ───────────────────────────────────────────────────────────────
   Progress + hints
   ─────────────────────────────────────────────────────────────── */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-1);
  border: 1px solid var(--sep-1);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, #5ab1ff 100%);
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width .4s cubic-bezier(.3,0,.2,1);
}

.hint-box {
  background: var(--bg-1);
  border: 1px solid var(--sep-1);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
}
.hint-box code {
  background: var(--bg-3);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--text-1);
  font-size: 12px;
}
.hint-box strong { color: var(--text-1); font-weight: 600; }

/* ───────────────────────────────────────────────────────────────
   Toast
   ─────────────────────────────────────────────────────────────── */

.toast-wrap {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-3);
  border: 1px solid var(--sep-2);
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  box-shadow: var(--shadow-2);
  animation: slideIn .25s cubic-bezier(.4,.0,.2,1);
  max-width: 360px;
  display: flex; align-items: flex-start; gap: 10px;
}
.toast.ok  { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--err); }
.toast .t-icon { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.toast.ok .t-icon  { color: var(--ok); }
.toast.err .t-icon { color: var(--err); }

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

/* ───────────────────────────────────────────────────────────────
   Login page
   ─────────────────────────────────────────────────────────────── */

.login-shell {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 40px;
  background:
    radial-gradient(ellipse at top, rgba(10,132,255,0.12), transparent 55%),
    radial-gradient(ellipse at bottom, rgba(10,132,255,0.05), transparent 55%),
    var(--bg-0);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--sep-2);
  border-radius: var(--r-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-2);
}
.login-logo {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent) 0%, #5ab1ff 100%);
  border-radius: 14px;
  margin: 0 auto 24px;
  display: grid; place-items: center;
  box-shadow: 0 10px 30px -10px var(--accent-glow);
}
.login-logo svg { width: 28px; height: 28px; color: white; }
.login-card h1 {
  font-size: 22px; font-weight: 600;
  text-align: center; margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.login-card .subtitle {
  text-align: center; color: var(--text-2); font-size: 14px; margin-bottom: 28px;
}
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card .btn-primary { width: 100%; padding: 11px; margin-top: 6px; }
.login-error {
  padding: 10px 14px;
  background: rgba(255,69,58,0.1);
  border: 1px solid rgba(255,69,58,0.3);
  color: #ff8e86;
  border-radius: var(--r-md);
  font-size: 13px;
  display: none;
}
.login-error.show { display: block; }

/* ───────────────────────────────────────────────────────────────
   Responsive
   ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto;
    flex-direction: row; overflow-x: auto;
    padding: 12px 16px;
  }
  .brand { padding: 0 16px 0 0; border-right: 1px solid var(--sep-1); margin-right: 8px; }
  .nav-group-label { display: none; }
  .sidebar-footer { display: none; }
  .content, .topbar { padding-left: 20px; padding-right: 20px; }
}
