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

:root {
  --bg:       #08080d;
  --surface:  #0f0f17;
  --surface2: #141420;
  --border:   #1c1c2e;
  --border2:  #252538;
  --accent:   #8b7cf8;
  --accent2:  #f76a8c;
  --green:    #3ddc84;
  --yellow:   #f5c542;
  --red:      #ff5f5f;
  --blue:     #5ab4ff;
  --text:     #e8e8f2;
  --sub:      #a0a0c0;
  --muted:    #5a5a7a;
  --mono:     'JetBrains Mono', monospace;
  --sans:     'Syne', sans-serif;
  --radius:   10px;
  --shadow:   0 4px 24px rgba(0,0,0,.4);
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── LOGIN ─────────────────────────────────────────────── */
#login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 999;
}

.login-card {
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 44px 40px;
  box-shadow: var(--shadow);
}

.login-title {
  font-size: 24px; font-weight: 800; letter-spacing: -.5px;
  background: linear-gradient(130deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.login-sub {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin-bottom: 36px;
}

.form-label {
  display: block; font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: 1.2px; text-transform: uppercase;
  margin-bottom: 8px;
}

.form-input {
  display: block; width: 100%;
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: 8px; padding: 11px 14px;
  font-family: var(--mono); font-size: 13px; color: var(--text);
  outline: none; transition: border-color .15s;
  margin-bottom: 20px;
}
.form-input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; border: none; border-radius: 8px; cursor: pointer;
  font-family: var(--sans); font-weight: 700; transition: opacity .12s;
}
.btn:hover { opacity: .85; }
.btn:active { opacity: .7; }
.btn-primary { background: var(--accent); color: #fff; padding: 11px 20px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 11px; }

.form-error {
  font-family: var(--mono); font-size: 11px; color: var(--red);
  margin-top: 10px; min-height: 16px; text-align: center;
}

/* ── APP SHELL ─────────────────────────────────────────── */
#app {
  display: none;
  height: 100vh;
  flex-direction: column;
}
#app.visible { display: flex; }

/* ── TOPBAR ────────────────────────────────────────────── */
.topbar {
  height: 54px; min-height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-logo {
  font-size: 15px; font-weight: 800; letter-spacing: -.3px;
  background: linear-gradient(130deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.topbar-sep { width: 1px; height: 22px; background: var(--border2); flex-shrink: 0; }

.topbar-title { font-size: 13px; font-weight: 700; color: var(--sub); flex: 1; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.last-updated {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  white-space: nowrap;
}

.status-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 20px; padding: 4px 10px;
  font-family: var(--mono); font-size: 10px; color: var(--sub);
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}
.status-dot.error { background: var(--red); animation: none; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── BODY ──────────────────────────────────────────────── */
.body {
  display: flex; flex: 1; overflow: hidden;
}

/* ── SIDEBAR ───────────────────────────────────────────── */
.sidebar {
  width: 200px; min-width: 200px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase;
  padding: 12px 16px 5px;
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 16px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-left: 2px solid transparent;
  transition: all .1s; user-select: none;
}
.nav-item:hover { color: var(--sub); background: rgba(139,124,248,.05); }
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(139,124,248,.08); }
.nav-icon { width: 16px; text-align: center; font-size: 13px; flex-shrink: 0; }

.sidebar-bottom {
  margin-top: auto; padding: 14px 16px 0;
  border-top: 1px solid var(--border);
}
.sidebar-bottom .nav-item { padding-left: 0; }

/* ── MAIN CONTENT ──────────────────────────────────────── */
.main {
  flex: 1; overflow-y: auto;
  padding: 24px;
}

/* ── PAGES ─────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── STAT GRID ─────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  transition: border-color .15s;
}
.stat-card:hover { border-color: var(--border2); }
.stat-label {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px;
}
.stat-value {
  font-family: var(--mono); font-size: 30px; font-weight: 700;
  line-height: 1;
}

/* ── CARD ──────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.card-title { font-size: 12px; font-weight: 700; }
.card-meta  { font-family: var(--mono); font-size: 10px; color: var(--muted); }

.card-toolbar {
  display: flex; align-items: center; gap: 8px;
}

/* ── SEARCH ────────────────────────────────────────────── */
.search {
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: 6px; padding: 5px 10px;
  font-family: var(--mono); font-size: 11px; color: var(--text);
  outline: none; transition: border-color .12s; width: 160px;
}
.search:focus { border-color: var(--accent); }
.search::placeholder { color: var(--muted); }

/* ── TABLE ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%; border-collapse: collapse;
  font-family: var(--mono); font-size: 11px;
}
thead th {
  padding: 8px 14px; text-align: left;
  font-size: 9px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--surface2);
}
tbody tr {
  border-bottom: 1px solid rgba(255,255,255,.03);
  transition: background .08s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(139,124,248,.04); }
td {
  padding: 9px 14px;
  max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle;
}
.td-dim { color: var(--sub); }
.td-muted { color: var(--muted); font-size: 10px; }

/* ── BADGES ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 4px;
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  letter-spacing: .5px; text-transform: uppercase; white-space: nowrap;
}
.bg-green  { background: rgba(61,220,132,.12);  color: var(--green);  }
.bg-red    { background: rgba(255,95,95,.12);   color: var(--red);    }
.bg-yellow { background: rgba(245,197,66,.12);  color: var(--yellow); }
.bg-accent { background: rgba(139,124,248,.14); color: var(--accent); }
.bg-blue   { background: rgba(90,180,255,.12);  color: var(--blue);   }
.bg-muted  { background: rgba(90,90,122,.12);   color: var(--sub);    }

/* ── STATES ────────────────────────────────────────────── */
.state-row td {
  padding: 32px; text-align: center;
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); border-bottom: none;
}
.state-row:hover { background: transparent !important; }

/* ── COLORS ────────────────────────────────────────────── */
.c-accent { color: var(--accent); }
.c-green  { color: var(--green); }
.c-yellow { color: var(--yellow); }
.c-red    { color: var(--red); }
.c-blue   { color: var(--blue); }
.c-muted  { color: var(--muted); }

/* ── SERVER LIST ───────────────────────────────────────── */
.server-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  transition: background .08s;
}
.server-row:last-child { border-bottom: none; }
.server-row:hover { background: rgba(139,124,248,.03); }
.server-name { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.server-id   { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.server-count { font-family: var(--mono); font-size: 28px; font-weight: 700; color: var(--green); }

/* ── PLAYER LOOKUP ─────────────────────────────────────── */
.lookup-bar {
  display: flex; gap: 10px; margin-bottom: 20px;
}
.lookup-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border2);
  border-radius: 8px; padding: 10px 14px;
  font-family: var(--mono); font-size: 13px; color: var(--text);
  outline: none; transition: border-color .12s;
}
.lookup-input:focus { border-color: var(--accent); }
.lookup-input::placeholder { color: var(--muted); }

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── GRID BACKGROUNDS ──────────────────────────────────── */
.grid-bg {
  background-image:
    linear-gradient(rgba(139,124,248,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139,124,248,.025) 1px, transparent 1px);
  background-size: 32px 32px;
}
