/* ═══════════════════════════════════════════════════════
   NERVE CENTER // CYBERPUNK DARK GLOW AESTHETIC
   ═══════════════════════════════════════════════════════ */

:root {
  --bg: #0a0a0f;
  --bg2: #0d0d15;
  --card-bg: rgba(12, 12, 22, 0.85);
  --card-border: rgba(0, 255, 255, 0.12);
  --card-border-hover: rgba(0, 255, 255, 0.3);
  --cyan: #00ffff;
  --cyan-dim: #006677;
  --magenta: #ff00ff;
  --magenta-dim: #660066;
  --green: #00ff88;
  --green-dim: #005533;
  --red: #ff3355;
  --yellow: #ffcc00;
  --orange: #ff8800;
  --text: #c8d6e5;
  --text-dim: #5a6a7a;
  --glow-cyan: 0 0 20px rgba(0, 255, 255, 0.3), 0 0 60px rgba(0, 255, 255, 0.1);
  --glow-magenta: 0 0 20px rgba(255, 0, 255, 0.3), 0 0 60px rgba(255, 0, 255, 0.1);
  --glow-green: 0 0 15px rgba(0, 255, 136, 0.3);
  --font-head: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  overflow-x: hidden;
}

/* Scanlines overlay */
.scanlines {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* Grid background */
.grid-bg {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.app {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
}

/* ── Header ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-glyph {
  font-size: 42px;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: var(--glow-cyan); opacity: 1; }
  50% { text-shadow: 0 0 30px rgba(0,255,255,0.6), 0 0 80px rgba(0,255,255,0.2); opacity: 0.9; }
}

.header h1 {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: 4px;
}

.subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
}

.status-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 8px rgba(255, 204, 0, 0.6);
  animation: blink 1.5s ease-in-out infinite;
}

.status-pill.connected .dot {
  background: var(--green);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
  animation: none;
}

.status-pill.disconnected .dot {
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 51, 85, 0.6);
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.clock {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--magenta);
  text-shadow: var(--glow-magenta);
  letter-spacing: 2px;
}

/* ── Dashboard Grid ── */
.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  border-color: var(--card-border-hover);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.05);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 2px;
  border-bottom: 1px solid var(--card-border);
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.card-header .glyph {
  color: var(--magenta);
  text-shadow: var(--glow-magenta);
}

.card-header .header-val {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--green);
  text-shadow: var(--glow-green);
}

.card-body {
  padding: 16px;
}

/* ── Info Rows ── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.info-row .lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.info-row .val {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  text-align: right;
}

.info-row .val.small {
  font-size: 10px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Gauges ── */
.gauge-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
  height: 140px;
}

.gauge-wrap canvas {
  position: absolute;
}

.gauge-label {
  position: relative;
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
}

/* ── Bars ── */
.bar-wrap { padding: 8px 0; }

.bar-bg {
  width: 100%;
  height: 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
  border-radius: 3px;
  transition: width 0.5s ease;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
  position: relative;
}

.bar-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan), 0 0 20px var(--cyan);
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ── Sparklines ── */
.sparkline-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-top: 12px;
  margin-bottom: 4px;
}

.sparkline {
  width: 100%;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

/* ── Network ── */
.net-rates {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.rate-box {
  flex: 1;
  text-align: center;
  padding: 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
}

.rate-box.rx { border-color: rgba(0, 255, 136, 0.2); }
.rate-box.tx { border-color: rgba(255, 0, 255, 0.2); }

.rate-arrow {
  font-size: 18px;
  margin-bottom: 4px;
}

.rate-box.rx .rate-arrow { color: var(--green); text-shadow: var(--glow-green); }
.rate-box.tx .rate-arrow { color: var(--magenta); text-shadow: var(--glow-magenta); }

.rate-value {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.rate-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-top: 2px;
}

.net-totals {
  display: flex;
  justify-content: space-around;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.net-totals strong { color: var(--text); }

/* ── Connections ── */
.conn-grid {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.conn-stat {
  flex: 1;
  text-align: center;
  padding: 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
}

.conn-num {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
}

.conn-lbl {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-top: 4px;
}

.ports-header {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ports-list {
  font-family: var(--font-mono);
  font-size: 11px;
  max-height: 140px;
  overflow-y: auto;
}

.port-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.port-num { color: var(--cyan); }
.port-proc { color: var(--text-dim); }

/* ── Processes ── */
.proc-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
}

.proc-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--card-border);
}

.proc-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.proc-table tr:hover td {
  background: rgba(0, 255, 255, 0.03);
}

.cpu-hot { color: var(--red); text-shadow: 0 0 8px rgba(255, 51, 85, 0.4); }
.cpu-warm { color: var(--yellow); }
.cpu-cool { color: var(--green); }

/* ── Services ── */
.svc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.svc-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}

.svc-dot.active {
  background: var(--green);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.svc-dot.inactive {
  background: var(--red);
  box-shadow: 0 0 10px rgba(255, 51, 85, 0.5);
}

.svc-name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.svc-status {
  font-family: var(--font-mono);
  font-size: 11px;
}

.svc-status.active { color: var(--green); }
.svc-status.inactive { color: var(--red); }

.svc-pid {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ── Security ── */
.val.danger { color: var(--red); text-shadow: 0 0 8px rgba(255, 51, 85, 0.4); }
.val.warning { color: var(--yellow); }
.val.safe { color: var(--green); text-shadow: var(--glow-green); }

/* ── Logs ── */
.log-stream {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}

.log-line {
  padding: 2px 6px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-line.error {
  color: var(--red);
  background: rgba(255, 51, 85, 0.05);
  border-left: 2px solid var(--red);
}

.log-line.warn {
  color: var(--yellow);
  background: rgba(255, 204, 0, 0.03);
  border-left: 2px solid var(--yellow);
}

.log-line.info {
  color: var(--text-dim);
  border-left: 2px solid rgba(255, 255, 255, 0.05);
}

/* ── Footer ── */
.footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
  border-top: 1px solid var(--card-border);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 2px; }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .dashboard { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .dashboard { grid-template-columns: 1fr; }
  .header { flex-direction: column; gap: 12px; text-align: center; }
  .header-left { flex-direction: column; }
  .header h1 { font-size: 18px; }
}

/* Card spanning */
.card-net { grid-column: span 2; }
.card-logs { grid-column: span 2; }

@media (max-width: 1200px) {
  .card-net, .card-logs { grid-column: span 1; }
}

/* ── Animations ── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  animation: fade-in 0.4s ease-out both;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.5s; }

/* Data pulse animation on update */
@keyframes data-pulse {
  0% { box-shadow: inset 0 0 0 1px rgba(0, 255, 255, 0.3); }
  100% { box-shadow: inset 0 0 0 1px transparent; }
}

.card.pulse {
  animation: data-pulse 0.5s ease-out;
}
