/* ═══════════════════════════════════════════
   APIHubOS — Operating System Theme
   ═══════════════════════════════════════════ */

:root {
  --bg: #050510;
  --bg2: #0a0a1a;
  --fg: #e8eaf6;
  --fg2: #8890b5;
  --accent: #00d4ff;
  --accent-dim: rgba(0, 212, 255, 0.12);
  --amber: #f59e0b;
  --green: #10b981;
  --red: #ef4444;
  --purple: #a78bfa;
  --border: rgba(0, 212, 255, 0.1);
  --card: rgba(10, 10, 26, 0.8);
  --card-border: rgba(0, 212, 255, 0.15);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Figtree', system-ui, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── NAV ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(5, 5, 16, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}
.nav-logo-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-logo-icon svg { width: 18px; height: 18px; }
.nav-links { display: flex; align-items: center; gap: 0.5rem; }
.nav-link {
  color: var(--fg2);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover, .nav-link.active { color: var(--fg); background: var(--accent-dim); }
.nav-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(0, 212, 255, 0.3);
  padding: 3px 9px;
  border-radius: 4px;
}

/* ── LAYOUT ── */
.page-wrapper {
  padding-top: 64px;
  min-height: 100vh;
}
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}
.page-header {
  padding: 2.5rem 0 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.page-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}
.page-subtitle { color: var(--fg2); font-size: 0.9rem; margin-top: 4px; }
.page-meta { text-align: right; }
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--green);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 4px 12px;
  border-radius: 20px;
}
.live-dot {
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity: 0.4; } }

/* ── METRICS GRID ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.metric-card.mr {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.08), var(--card));
}
.metric-card.subscribers::before {
  background: linear-gradient(90deg, var(--purple), transparent);
}
.metric-card.calls::before {
  background: linear-gradient(90deg, var(--amber), transparent);
}
.metric-card.sellers::before {
  background: linear-gradient(90deg, var(--green), transparent);
}
.metric-label {
  font-size: 0.75rem;
  color: var(--fg2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.metric-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.metric-value.accent { color: var(--accent); }
.metric-value.purple { color: var(--purple); }
.metric-value.amber { color: var(--amber); }
.metric-value.green { color: var(--green); }
.metric-delta {
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 20px;
}
.metric-delta.up { background: rgba(16,185,129,0.12); color: var(--green); }
.metric-delta.down { background: rgba(239,68,68,0.12); color: var(--red); }
.metric-delta.neutral { background: rgba(136,144,181,0.1); color: var(--fg2); }

/* ── CONTENT GRID ── */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title svg { width: 16px; height: 16px; color: var(--accent); }
.card-body { padding: 0; }
.card-eyebrow {
  font-size: 0.72rem;
  color: var(--fg2);
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0, 212, 255, 0.06);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 4px;
}

/* ── STATS TABLE ── */
.stats-table { width: 100%; }
.stats-table thead th {
  padding: 10px 1.25rem;
  text-align: left;
  font-size: 0.72rem;
  color: var(--fg2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.stats-table thead th:last-child,
.stats-table thead th:nth-last-child(2) { text-align: right; }
.stats-table tbody tr { border-bottom: 1px solid var(--border); }
.stats-table tbody tr:last-child { border-bottom: none; }
.stats-table tbody td {
  padding: 12px 1.25rem;
  font-size: 0.875rem;
}
.stats-table tbody td:first-child { color: var(--fg); font-weight: 500; }
.stats-table tbody td:last-child,
.stats-table tbody td:nth-last-child(2) { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.api-row { cursor: default; }
.api-row:hover td { background: var(--accent-dim); }
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}
.rank-1 { background: rgba(245,158,11,0.2); color: var(--amber); }
.rank-2 { background: rgba(167,139,250,0.2); color: var(--purple); }
.rank-3 { background: rgba(0,212,255,0.15); color: var(--accent); }
.rank-n { background: rgba(136,144,181,0.1); color: var(--fg2); }

/* ── HEALTH GRID ── */
.health-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.health-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.health-item:nth-child(even) { border-right: none; }
.health-item:last-child,
.health-item:nth-last-child(2) { border-bottom: none; }
.health-label {
  font-size: 0.72rem;
  color: var(--fg2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.health-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 700;
}
.health-value.good { color: var(--green); }
.health-value.warn { color: var(--amber); }
.health-value.bad { color: var(--red); }
.health-sub { font-size: 0.75rem; color: var(--fg2); margin-top: 2px; }

/* ── TOP SELLERS LIST ── */
.seller-list { padding: 0.5rem 0; }
.seller-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 1.25rem;
  border-bottom: 1px solid var(--border);
}
.seller-item:last-child { border-bottom: none; }
.seller-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.seller-info { flex: 1; min-width: 0; }
.seller-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seller-apis { font-size: 0.72rem; color: var(--fg2); margin-top: 1px; }
.seller-metrics { text-align: right; flex-shrink: 0; }
.seller-rev {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--green);
}
.seller-calls {
  font-size: 0.7rem;
  color: var(--fg2);
  margin-top: 1px;
  font-family: 'JetBrains Mono', monospace;
}
.new-badge {
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--green);
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  margin-left: 4px;
}

/* ── FOOTER ── */
.quick-stats-bar {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--fg2);
  font-family: 'JetBrains Mono', monospace;
}
.quick-stats-left { display: flex; gap: 2rem; align-items: center; }
.quick-stats-right { display: flex; gap: 1.5rem; align-items: center; }
.qs-item { display: flex; align-items: center; gap: 6px; }
.qs-label { color: var(--fg2); }
.qs-value { color: var(--fg); font-weight: 600; }
.qs-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--fg2); }

/* ── STATUS PILLS ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
}
.status-ok { background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.25); }
.status-warn { background: rgba(245,158,11,0.1); color: var(--amber); border: 1px solid rgba(245,158,11,0.25); }
.status-err { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.25); }

/* ── TREND CHART PLACEHOLDER ── */
.mini-chart {
  height: 40px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 0 1.25rem;
  margin-bottom: 0.75rem;
}
.bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  background: var(--accent);
  opacity: 0.6;
  transition: opacity 0.2s;
}
.bar:hover { opacity: 1; }
.bar:last-child { opacity: 1; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .container { padding: 0 1rem; }
  .page-title { font-size: 1.4rem; }
  .metric-value { font-size: 1.6rem; }
}

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