/* ============================================================
   Newton Status Page — Pinnacle Technologies Theme
   Colors: bg #1a1a1a | card #242424 | text #a5a5a5 | accent #41a994
   ============================================================ */

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

:root {
  --bg:         #1a1a1a;
  --card:       #242424;
  --card-hover: #2c2c2c;
  --border:     #333333;
  --text:       #a5a5a5;
  --text-light: #6e6e6e;
  --text-bright:#d4d4d4;
  --accent:     #41a994;
  --accent-dim: rgba(65, 169, 148, 0.15);
  --green:      #41a994;
  --yellow:     #f0b429;
  --red:        #e05252;
  --font:       'Poppins', sans-serif;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.25s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

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

/* push footer to bottom */
.main-content { flex: 1; width: 100%; box-sizing: border-box; padding-bottom: 80px; }

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

/* ── Header ─────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(26, 26, 26, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo-link { display: flex; align-items: center; }

.logo {
  height: 32px;
  width: auto;
  filter: brightness(1.1);
  transition: opacity var(--transition);
}
.logo:hover { opacity: 0.8; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.last-updated {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
}

.btn-subscribe {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.btn-subscribe:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Hero / Status Banner ───────────────────────────────── */
.hero {
  padding: 56px 0 48px;
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}

.status-banner.operational { border-color: var(--green); }
.status-banner.degraded    { border-color: var(--yellow); }
.status-banner.down        { border-color: var(--red); }

.banner-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent);
  transition: background var(--transition), color var(--transition);
}
.banner-icon.degraded { background: rgba(240,180,41,0.15); color: var(--yellow); }
.banner-icon.down     { background: rgba(224,82,82,0.15);  color: var(--red); }

.banner-icon svg { width: 28px; height: 28px; }

.banner-text h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}
.banner-text p {
  font-size: 14px;
  color: var(--text);
}

/* ── Section Commons ────────────────────────────────────── */
.main-content { padding-bottom: 80px; }

.section {
  margin-bottom: 40px;
}

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

.section-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.section-subtitle {
  font-size: 12px;
  color: var(--text-light);
  margin-top: -10px;
  margin-bottom: 14px;
}

/* ── Uptime Section ─────────────────────────────────────── */
.uptime-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 10px;
  border-radius: 12px;
}

.uptime-bar-container {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.uptime-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2d9582, var(--accent));
  border-radius: 4px;
  transition: width 1s ease;
}

.uptime-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-light);
}

/* ── Component Card ─────────────────────────────────────── */
.component-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  transition: background var(--transition), border-color var(--transition);
}
.component-card:hover {
  background: var(--card-hover);
}

.component-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.component-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-light);
  flex-shrink: 0;
  transition: background var(--transition);
  box-shadow: 0 0 0 0 rgba(65, 169, 148, 0);
}
.component-dot.operational {
  background: var(--green);
  animation: pulse-green 2.5s infinite;
}
.component-dot.degraded {
  background: var(--yellow);
  animation: pulse-yellow 2.5s infinite;
}
.component-dot.down {
  background: var(--red);
  animation: pulse-red 2.5s infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(65,169,148,0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(65,169,148,0); }
}
@keyframes pulse-yellow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,180,41,0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(240,180,41,0); }
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,82,82,0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(224,82,82,0); }
}

.component-details {
  display: flex;
  flex-direction: column;
}

.component-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-bright);
}

.component-url {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 300;
  margin-top: 2px;
}

.component-status-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.component-status-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  transition: color var(--transition);
}
.component-status-text.operational { color: var(--green); }
.component-status-text.degraded    { color: var(--yellow); }
.component-status-text.down        { color: var(--red); }

.response-time {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 300;
}

/* ── History Grid ───────────────────────────────────────── */
.history-count {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
}

.history-grid {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.history-cell {
  width: 10px;
  height: 28px;
  border-radius: 2px;
  background: var(--border);
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition);
  position: relative;
}
.history-cell:hover { transform: scaleY(1.2); opacity: 0.9; }

.history-cell.operational { background: var(--green); }
.history-cell.degraded    { background: var(--yellow); }
.history-cell.down        { background: var(--red); }
.history-cell.unknown     { background: var(--border); }

/* Tooltip */
.history-cell[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: var(--text-bright);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  margin-bottom: 4px;
  z-index: 10;
  pointer-events: none;
  border: 1px solid var(--border);
}

.history-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-light);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.legend-dot.operational { background: var(--green); }
.legend-dot.degraded    { background: var(--yellow); }
.legend-dot.down        { background: var(--red); }
.legend-dot.unknown     { background: var(--border); }

/* ── Incidents ──────────────────────────────────────────── */
.no-incidents {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-light);
  padding: 24px 0;
  font-size: 14px;
}
.no-incidents svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.5;
}

.incident-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 10px;
  border-left: 3px solid var(--red);
}
.incident-item.resolved { border-left-color: var(--green); }

.incident-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.incident-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-bright);
}
.incident-time {
  font-size: 11px;
  color: var(--text-light);
}
.incident-body {
  font-size: 13px;
  color: var(--text);
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 28px 0;
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-light);
}

.footer-logo {
  height: 20px;
  width: auto;
  opacity: 0.6;
}

/* ── Availability Analytics ─────────────────────────────── */
.analytics-meta {
  font-size: 12px;
  color: var(--text-light);
}

.availability-uptime-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin-bottom: 14px;
}

.availability-uptime-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.availability-uptime-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
}

.availability-uptime-subtitle {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 3px;
}

.availability-uptime-badge {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 999px;
  padding: 5px 12px;
  line-height: 1;
  white-space: nowrap;
}

.availability-uptime-strip {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-height: 28px;
}

.availability-uptime-cell {
  flex: 1 1 0;
  height: 28px;
  border-radius: 2px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition);
}

.availability-uptime-cell:hover {
  transform: scaleY(1.12);
  opacity: 0.92;
}

.availability-uptime-cell.good { background: var(--green); }
.availability-uptime-cell.warn { background: #ff9f1a; }
.availability-uptime-cell.bad { background: var(--red); }
.availability-uptime-cell.empty { background: var(--border); }

.availability-uptime-cell[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: var(--text-bright);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 20;
  pointer-events: none;
  border: 1px solid var(--border);
}

.availability-uptime-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 8px;
}

.analytics-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.analytics-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 96px;
}
.analytics-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.analytics-label {
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.analytics-chart-wrap { flex: 1; min-width: 0; position: relative; }

.analytics-tooltip {
  position: fixed;
  background: #1e1e1e;
  border: 1px solid #41a994;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: #e0e0e0;
  pointer-events: none;
  display: none;
  white-space: nowrap;
  z-index: 200;
  line-height: 1.7;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.analytics-tooltip .tt-date { display: block; font-weight: 600; color: #fff; font-size: 12px; }
.analytics-tooltip .tt-val  { display: block; color: #41a994; font-size: 13px; font-weight: 500; }
.analytics-chart {
  width: 100%;
  height: 72px;
  display: block;
}
.analytics-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

.analytics-error {
  font-size: 13px;
  color: var(--red);
  margin-top: 10px;
}

/* ── Banner Brand Label ──────────────────────────────────── */
.banner-brand {
  display: block;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-bright);
  text-decoration: none;
  margin-bottom: 20px;
  transition: color var(--transition);
}
.banner-brand:hover {
  color: var(--accent);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .status-banner { flex-direction: column; text-align: center; gap: 16px; }
  .banner-text h1 { font-size: 18px; }
  .header .container { height: 56px; }
  .last-updated { display: none; }
  .history-cell { width: 7px; }
  .availability-uptime-header { flex-direction: column; align-items: stretch; }
  .availability-uptime-badge { align-self: flex-start; }
  .footer .container { flex-direction: column; text-align: center; }
}

/* ── Incident History Button ────────────────────────────── */
.btn-incident-history {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 18px 22px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  text-align: left;
}
.btn-incident-history:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  color: var(--text-bright);
}
.btn-incident-history svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--accent);
}
.btn-incident-history:hover svg {
  color: var(--accent);
}

.incident-badge {
  margin-left: auto;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 12px;
  min-width: 24px;
  text-align: center;
}

/* ── Incident Drawer ─────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.drawer {
  background: var(--card);
  border-left: 1px solid var(--border);
  width: 100%;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -8px 0 32px rgba(0,0,0,0.5);
}
.drawer-overlay.open .drawer {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-title svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}
.drawer-title h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--transition);
}
.drawer-close:hover { color: var(--text-bright); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.drawer-body::-webkit-scrollbar { width: 5px; }
.drawer-body::-webkit-scrollbar-track { background: transparent; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Drawer section labels ──────────────────────────────── */
.drawer-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  padding: 20px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.drawer-section-label:first-child { padding-top: 0; }
.drawer-section-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
  opacity: 0.65;
}

/* ── Error day groups ───────────────────────────────────── */
.error-day-group {
  border-left: 3px solid var(--red);
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border-radius: 0 6px 6px 0;
  margin-bottom: 8px;
}
.error-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.error-day-date {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-bright);
}
.error-day-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.error-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.5;
}
.error-code {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 1px;
}
.error-code.err5xx { background: rgba(255,90,90,0.15); color: #ff6b6b; }
.error-code.err4xx { background: rgba(255,165,0,0.15);  color: #ffa040; }
.error-msg {
  color: var(--text-muted);
  flex: 1;
  word-break: break-word;
}

/* ── Loading spinner ────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
