/* apps/status — public uptime/status page
 *
 * Imports the canonical EntityShield tokens, then styles the *existing*
 * status-page HTML classes (.status-banner, .service-card, .svc-indicator,
 * .incident-log, .last-check, etc.) using those tokens. The original file
 * declared its own --es-blue/-green/-yellow system; this version replaces
 * those with --es-jade/-amber/-rose/-info from tokens.css §1 + §3 so the
 * page tracks the rest of the product (light/dark mode, brand alignment).
 *
 * Build step copies packages/ui/src/styles/tokens.css to ./_tokens.css.
 */

@import './_tokens.css';

:root {
  /* Status page is dense data — operator surface dials apply. */
}

html[data-surface] body { /* ensure surface attribute is honored */
  background: var(--es-canvas);
  color: var(--es-text);
}

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

body {
  font-family: var(--es-font-body);
  font-feature-settings: var(--es-inter-cv);
  background: var(--es-canvas);
  color: var(--es-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

/* Header */
header {
  background: var(--es-surface);
  border-bottom: 1px solid var(--es-border);
  padding: 1.5rem 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--es-text);
}

.tagline {
  color: var(--es-text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Overall status banner */
.status-banner {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-radius: var(--es-radius-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.status-banner.status-operational {
  background: var(--es-jade-bg);
  color: var(--es-jade);
  border-left: 4px solid var(--es-jade);
}

.status-banner.status-degraded {
  background: var(--es-amber-bg);
  color: var(--es-amber);
  border-left: 4px solid var(--es-amber);
}

.status-banner.status-outage {
  background: var(--es-rose-bg);
  color: var(--es-rose);
  border-left: 4px solid var(--es-rose);
}

.status-banner.status-loading {
  background: var(--es-canvas-2);
  color: var(--es-text-muted);
}

.status-icon {
  font-size: 1.5rem;
}

/* Service cards */
.services {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.service-card {
  background: var(--es-surface);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--es-shadow-sm);
}

.svc-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.svc-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--es-text);
}

.svc-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--es-text-muted);
  flex-shrink: 0;
}

.service-card.operational .svc-indicator { background: var(--es-jade); }
.service-card.degraded .svc-indicator    { background: var(--es-amber); }
.service-card.outage .svc-indicator      { background: var(--es-rose); }
.service-card.unknown .svc-indicator     { background: var(--es-text-muted); }

.svc-detail {
  color: var(--es-text-muted);
  font-size: 0.8125rem;
}

.svc-meta {
  color: var(--es-text-muted);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  font-family: var(--es-font-mono);
  font-variant-numeric: tabular-nums;
}

/* Incident log */
.incident-log {
  margin-bottom: 2rem;
}

.incident-log h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--es-text);
}

.incident {
  background: var(--es-surface);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.incident time {
  font-size: 0.75rem;
  color: var(--es-text-muted);
  display: block;
  margin-bottom: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.incident p {
  font-size: 0.875rem;
  color: var(--es-text);
}

/* Last check + refresh */
.last-check {
  color: var(--es-text-muted);
  font-size: 0.8125rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-variant-numeric: tabular-nums;
}

#refresh-btn {
  background: var(--es-action);
  color: var(--es-action-fg);
  border: none;
  border-radius: var(--es-radius-sm);
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  cursor: pointer;
  font-weight: 500;
  transition: background var(--es-motion-fast) var(--es-ease);
}

#refresh-btn:hover {
  background: var(--es-action-hover);
}

/* Footer */
footer {
  margin-top: auto;
  padding: 1.5rem 0;
  border-top: 1px solid var(--es-border);
  background: var(--es-surface);
}

footer p {
  color: var(--es-text-muted);
  font-size: 0.8125rem;
  text-align: center;
}

footer a {
  color: var(--es-link);
  text-decoration: none;
}

footer a:hover {
  color: var(--es-link-hover);
  text-decoration: underline;
}

/* Responsive */
@media (min-width: 640px) {
  .services {
    grid-template-columns: 1fr 1fr;
  }
}
