/* ===========================================================
   CES Stat status page theme
   Accent color is overridden per-install via --accent (see header.php)
   =========================================================== */

:root {
  --accent: #00b2ff;
  --bg: #12141c;
  --bg-alt: #181b26;
  --card: #1a1d29;
  --card-border: #2a2e3d;
  --text: #eef0f5;
  --text-dim: #9aa0b4;
  --text-faint: #6b7185;
  --green: #2ecc71;
  --yellow: #e6c229;
  --orange: #e67e22;
  --red: #e74c3c;
  --gray: #4a4f5e;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

.bg-pattern {
  position: fixed;
  inset: 0;
  background-image: url("../img/pattern.svg");
  background-repeat: repeat;
  background-size: 480px 480px;
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ---------- Flash messages ---------- */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-weight: 600;
  border: 1px solid transparent;
}
.flash-success { background: rgba(46,204,113,0.12); border-color: var(--green); color: var(--green); }
.flash-error   { background: rgba(231,76,60,0.12); border-color: var(--red); color: var(--red); }

/* ---------- Site header / brand ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--text);
  font-size: 14px;
}
.brand-name {
  font-size: 30px;
  line-height: 1;
}
.brand-name .accent-part { color: var(--green); display: block; font-size: 40px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  text-align: center;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ---------- Status banner ---------- */
.status-banner {
  text-align: center;
  font-weight: 800;
  font-size: 20px;
  padding: 18px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  color: #0c1c12;
}
.status-banner.status-operational { background: var(--green); color: #0c1c12; }
.status-banner.status-degraded { background: var(--yellow); color: #2b2400; }
.status-banner.status-partial_outage { background: var(--orange); color: #2b1400; }
.status-banner.status-major_outage { background: var(--red); color: #2b0a06; }
.status-banner.status-maintenance { background: #3498db; color: #04202f; }

/* ---------- Card / services ---------- */
.card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: rgba(24,27,38,0.55);
  overflow: hidden;
}

.category-block { border-bottom: 1px solid var(--card-border); }
.category-block:last-child { border-bottom: none; }

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.category-toggle {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--text-dim);
  border-radius: 3px;
  font-size: 11px;
  flex-shrink: 0;
}
.category-services.collapsed { display: none; }

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px 6px;
  flex-wrap: wrap;
}
.service-row:first-of-type { padding-top: 4px; }

.service-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.service-status { font-weight: 700; font-size: 14px; }
.service-status.status-operational { color: var(--green); }
.service-status.status-degraded { color: var(--yellow); }
.service-status.status-partial_outage { color: var(--orange); }
.service-status.status-major_outage { color: var(--red); }
.service-status.status-maintenance { color: #3498db; }

.uptime-block { padding: 0 20px 18px; }

.uptime-bar {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 34px;
  align-items: stretch;
}
.uptime-bar .bar {
  flex: 1 1 0;
  border-radius: 2px;
  min-width: 2px;
  background: var(--gray);
  opacity: 0.55;
}
.uptime-bar .bar.has-data { opacity: 1; }
.uptime-bar .bar.status-operational { background: var(--green); }
.uptime-bar .bar.status-degraded { background: var(--yellow); }
.uptime-bar .bar.status-major_outage { background: var(--red); }
.uptime-bar .bar.status-no_data { background: var(--gray); opacity: 0.35; }

.uptime-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 6px;
}

.no-history-note { color: var(--text-faint); font-size: 12px; padding: 0 20px 16px; }

/* ---------- Tooltips (pure CSS, used for service tips + bar segments) ---------- */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #05060a;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 20;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
[data-tip]:hover::after { opacity: 1; }
.tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  font-size: 10px;
  font-style: normal;
}

/* ---------- Past incidents ---------- */
.section-heading {
  font-size: 26px;
  font-weight: 800;
  margin: 48px 0 20px;
}
.incident-list-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--card-border);
}
.incident-list-item:last-child { border-bottom: none; }
.incident-title-link { color: var(--orange); font-weight: 700; font-size: 16px; }
.incident-date { color: var(--text-faint); font-size: 12px; margin-left: 8px; }
.incident-impact-critical .incident-title-link,
.incident-impact-major .incident-title-link { color: var(--red); }
.incident-impact-minor .incident-title-link { color: var(--yellow); }
.incident-impact-maintenance .incident-title-link { color: #3498db; }

.incident-detail h2 { color: var(--orange); font-size: 22px; margin-bottom: 4px; }
.incident-update { margin: 18px 0; }
.incident-update .update-label { font-weight: 700; }
.incident-update .update-date { color: var(--text-faint); font-size: 12px; margin-left: 6px; }
.incident-affected { color: var(--text-faint); font-size: 13px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--card-border); }

.page-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
  color: var(--text-faint);
  font-size: 13px;
}

/* ---------- Forms ---------- */
.form-card { max-width: 520px; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-dim); font-weight: 600; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 110px; }

.checkbox-field { display: flex; align-items: center; gap: 8px; margin: 18px 0; }
.checkbox-field input { width: 16px; height: 16px; }

.inline-form { display: flex; gap: 10px; margin-bottom: 16px; }
.inline-form input { flex: 1; }

.center-title { text-align: center; margin-bottom: 8px; }
.center-subtitle { text-align: center; color: var(--text-dim); margin-bottom: 28px; }

/* ---------- Staff chrome ---------- */
.page-heading { text-align: center; font-size: 24px; margin: 0 0 24px; }

.staff-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.staff-btn {
  padding: 10px 18px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.staff-btn:hover { border-color: var(--accent); text-decoration: none; }
.staff-btn.active { border-color: var(--accent); color: var(--accent); }
.staff-nav-actions { margin-bottom: 40px; }
.staff-btn-outline { color: var(--text-dim); }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}
@media (max-width: 720px) {
  .settings-grid { grid-template-columns: 1fr; }
}
.settings-grid h2 { font-size: 20px; margin: 0 0 18px; }

/* ---------- Tables ---------- */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}
table.data-table th {
  text-align: left;
  font-size: 13px;
  color: var(--text);
  font-weight: 700;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-border);
}
table.data-table td {
  padding: 12px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 14px;
  vertical-align: middle;
}
table.data-table td.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(255,255,255,0.04);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
}
table.data-table .actions a { margin-right: 4px; }
table.data-table tr:last-child td { border-bottom: none; }

.table-empty { color: var(--text-faint); padding: 16px 0; font-size: 13px; }

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 36px 0 4px;
}

/* ---------- Incident status pill ---------- */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ---------- Login ---------- */
.login-wrap {
  max-width: 380px;
  margin: 80px auto 0;
}

/* ---------- Checkbox list (incident -> affected services) ---------- */
.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  max-height: 220px;
  overflow-y: auto;
}
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--text); }
