/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0a0b0f;
  --surface:    #111318;
  --surface-2:  #191c24;
  --surface-3:  #21252f;
  --border:     rgba(255,255,255,0.07);
  --border-hi:  rgba(255,255,255,0.13);

  --accent:     #f0a500;
  --accent-dim: rgba(240,165,0,0.12);
  --accent-glow:rgba(240,165,0,0.30);

  --green:  #22c55e;
  --red:    #ef4444;
  --yellow: #eab308;
  --blue:   #60a5fa;

  --text-1: #f0f0f0;
  --text-2: #9da3b0;
  --text-3: #5a6070;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --font-body: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,11,15,0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; gap: 28px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-badge {
  background: var(--accent); color: #000;
  font-weight: 700; font-size: 12px;
  letter-spacing: 0.08em; padding: 3px 9px;
  border-radius: var(--r-sm);
}
.logo-text { color: var(--text-2); font-weight: 500; font-size: 14px; }

.nav { display: flex; gap: 2px; }
.nav-btn {
  background: none; border: none;
  color: var(--text-3); font-family: var(--font-body);
  font-size: 14px; font-weight: 500;
  padding: 6px 14px; border-radius: var(--r-sm);
  cursor: pointer; transition: color .15s, background .15s;
}
.nav-btn:hover { color: var(--text-1); background: var(--surface-2); }
.nav-btn.active { color: var(--accent); background: var(--accent-dim); }

.header-status {
  margin-left: auto; display: flex;
  align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2);
}

/* ── Pulse dot ───────────────────────────────────────────────────────────── */
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3); display: inline-block;
}
.pulse-dot.online {
  background: var(--green);
  animation: pulse 2s infinite;
}
.pulse-dot.offline { background: var(--red); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.6); }
  70%  { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.main { max-width: 1400px; margin: 0 auto; padding: 32px 24px 80px; }
.view { display: none; }
.view.active { display: block; }

.section-header {
  display: flex; flex-wrap: wrap;
  align-items: center; gap: 16px; margin-bottom: 28px;
}
.section-title { font-size: 22px; font-weight: 600; flex-shrink: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.section-label {
  display: block;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 8px;
}

/* ── Inputs & buttons ────────────────────────────────────────────────────── */
.input-field {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-family: var(--font-mono); font-size: 13px;
  padding: 8px 12px; outline: none; width: 240px;
  transition: border .15s;
}
.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: var(--text-3); }

.btn {
  border: none; border-radius: var(--r-sm);
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  padding: 8px 16px; cursor: pointer;
  transition: opacity .15s, background .15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--accent); color: #000; }
.btn-ghost {
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text-1); border-color: var(--border-hi); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Cards grid ──────────────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px; margin-bottom: 32px;
}

.server-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px; cursor: pointer;
  transition: border-color .2s, transform .15s, box-shadow .2s;
  position: relative; overflow: hidden;
}
.server-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-dim) 0%, transparent 60%);
  opacity: 0; transition: opacity .2s;
}
.server-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-glow);
}
.server-card:hover::before { opacity: 1; }

.card-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.card-icon {
  width: 48px; height: 48px; border-radius: var(--r-sm);
  object-fit: cover; flex-shrink: 0;
}
.card-icon-placeholder {
  width: 48px; height: 48px; border-radius: var(--r-sm);
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.card-name { font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.card-address { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

.status-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; padding: 3px 9px;
  border-radius: 20px; flex-shrink: 0;
}
.status-badge.online  { background: rgba(34,197,94,0.15); color: var(--green); }
.status-badge.offline { background: rgba(239,68,68,0.15); color: var(--red); }

.card-bar-wrap {
  background: var(--surface-2); border-radius: 4px;
  height: 4px; margin: 10px 0; overflow: hidden;
}
.card-bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 4px; transition: width .6s ease;
}
.card-footer {
  display: flex; justify-content: space-between;
  align-items: center; font-size: 12px; color: var(--text-3);
}
.card-players {
  font-size: 20px; font-weight: 700; color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
.card-players span { font-size: 13px; font-weight: 400; color: var(--text-3); }

/* ── Skeleton ────────────────────────────────────────────────────────────── */
.skeleton-card {
  height: 150px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg);
  animation: shimmer 1.4s infinite;
  background-size: 200% 100%;
  background-image: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Detail panel ────────────────────────────────────────────────────────── */
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  padding: 28px; margin-top: 8px;
  animation: slideDown .2s ease;
  display: flex; flex-direction: column; gap: 20px;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* header */
.detail-header {
  display: flex; align-items: flex-start; gap: 18px;
}
.detail-icon-wrap { flex-shrink: 0; position: relative; }
.detail-icon, .detail-icon-placeholder {
  width: 72px; height: 72px; border-radius: var(--r-md);
  object-fit: cover;
}
.detail-icon-placeholder {
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.detail-meta { flex: 1; min-width: 0; }
.detail-name { font-size: 21px; font-weight: 700; margin-bottom: 4px; }
.detail-address {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-3); margin-bottom: 10px;
}
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 11px; padding: 2px 9px;
  border-radius: 20px; border: 1px solid var(--border-hi); color: var(--text-2);
}
.badge.accent   { border-color: var(--accent); color: var(--accent); }
.badge.green    { border-color: var(--green);  color: var(--green); }
.badge.red      { border-color: var(--red);    color: var(--red); }
.badge.blue     { border-color: var(--blue);   color: var(--blue); }

.detail-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* description */
.detail-desc {
  font-size: 13px; color: var(--text-2); line-height: 1.65;
  border-left: 3px solid var(--accent); padding-left: 14px;
}

/* tags */
.tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  font-size: 11px; padding: 3px 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-2);
}

/* stat row */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.stat-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px;
}
.stat-label {
  display: block; font-size: 10px; font-weight: 600;
  letter-spacing: 0.07em; color: var(--text-3);
  text-transform: uppercase; margin-bottom: 6px;
}
.stat-value {
  display: block; font-size: 18px; font-weight: 700;
  color: var(--text-1); font-variant-numeric: tabular-nums;
}
.stat-value.accent { color: var(--accent); }
.stat-value.mono { font-family: var(--font-mono); font-size: 14px; }

/* flags */
.flags-row { display: flex; flex-wrap: wrap; gap: 8px; }
.flag-item {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 13px;
  font-size: 13px; color: var(--text-2);
}
.flag-item .flag-icon { font-size: 15px; }
.flag-item.flag-on  { border-color: rgba(34,197,94,0.3); color: var(--green); }
.flag-item.flag-off { opacity: .45; }

/* endpoint */
.endpoint-row { display: flex; align-items: center; gap: 14px; }
.endpoint-code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 6px 12px;
  color: var(--text-2); word-break: break-all;
}

/* owner */
.owner-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; background: var(--surface-2);
  border-radius: var(--r-md); border: 1px solid var(--border);
}
.owner-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.owner-name { font-weight: 600; font-size: 14px; }
.owner-sub  { font-size: 12px; color: var(--text-3); }
.owner-link {
  font-size: 12px; color: var(--accent); text-decoration: none; margin-left: auto;
}
.owner-link:hover { text-decoration: underline; }

/* players preview */
.players-preview {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.players-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.players-preview-header .section-label { margin-bottom: 0; }
.players-preview-body { max-height: 280px; overflow-y: auto; }

.preview-player-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.preview-player-row:last-child { border-bottom: none; }
.preview-player-row:hover { background: var(--surface-3); }
.preview-id {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--accent); width: 28px; flex-shrink: 0;
}
.preview-name { flex: 1; color: var(--text-1); font-weight: 500; }
.preview-ping { font-family: var(--font-mono); font-size: 11px; }

.empty-msg-sm { padding: 24px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--surface-2); color: var(--text-3);
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; padding: 12px 16px;
  text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  color: var(--text-2); vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.empty-row { text-align: center; color: var(--text-3); padding: 40px !important; }

.player-name { color: var(--text-1); font-weight: 500; }
.player-id { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }

.ping-badge {
  font-family: var(--font-mono); font-size: 12px;
  padding: 2px 8px; border-radius: 20px;
}
.ping-low  { background: rgba(34,197,94,0.15); color: var(--green); }
.ping-mid  { background: rgba(234,179,8,0.15);  color: var(--yellow); }
.ping-high { background: rgba(239,68,68,0.15);  color: var(--red); }

.identifiers { display: flex; flex-wrap: wrap; gap: 4px; }
.id-chip {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--surface-3); border-radius: 4px;
  padding: 2px 6px; color: var(--text-3);
}

/* ── Resources ───────────────────────────────────────────────────────────── */
.resource-stats {
  display: flex; gap: 12px; margin-bottom: 20px;
  font-size: 13px; color: var(--text-2);
}
.resource-stat-num { font-size: 20px; font-weight: 700; color: var(--text-1); margin-right: 4px; }
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.resource-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 14px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-2);
  transition: border-color .15s, color .15s;
}
.resource-item:hover { border-color: var(--accent); color: var(--text-1); }
.resource-item.hidden { display: none; }
.empty-msg { color: var(--text-3); font-size: 14px; grid-column: 1/-1; padding: 40px; text-align: center; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast-area {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--surface-2); border: 1px solid var(--border-hi);
  border-radius: var(--r-md); padding: 12px 18px;
  font-size: 13px; color: var(--text-1);
  animation: fadeIn .25s ease; min-width: 240px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.toast.error   { border-left: 3px solid var(--red); }
.toast.success { border-left: 3px solid var(--green); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner { gap: 12px; padding: 0 16px; }
  .nav-btn { padding: 6px 10px; font-size: 13px; }
  .main { padding: 20px 16px 60px; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .toolbar { flex-direction: column; width: 100%; }
  .input-field { width: 100%; }
  .detail-header { flex-wrap: wrap; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
