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

/* ── Design tokens ───────────────────────────────────────────── */
:root {
  --bg:        #09090f;
  --bg-card:   #111118;
  --bg-card-h: #15151f;
  --border:    rgba(255,255,255,0.06);
  --border-h:  rgba(255,255,255,0.11);
  --text:      #e8e8f0;
  --text-2:    #9898b8;
  --text-3:    #52527a;
  --green:     #22c55e;
  --yellow:    #eab308;
  --orange:    #f97316;
  --red:       #ef4444;
  --grey:      #6b7280;
  --accent:    #6366f1;
  --radius:    12px;
  --radius-sm: 6px;
}

/* ── Base ────────────────────────────────────────────────────── */
html { scroll-behavior: smooth }

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

/* Subtle top glow */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 900px; height: 420px;
  background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,.07) 0%, transparent 68%);
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ── Header ──────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(9,9,15,0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
}

.brand-icon {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.brand-sep {
  color: var(--text-3);
  font-weight: 300;
  font-size: 16px;
}

.brand-status {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 400;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color .15s, border-color .15s, background .15s;
}

.btn-back:hover {
  color: var(--text);
  border-color: var(--border-h);
  background: var(--bg-card);
}

/* ── Main ────────────────────────────────────────────────────── */
.main { padding-bottom: 64px }

/* ── Hero / Overall status ───────────────────────────────────── */
.hero {
  text-align: center;
  padding: 72px 24px 56px;
}

.overall-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .4s, color .4s;
}

.overall-icon svg { width: 28px; height: 28px }

.icon-operational { background: rgba(34,197,94,.13);  color: var(--green) }
.icon-degraded    { background: rgba(234,179,8,.13);  color: var(--yellow) }
.icon-partial     { background: rgba(249,115,22,.13); color: var(--orange) }
.icon-major       { background: rgba(239,68,68,.13);  color: var(--red) }
.icon-unknown,
.icon-checking    { background: rgba(107,114,128,.13);color: var(--grey) }

@keyframes pulse {
  0%, 100% { opacity: 1 }
  50%       { opacity: .45 }
}
.icon-checking { animation: pulse 1.6s ease-in-out infinite }

.overall-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--text);
  margin-bottom: 8px;
  transition: color .3s;
}

.overall-sub {
  font-size: 15px;
  color: var(--text-2);
}

/* ── Sections ────────────────────────────────────────────────── */
.section { margin-bottom: 52px }

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  margin-bottom: 14px;
}

/* ── Component cards ─────────────────────────────────────────── */
.components-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.component-card {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

.component-card:last-child { border-bottom: none }
.component-card:hover { background: var(--bg-card-h) }

.component-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.component-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.component-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .3s;
}

.component-text { min-width: 0 }

.component-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.component-desc {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Status badges ───────────────────────────────────────────── */
.status-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 3px 10px;
  border-radius: 100px;
  white-space: nowrap;
  transition: background .3s, color .3s;
}

.status-operational { background: rgba(34,197,94,.12);  color: var(--green) }
.status-degraded    { background: rgba(234,179,8,.12);  color: var(--yellow) }
.status-partial     { background: rgba(249,115,22,.12); color: var(--orange) }
.status-major       { background: rgba(239,68,68,.12);  color: var(--red) }
.status-checking,
.status-unknown     { background: rgba(107,114,128,.12);color: var(--grey) }

/* ── Uptime bars ─────────────────────────────────────────────── */
.uptime-days {
  display: flex;
  gap: 2px;
  height: 28px;
  margin-bottom: 6px;
}

.uptime-day {
  flex: 1 0 0;
  min-width: 2px;
  border-radius: 2px;
  cursor: default;
  transition: opacity .1s, transform .1s;
}

.uptime-day:hover { opacity: .75; transform: scaleY(1.1) }

.uptime-operational { background: var(--green) }
.uptime-degraded    { background: var(--yellow) }
.uptime-partial     { background: var(--orange) }
.uptime-major       { background: var(--red) }
.uptime-unknown     { background: var(--grey) }
.uptime-nodata      { background: rgba(255,255,255,0.05) }

.uptime-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.uptime-legend-text { font-size: 11px; color: var(--text-3) }

.uptime-pct {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}

/* ── Incidents ───────────────────────────────────────────────── */
.incidents-empty {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
}

.incidents-empty svg {
  display: block;
  margin: 0 auto 12px;
  color: var(--text-3);
}

.incident-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}

.incident-card:last-child { margin-bottom: 0 }

.incident-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.incident-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.incident-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  padding: 2px 8px;
  border-radius: 100px;
}

.incident-badge.resolved     { background: rgba(34,197,94,.12);  color: var(--green) }
.incident-badge.investigating{ background: rgba(239,68,68,.12);  color: var(--red) }
.incident-badge.monitoring   { background: rgba(234,179,8,.12);  color: var(--yellow) }
.incident-badge.identified   { background: rgba(249,115,22,.12); color: var(--orange) }

.incident-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 12px;
}

.incident-meta span + span::before { content: ' · ' }

.incident-updates {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.incident-update {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  font-size: 13px;
  align-items: start;
}

.incident-update-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  padding-top: 2px;
}

.incident-update-text { color: var(--text-2) }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-text {
  font-size: 12px;
  color: var(--text-3);
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-countdown { display: none }

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-2);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

.refresh-btn:hover {
  color: var(--text);
  border-color: var(--border-h);
  background: var(--bg-card);
}

.refresh-btn:active { opacity: .7 }

.refresh-btn.spinning svg {
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg) } }

/* ── Responsive ──────────────────────────────────────────────── */
@media (min-width: 520px) {
  .footer-countdown { display: inline }
}

@media (max-width: 480px) {
  .hero { padding: 48px 24px 36px }
  .overall-title { font-size: 22px }
  .component-desc { display: none }
}
