:root {
  --bg: #0a0c10;
  --surface: #12151f;
  --surface2: #1a1e2e;
  --surface3: #222840;
  --border: #2a2f45;
  --border-hover: #3e4560;
  --text: #e2e8f0;
  --text-muted: #7a8499;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --blue: #3b82f6;
  --orange: #f97316;
  --upg-green: #39ff14;
  --upg-green-dim: #25b00d;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Maintenance Banner ─────────────────────────────── */
.maintenance-banner {
  background: rgba(245,158,11,0.12);
  border-bottom: 1px solid rgba(245,158,11,0.35);
  color: var(--yellow);
  text-align: center;
  padding: 10px 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.maintenance-banner.hidden { display: none; }

/* ── Header ─────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  position: sticky;
  top: 0;
  background: rgba(10,12,16,0.94);
  backdrop-filter: blur(10px);
  z-index: 100;
}
.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
  justify-content: center;
}
.logo-img {
  height: 46px;
  width: 46px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(57,255,20,0.3));
}
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.logo-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
}
.logo-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--upg-green);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Overall Status Pill */
.overall-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.overall-status.status-ok    { color: var(--green); border-color: rgba(34,197,94,0.25); background: rgba(34,197,94,0.08); }
.overall-status.status-partial{ color: var(--yellow); border-color: rgba(245,158,11,0.25); background: rgba(245,158,11,0.08); }
.overall-status.status-down  { color: var(--red);   border-color: rgba(239,68,68,0.25); background: rgba(239,68,68,0.08); }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-ok .status-dot { animation: pulse-green 2s infinite; }
@keyframes pulse-green {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* ── Main ───────────────────────────────────────────── */
main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 52px;
}
section h2 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Server / Web Row List ──────────────────────────── */
.servers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Row card */
.server-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 22px;
  display: grid;
  grid-template-columns: 220px 1fr 90px auto;
  align-items: center;
  gap: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.server-row:hover { border-color: var(--border-hover); box-shadow: 0 2px 16px rgba(0,0,0,0.25); }
.server-row.is-down { border-color: rgba(239,68,68,0.28); }
.server-row.is-maintenance { border-color: rgba(245,158,11,0.28); }

/* Row identity (name + map + badge) */
.row-identity {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.row-name-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.row-name { font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; }
.row-map  { font-size: 12px; color: var(--text-muted); }
.row-wipe {
  font-size: 11px;
  color: var(--upg-green);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  opacity: 0.9;
}
.row-wipe svg { flex-shrink: 0; }

/* Raid status pill */
.raid-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 3px;
  width: fit-content;
}
.raid-on  { background: rgba(239,68,68,0.15);   color: var(--red);        border: 1px solid rgba(239,68,68,0.25); }
.raid-off { background: rgba(122,132,153,0.12); color: var(--text-muted); border: 1px solid rgba(122,132,153,0.2); }

/* Row players */
.row-players { min-width: 0; }
.player-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  align-items: center;
}
.player-bar-label .count-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--text);
}
.queue-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(245,158,11,0.18);
  color: var(--yellow);
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.player-bar-bg {
  height: 6px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.player-bar-fill {
  height: 100%;
  background: var(--upg-green-dim);
  border-radius: 4px;
  transition: width 0.6s ease;
  min-width: 2px;
}
.player-bar-fill.high { background: var(--orange); }
.player-bar-fill.full { background: var(--red); }

/* Row uptime */
.row-uptime {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  white-space: nowrap;
}
.uptime-pct { font-weight: 600; font-size: 14px; }
.uptime-pct.good { color: var(--green); }
.uptime-pct.warn { color: var(--yellow); }
.uptime-pct.bad  { color: var(--red); }
.uptime-label { font-size: 11px; color: var(--text-muted); }

/* Row actions */
.row-actions { display: flex; gap: 8px; flex-wrap: nowrap; align-items: center; }

/* Status badges */
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}
.badge-online      { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-offline     { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-maintenance { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-unknown     { background: rgba(122,132,153,0.15); color: var(--text-muted); }

/* Buttons */
.btn {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-hover); background: var(--surface3); }
.btn:disabled { opacity: 0.45; cursor: default; }

.btn-join {
  border-color: rgba(57,255,20,0.35);
  color: var(--upg-green);
  background: rgba(57,255,20,0.06);
}
.btn-join:hover {
  border-color: rgba(57,255,20,0.6);
  background: rgba(57,255,20,0.12);
  color: var(--upg-green);
}

/* ── Skeleton ───────────────────────────────────────── */
.skeleton-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 70px;
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  0%,100% { opacity: 1; } 50% { opacity: 0.45; }
}

/* ── Active Alerts Section ──────────────────────────── */
#active-section h2 {
  color: var(--yellow);
  border-bottom-color: rgba(245,158,11,0.3);
}

/* ── Incidents ──────────────────────────────────────── */
.incidents-list { display: flex; flex-direction: column; gap: 12px; }
.incident-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.incident-card.is-active {
  border-color: rgba(239,68,68,0.4);
  box-shadow: 0 0 12px rgba(239,68,68,0.08);
}
.incident-card.is-maintenance-active {
  border-color: rgba(245,158,11,0.4);
  box-shadow: 0 0 12px rgba(245,158,11,0.08);
}
.incident-header {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  gap: 12px;
}
.incident-header:hover { background: rgba(255,255,255,0.02); }
.incident-title { font-weight: 600; font-size: 15px; }
.incident-meta  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge-investigating { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-identified    { background: rgba(249,115,22,0.15); color: var(--orange); }
.badge-monitoring    { background: rgba(59,130,246,0.15); color: var(--blue); }
.badge-resolved      { background: rgba(34,197,94,0.15); color: var(--green); }
.incident-date { font-size: 12px; color: var(--text-muted); }
.chevron { color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; }
.chevron.open { transform: rotate(180deg); }

.incident-updates { display: none; border-top: 1px solid var(--border); padding: 0 22px; }
.incident-updates.open { display: block; }
.incident-update-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 14px;
}
.incident-update-item:last-child { border-bottom: none; }
.update-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.update-dot.investigating { background: var(--red); }
.update-dot.identified    { background: var(--orange); }
.update-dot.monitoring    { background: var(--blue); }
.update-dot.resolved      { background: var(--green); }
.update-content .update-msg    { font-size: 14px; margin-bottom: 4px; }
.update-content .update-footer { font-size: 12px; color: var(--text-muted); }

/* Maintenance card */
.maintenance-card {
  background: rgba(245,158,11,0.05);
  border: 1px solid rgba(245,158,11,0.22);
  border-radius: var(--radius);
  padding: 16px 22px;
}
.maintenance-card.is-active-maintenance {
  border-color: rgba(245,158,11,0.5);
  box-shadow: 0 0 12px rgba(245,158,11,0.08);
}
.maintenance-card h4 { font-size: 15px; margin-bottom: 4px; }
.maintenance-window { font-size: 13px; color: var(--text-muted); }
.active-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(245,158,11,0.18);
  color: var(--yellow);
  margin-left: 8px;
  vertical-align: middle;
}

/* Empty state */
.empty-state { color: var(--text-muted); font-size: 14px; }
.hidden { display: none !important; }

/* ── Footer ─────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 20px 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.footer-left {
  display: flex;
  align-items: center;
}
.footer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}
.footer-link:hover { color: var(--upg-green); }
.footer-logo {
  height: 24px;
  width: 24px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(57,255,20,0.2));
}
.footer-center {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}
.footer-right {
  display: flex;
  justify-content: flex-end;
}

/* Refresh button */
.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-refresh:hover { border-color: var(--border-hover); background: var(--surface3); color: var(--text); }
.btn-refresh:disabled { opacity: 0.45; cursor: default; }
#refresh-icon.spinning {
  animation: spin 0.7s linear infinite;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Modals ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-mods { max-width: 520px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close-btn:hover { color: var(--text); }
.modal-body { padding: 20px 22px; }

/* Uptime heatmap */
.heatmap { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.heatmap-row { display: flex; align-items: center; gap: 8px; }
.heatmap-label { font-size: 11px; color: var(--text-muted); width: 34px; flex-shrink: 0; text-align: right; cursor: default; }
.heatmap-cells { display: flex; gap: 3px; flex-wrap: nowrap; }
.heatmap-cell {
  width: 14px; height: 20px;
  border-radius: 3px;
  background: var(--surface3);
  cursor: pointer;
  transition: opacity 0.1s, transform 0.1s;
  flex-shrink: 0;
}
.heatmap-cell:hover { opacity: 1 !important; transform: scaleY(1.15); }
.heatmap-cell.up   { background: var(--upg-green-dim); opacity: 0.85; }
.heatmap-cell.down { background: var(--red); opacity: 0.75; }

.heatmap-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-style: italic;
}

/* Rich heatmap tooltip */
.heatmap-tooltip {
  position: absolute;
  z-index: 50;
  background: #1e2235;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  min-width: 180px;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  font-size: 13px;
}
.tt-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}
.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  line-height: 1.5;
}
.tt-row:last-child { margin-bottom: 0; }
.tt-label { color: var(--text-muted); }
.tt-val   { font-weight: 600; color: var(--text); }
.tt-warn  { color: var(--yellow); }
.tt-muted { color: var(--text-muted); font-style: italic; }

/* Mods modal */
.mod-modal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  margin-bottom: 8px;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.mod-modal-item:hover { border-color: var(--border-hover); background: var(--surface3); }
.mod-modal-name { font-size: 14px; font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-modal-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mod-count-note { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

/* ── Footer copyright ───────────────────────────────── */
.footer-copy {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 28px 20px;
  border-top: 1px solid var(--border);
  opacity: 0.7;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 800px) {
  .server-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
  }
  .row-identity { grid-column: 1; grid-row: 1; }
  .row-uptime   { grid-column: 2; grid-row: 1; align-items: flex-end; }
  .row-players  { grid-column: 1 / -1; grid-row: 2; }
  .row-actions  { grid-column: 1 / -1; grid-row: 3; }
}
@media (max-width: 640px) {
  header { padding: 0 16px; }
  main   { padding: 28px 16px 48px; }
  footer { grid-template-columns: 1fr 1fr; padding: 16px; }
  .footer-center { grid-column: 1 / -1; text-align: left; order: 3; }
  .logo-name { font-size: 15px; }
}
