/* safeBubble status page — self-hosted. Color scheme follows the visitor's OS. */

:root {
  color-scheme: light dark;
  --bg: #f5f7fb;
  --card: #ffffff;
  --border: #e6eaf0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --header-bg: rgba(255, 255, 255, 0.85);

  /* status colors */
  --s-operational: #1f9d63;
  --s-degraded: #d99304;
  --s-downtime: #d64242;
  --s-maintenance: #3b6fe0;
  --s-not_monitored: #c3ccd8;

  /* banner tints */
  --tint-ok: #e7f6ee;
  --tint-issues: #fdecec;
  --tint-maint: #e9f0fd;
  --tint-neutral: #eef1f6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --card: #111827;
    --border: #1f2a3b;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --accent: #60a5fa;
    --header-bg: rgba(17, 24, 39, 0.85);

    --s-operational: #34c780;
    --s-degraded: #eab308;
    --s-downtime: #f0616f;
    --s-maintenance: #6f9bff;
    --s-not_monitored: #344056;

    --tint-ok: #10241a;
    --tint-issues: #2a1518;
    --tint-maint: #11203c;
    --tint-neutral: #161f2e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 820px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Header / nav ─────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }

.tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; }

.tabs a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
}
.tabs a:hover { color: var(--text); background: var(--tint-neutral); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); background: var(--tint-neutral); }

/* ── Views ────────────────────────────────────────────────────────────────── */

main.wrap { padding-top: 1.75rem; padding-bottom: 3rem; }
.view[hidden] { display: none; }
.view-title { font-size: 1.3rem; margin: 0 0 1rem; }

/* ── Overall banner ───────────────────────────────────────────────────────── */

.banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.15rem 1.35rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.banner-icon {
  display: inline-flex;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
}
.banner-icon svg { width: 100%; height: 100%; display: block; }

.banner-ok { background: var(--tint-ok); border-color: transparent; }
.banner-ok .banner-icon { color: var(--s-operational); }
.banner-issues { background: var(--tint-issues); border-color: transparent; }
.banner-issues .banner-icon { color: var(--s-downtime); }
.banner-maint { background: var(--tint-maint); border-color: transparent; }
.banner-maint .banner-icon { color: var(--s-maintenance); }
.banner-loading { background: var(--tint-neutral); color: var(--muted); }
.banner-unavailable { background: var(--tint-neutral); color: var(--muted); }
.banner-unavailable .banner-icon { color: var(--muted); }

/* ── Service cards ────────────────────────────────────────────────────────── */

.services { display: flex; flex-direction: column; gap: 0.85rem; }

.service {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}

.service-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.service-name { font-weight: 600; font-size: 1.02rem; }
.service-explanation { color: var(--muted); font-size: 0.88rem; margin-top: 0.1rem; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--tint-neutral);
}
.pill .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.pill.s-operational { color: var(--s-operational); }
.pill.s-degraded { color: var(--s-degraded); }
.pill.s-downtime { color: var(--s-downtime); }
.pill.s-maintenance { color: var(--s-maintenance); }
.pill.s-not_monitored { color: var(--muted); }

/* 90-day history bar */
.history { display: flex; gap: 2px; height: 34px; align-items: stretch; }
.history .seg { flex: 1 1 0; min-width: 0; border-radius: 2px; background: var(--s-not_monitored); }
.history .seg.s-operational { background: var(--s-operational); }
.history .seg.s-degraded { background: var(--s-degraded); }
.history .seg.s-downtime { background: var(--s-downtime); }
.history .seg.s-maintenance { background: var(--s-maintenance); }
.history .seg.s-not_monitored { background: var(--s-not_monitored); }
.history .seg:hover { filter: brightness(0.9); }

.history-empty { color: var(--muted); font-size: 0.88rem; padding: 0.5rem 0; }

.history-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.history-foot .uptime { font-weight: 600; color: var(--text); }

/* ── Reports (maintenance + incidents) ────────────────────────────────────── */

.reports { display: flex; flex-direction: column; gap: 1.5rem; }
.report-month { font-size: 1.02rem; font-weight: 600; margin: 0 0 0.6rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.report-group { display: flex; flex-direction: column; gap: 0.85rem; }

.report {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.report-title { font-weight: 600; }
.report-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--tint-neutral);
  color: var(--muted);
}
.report-badge.maintenance { color: var(--s-maintenance); }
.report-badge.manual { color: var(--s-downtime); }
.report-meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }
.report-updates { margin: 0.75rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.report-update { border-left: 2px solid var(--border); padding-left: 0.75rem; }
.report-update .when { display: block; color: var(--muted); font-size: 0.78rem; }

.empty {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  text-align: center;
  color: var(--muted);
}

/* ── Meta / footer ────────────────────────────────────────────────────────── */

.meta { color: var(--muted); font-size: 0.82rem; margin-top: 1.25rem; text-align: center; }

.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.brand-foot { font-weight: 700; color: var(--muted); }
.site-footer { font-size: 0.85rem; }

@media (max-width: 480px) {
  .service-head, .report-head { flex-direction: column; gap: 0.5rem; }
  .banner { font-size: 1.02rem; }
}
