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

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

:root {
  --bg: #0a0a0a;
  --bg-card: #0a0a0a;
  --bg-card-hover: #111111;
  --border: #222222;
  --accent: #00ff88;
  --accent-dim: #00cc6a;
  --text-primary: #f0f0f0;
  --text-secondary: #888888;
  --text-muted: #666666;
  --red: #ff4444;
  --amber: #ffa726;
  --green: #00ff88;
  --purple: #7b7bf5;
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html { background: var(--bg); color: var(--text-primary); font-family: var(--font-sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dim); }

/* HEADER */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
}
.logo {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  text-decoration: none;
}
.logo span { color: var(--accent); }
.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}
.header-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
#live-clock { color: var(--text-secondary); }
.nav-link {
  font-size: 13.6px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--text-primary); }

.connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.connection-dot.connected { background: var(--accent); }
.connection-dot.disconnected { background: var(--red); }

/* BANNER */
.banner {
  margin-top: 56px;
  padding: 80px 40px 60px;
  border-bottom: 1px solid var(--border);
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.banner h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -2px;
  line-height: 1.05;
  margin-bottom: 16px;
}
.banner h1 .red { color: var(--accent); }
.banner p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 520px;
}
.banner-refresh {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* STATS BAR */
.stats-bar {
  display: flex;
  gap: 48px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 40px;
  border-bottom: 1px solid var(--border);
}
.stat-cell {
  font-family: var(--font-mono);
}
.stat-cell .num {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  display: block;
}
.stat-cell .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
  margin-top: 4px;
}
.num-green { color: var(--accent); }
.num-red { color: var(--red); }
.num-amber { color: var(--amber); }

.stat-incidents { margin-left: auto; }
.incidents-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.15s;
  text-align: left;
}
.incidents-toggle:hover { border-color: var(--red); }
.incidents-toggle .num { font-size: 24px; }
.incidents-toggle .label { font-size: 11px; white-space: nowrap; }

/* CONTROLS */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 12px 40px;
  position: sticky;
  top: 56px;
  z-index: 100;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: 1100px;
  margin: 0 auto;
}
.filter-btn {
  font-size: 12px;
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: var(--font-sans);
}
.filter-btn:hover { color: var(--text-secondary); border-color: var(--text-muted); }
.filter-btn.active { color: var(--accent); border-color: var(--accent); }
.filter-btn.active.issues { color: var(--red); border-color: var(--red); }
.search-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-wrap input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  width: 200px;
  padding: 7px 12px;
  transition: border-color 0.15s;
  font-family: var(--font-sans);
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--text-muted); }

/* GRID */
.grid-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 40px;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 24px;
  position: relative;
  transition: background 0.15s;
}
.service-card:hover { background: var(--bg-card-hover); }
.service-card.watched { border-color: rgba(0, 255, 136, 0.2); }

.service-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.service-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.watch-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}
.watch-btn:hover { color: var(--accent); }
.watch-btn.active { color: var(--accent); }
.service-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.status-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border: 1px solid;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.status-pill.operational { border-color: rgba(0, 255, 136, 0.3); color: var(--accent); }
.status-pill.degraded { border-color: rgba(255, 167, 38, 0.3); color: var(--amber); }
.status-pill.outage { border-color: rgba(255, 68, 68, 0.3); color: var(--red); animation: pulse-red 1.5s infinite; }
.status-pill.maintenance { border-color: rgba(123, 123, 245, 0.3); color: var(--purple); }
.status-pill.unknown { border-color: var(--border); color: var(--text-muted); }

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.service-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.report-count {
  font-size: 12px;
  color: var(--text-muted);
}
.report-count .count { color: var(--text-primary); font-weight: 600; }
.report-count.high .count { color: var(--red); }

.report-btn {
  font-size: 12px;
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}
.report-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.report-btn.reported {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 255, 136, 0.06);
}

.status-link {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-link:hover { color: var(--text-secondary); }

/* INCIDENTS PANEL */
.incidents-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px 16px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  max-height: 500px;
}
.incidents-section.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.incident-row {
  display: grid;
  grid-template-columns: 160px 1fr 120px 80px;
  gap: 0;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 14px 20px;
  align-items: center;
  transition: background 0.15s;
}
.incident-row:last-child { border-bottom: 1px solid var(--border); }
.incident-row:hover { background: var(--bg-card-hover); }
.incident-service {
  font-size: 13px;
  font-weight: 500;
}
.incident-desc {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 0 16px;
}
.incident-regions {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.incident-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.incident-severity {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: right;
}
.sev-outage { color: var(--red); }
.sev-degraded { color: var(--amber); }
.sev-maintenance { color: var(--purple); }

/* WATCHLIST BAR */
.watchlist-bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 40px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 255, 136, 0.03);
}
.watchlist-bar .watchlist-count,
.watchlist-bar .watchlist-actions { display: none; }
.watchlist-bar.show .watchlist-count,
.watchlist-bar.show .watchlist-actions { display: flex; }
.watchlist-count {
  font-size: 12px;
  color: var(--accent);
}
.watchlist-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.watchlist-btn {
  font-size: 11px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}
.watchlist-btn:hover { border-color: var(--accent); color: var(--accent); }

/* LOADING */
.loading {
  padding: 48px 0;
  font-size: 14px;
  color: var(--text-muted);
}
.loading .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* BANNERS */
.demo-banner {
  margin-top: 56px;
  background: rgba(0, 255, 136, 0.04);
  border-bottom: 1px solid rgba(0, 255, 136, 0.15);
  padding: 10px 40px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.demo-banner + .banner { margin-top: 0; }

.error-banner {
  background: rgba(255, 68, 68, 0.06);
  border-bottom: 1px solid rgba(255, 68, 68, 0.2);
  padding: 10px 40px;
  font-size: 12px;
  color: var(--red);
  display: none;
}
.error-banner.show { display: block; }

/* FOOTER */
footer {
  border-top: 1px solid var(--border);
  padding: 20px 40px;
  max-width: 1100px;
  margin: 48px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-left {
  font-size: 12.8px;
  color: var(--text-muted);
}
.footer-logo { font-weight: 700; }
.footer-left a { color: var(--text-muted); text-decoration: none; }
.footer-left a:hover { color: var(--accent); }
.footer-right {
  font-size: 12.8px;
  color: var(--text-muted);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card-hover);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-primary);
  z-index: 1000;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

.hidden { display: none !important; }

/* LEGAL PAGES */
.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 120px 40px 60px;
}
.legal-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.5px;
}
.legal h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -1px;
  margin: 8px 0 4px;
}
.legal-updated {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 32px;
}
.legal h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  margin: 28px 0 8px;
}
.legal p,
.legal ul {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal strong { color: var(--text-primary); font-weight: 500; }

/* MOBILE */
@media (max-width: 900px) {
  header, .controls, .grid-wrap, .incidents-section, footer, .banner, .demo-banner, .error-banner {
    padding-left: 20px;
    padding-right: 20px;
  }
  .stats-bar { flex-wrap: wrap; gap: 24px; padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 600px) {
  .legal { padding: 96px 20px 40px; }
  .services-grid { grid-template-columns: 1fr; }
  .stats-bar { flex-wrap: wrap; gap: 20px; }
  .incident-row { grid-template-columns: 1fr 1fr; gap: 4px; }
  .incident-desc { display: none; }
  .search-wrap { margin-left: 0; width: 100%; }
  .search-wrap input { width: 100%; }
  .footer-right { display: none; }
}
