/* =============================================================================
   Status page DigiFarmz — layout no padrão Statuspage (banner de status geral,
   barras de uptime por componente, timeline de incidentes).
   Sem framework e sem build step: é uma página read-only.
   ========================================================================== */

:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --border: #e3e8ee;
  --text: #1b2733;
  --text-muted: #64748b;
  --brand: #18a957;

  --operational: #18a957;
  --degraded: #f0a92b;
  --partial: #ef7d2d;
  --major: #e2483d;
  --no-data: #dfe4ea;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --maxw: 880px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #171d24;
    --border: #262f3a;
    --text: #e6edf3;
    --text-muted: #8b98a8;
    --no-data: #2b333d;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
}

.brand-mark { color: var(--brand); display: inline-flex; }

.brand-sub {
  color: var(--text-muted);
  font-weight: 400;
}

.header-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.header-link:hover { color: var(--text); }

/* ---------- Banner de status geral ---------- */
.overall {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 32px 0 10px;
  padding: 22px 24px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--text-muted);
}

.overall[data-status="operational"]         { background: var(--operational); }
.overall[data-status="degraded_performance"]{ background: var(--degraded); }
.overall[data-status="partial_outage"]      { background: var(--partial); }
.overall[data-status="major_outage"]        { background: var(--major); }
.overall[data-status="loading"],
.overall[data-status="no_data"]             { background: var(--text-muted); }

.overall-text {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.overall-icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  position: relative;
}

.overall-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 12px;
  height: 7px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -2px);
}

/* Estados não-operacionais: "!" no lugar do check */
.overall:not([data-status="operational"]) .overall-icon::after {
  width: 2.5px;
  height: 9px;
  border: 0;
  background: #fff;
  border-radius: 2px;
  transform: translateY(-3px);
}

.overall:not([data-status="operational"]) .overall-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 2.5px;
  height: 2.5px;
  background: #fff;
  border-radius: 50%;
  transform: translateY(5px);
}

.updated {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.notice {
  margin: 0 0 24px;
  padding: 12px 16px;
  border: 1px solid var(--degraded);
  border-left-width: 4px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--degraded) 10%, transparent);
  font-size: 14px;
}

/* ---------- Painel de componentes ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.panel-sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.component {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.component:last-child { border-bottom: 0; }

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

.component-name {
  font-weight: 600;
  font-size: 15px;
}

.component-desc {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.component-status {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.component-status[data-status="operational"]          { color: var(--operational); }
.component-status[data-status="degraded_performance"] { color: var(--degraded); }
.component-status[data-status="partial_outage"]       { color: var(--partial); }
.component-status[data-status="major_outage"]         { color: var(--major); }
.component-status[data-status="no_data"]              { color: var(--text-muted); }

/* Barras de uptime */
.bars {
  display: flex;
  gap: 2px;
  height: 34px;
  align-items: stretch;
}

.bar {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2px;
  background: var(--no-data);
  transition: opacity .12s ease;
}

.bar:hover { opacity: .65; }

.bar[data-status="operational"]          { background: var(--operational); }
.bar[data-status="degraded_performance"] { background: var(--degraded); }
.bar[data-status="partial_outage"]       { background: var(--partial); }
.bar[data-status="major_outage"]         { background: var(--major); }

/* Em telas estreitas, 90 barras viram fatias invisíveis — mostra menos dias. */
@media (max-width: 640px) {
  .bar.bar-hide-sm { display: none; }
}

.bars-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.bars-legend .uptime-pct {
  font-variant-numeric: tabular-nums;
}

.legend-rule {
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}

/* ---------- Incidentes ---------- */
.incidents { margin: 44px 0 60px; }

.incidents h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.incident-day {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}

.incident-date {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.incident + .incident { margin-top: 22px; }

.incident-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
}

.incident-title[data-impact="critical"] { color: var(--major); }
.incident-title[data-impact="major"]    { color: var(--partial); }
.incident-title[data-impact="minor"]    { color: var(--degraded); }

.incident-update {
  margin: 0 0 10px;
  padding-left: 2px;
  font-size: 14px;
}

.incident-update:last-child { margin-bottom: 0; }

.update-label { font-weight: 600; }

.update-time {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.affected {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.empty-day {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

/* ---------- Skeleton / footer ---------- */
.skeleton-row {
  height: 84px;
  margin: 20px 24px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--no-data) 25%, var(--border) 37%, var(--no-data) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-row { animation: none; }
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 56px;
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.noscript {
  padding: 20px;
  font-size: 14px;
}
