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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f6f8fa;
  color: #24292f;
  min-height: 100vh;
  overflow-x: clip;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Dark mode ─────────────────────────────────────────────────────────────── */
body.dark {
  background: #0d1117;
  color: #e6edf3;
}

body.dark .section-title  { color: #e6edf3; }
body.dark .section-sub    { color: #8b949e; }
body.dark .service-card   { background: #161b22; border-color: #30363d; }
body.dark .service-name   { color: #e6edf3; }
body.dark .uptime-footer  { color: #8b949e; }
body.dark .uptime-pct     { color: #e6edf3; }
body.dark .response-time  { color: #8b949e; border-top-color: #30363d; }
body.dark .page-footer    { color: #8b949e; }
body.dark .bar--unknown   { background: #30363d; }
body.dark .service-status--unknown { color: #8b949e; }

body.dark .bar::after {
  background: #e6edf3;
  color: #0d1117;
}
body.dark .bar::before {
  border-top-color: #e6edf3;
}

/* ── Theme toggle button ───────────────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 200;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.theme-toggle:hover {
  background: rgba(0, 0, 0, 0.38);
}

body.dark .theme-toggle {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

body.dark .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ── Hero banner ───────────────────────────────────────────────────────────── */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 36px 24px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: background-color 0.4s ease;
  position: relative;
}

.hero--up      { background: #2da44e; color: #fff; }
.hero--slow    { background: #bf8700; color: #fff; }
.hero--down    { background: #cf222e; color: #fff; }
.hero--unknown { background: #6e7781; color: #fff; }

.hero__icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 900;
}

.hero--up    .hero__icon::after { content: "✓"; }
.hero--slow  .hero__icon::after { content: "!"; }
.hero--down  .hero__icon::after { content: "✕"; }
.hero--unknown .hero__icon::after { content: "?"; }

/* ── Container ─────────────────────────────────────────────────────────────── */
.container {
  max-width: 860px;
  margin: 44px auto;
  padding: 0 24px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #24292f;
  margin-bottom: 6px;
}

.section-sub {
  font-size: 0.9rem;
  color: #57606a;
  margin-bottom: 20px;
}

/* ── Service card ──────────────────────────────────────────────────────────── */
.service-card {
  background: #ffffff;
  border: 1px solid #d0d7de;
  border-radius: 10px;
  padding: 24px 28px;
  margin-bottom: 16px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

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

.service-name {
  font-weight: 600;
  font-size: 1rem;
  color: #24292f;
}

.service-status {
  font-size: 0.875rem;
  font-weight: 600;
}
.service-status--up      { color: #2da44e; }
.service-status--slow    { color: #bf8700; }
.service-status--down    { color: #cf222e; }
.service-status--unknown { color: #6e7781; }

/* ── Uptime bars ───────────────────────────────────────────────────────────── */
.uptime-bars {
  display: flex;
  gap: 2px;
  height: 36px;
  align-items: stretch;
  margin-bottom: 8px;
}

.bar {
  flex: 1;
  border-radius: 3px;
  position: relative;
  cursor: default;
  transition: opacity 0.12s ease;
}

.bar:hover { opacity: 0.75; }

.bar--up      { background: #2da44e; }
.bar--slow    { background: #bf8700; }
.bar--down    { background: #cf222e; }
.bar--unknown { background: #d0d7de; }

/* CSS-only tooltip */
.bar::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #24292f;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 5px 9px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
}

.bar:hover::after {
  opacity: 1;
}

/* Arrow for tooltip */
.bar::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #24292f;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
}

.bar:hover::before {
  opacity: 1;
}

/* ── Uptime footer ─────────────────────────────────────────────────────────── */
.uptime-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.775rem;
  color: #57606a;
  margin-bottom: 14px;
}

.uptime-pct {
  font-weight: 600;
  color: #24292f;
}

/* ── Response time ─────────────────────────────────────────────────────────── */
.response-time {
  font-size: 0.85rem;
  color: #57606a;
  border-top: 1px solid #d0d7de;
  padding-top: 12px;
  margin-top: 4px;
}

/* ── Recent 10-min bars ────────────────────────────────────────────────────── */
.uptime-bars--recent {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #d0d7de;
}

body.dark .uptime-bars--recent { border-top-color: #30363d; }

/* ── Page footer ───────────────────────────────────────────────────────────── */
.page-footer {
  margin-top: 36px;
  font-size: 0.8rem;
  color: #6e7781;
  text-align: center;
}
