/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --success: #22c55e;
  --success-dim: #16a34a;
  --error: #ef4444;
  --error-dim: #dc2626;
  --warning: #f59e0b;
  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

html {
  font-size: 15px;
}

body {
  background: linear-gradient(130deg, #ffffff 0%, #f5f9ff 44%, #eef4ff 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Animated Background ──────────────────────────────────────────────────── */
.bg-effects {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(72px);
  opacity: 0.35;
  will-change: transform;
}

.bg-orb-1 {
  width: min(42vw, 520px);
  height: min(42vw, 520px);
  top: -20%;
  left: -10%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 122, 24, 0.85), rgba(255, 122, 24, 0));
  animation: orbFloat1 15s ease-in-out infinite alternate;
}

.bg-orb-2 {
  width: min(44vw, 560px);
  height: min(44vw, 560px);
  right: -18%;
  top: 45%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 87, 46, 0.8), rgba(255, 87, 46, 0));
  animation: orbFloat2 18s ease-in-out infinite alternate;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 44, 102, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 44, 102, 0.06) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: 0.25;
  animation: gridDrift 20s linear infinite;
}

@keyframes orbFloat1 {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(8vw, 10vh, 0) scale(1.12); }
}

@keyframes orbFloat2 {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-9vw, -8vh, 0) scale(1.14); }
}

@keyframes gridDrift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(38px, 38px, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-orb, .bg-grid {
    animation: none;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

/* ─── Container ────────────────────────────────────────────────────────────── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

/* ─── Header ───────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand a:hover {
  opacity: 0.8;
  transition: opacity var(--transition);
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.report-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(99,102,241,0.1);
}

.report-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.overall-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  animation: fadeIn 0.5s ease;
}

.overall-status .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.overall-status.operational .status-dot {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.overall-status.partial .status-dot {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.overall-status.major .status-dot {
  background: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* ─── Filter Bar ───────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Group ────────────────────────────────────────────────────────────────── */
.group {
  margin-bottom: 32px;
}

.group-header {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 4px;
  animation: fadeIn 0.4s ease;
}

/* ─── Monitor Card ─────────────────────────────────────────────────────────── */
.monitor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), transform 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  animation: fadeSlideUp 0.4s ease both;
}

.monitor-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.monitor-main {
  padding: 16px 20px;
}

.monitor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.monitor-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.monitor-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.monitor-dot.up {
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

.monitor-dot.down {
  background: var(--error);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.3);
}

.monitor-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monitor-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.monitor-uptime {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--success);
}

.monitor-uptime.degraded {
  color: var(--warning);
}

.monitor-uptime.down {
  color: var(--error);
}

.monitor-response {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── Uptime Blocks Bar ────────────────────────────────────────────────────── */
.uptime-bar {
  display: flex;
  gap: 2px;
  height: 32px;
  margin-bottom: 4px;
}

.uptime-block {
  flex: 1;
  border-radius: 3px;
  min-width: 2px;
  transition: opacity var(--transition);
  position: relative;
}

.uptime-block.up {
  background: var(--success);
  opacity: 0.7;
}

.uptime-block.up:hover {
  opacity: 1;
}

.uptime-block.down {
  background: var(--error);
  opacity: 0.85;
}

.uptime-block.down:hover {
  opacity: 1;
}

.uptime-block.none {
  background: #e2e8f0;
  opacity: 0.5;
}

.uptime-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

/* ─── Expand Button ────────────────────────────────────────────────────────── */
.uptime-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.uptime-bar-row .uptime-bar {
  flex: 1;
  margin-bottom: 0;
}

.expand-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
  font-family: inherit;
  line-height: 1;
  flex-shrink: 0;
}

.expand-btn:hover {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.expand-btn.open {
  transform: rotate(45deg);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
}

/* ─── Chart Container ─────────────────────────────────────────────────────── */
.chart-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  padding: 0 20px;
}

.chart-container.open {
  max-height: 400px;
  padding: 0 20px 16px;
}

.chart-wrap {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  border: 1px solid var(--border);
  animation: fadeIn 0.3s ease;
}

/* ─── Footer ───────────────────────────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer a:hover {
  color: var(--accent);
}

/* ─── Tooltip (uptime block hover) ─────────────────────────────────────────── */
.block-tooltip {
  position: fixed;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.block-tooltip.visible {
  opacity: 1;
}

/* ─── Loading / Empty State ────────────────────────────────────────────────── */
.loading-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .container {
    padding: 24px 16px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .monitor-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .monitor-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .uptime-bar {
    height: 24px;
  }

  .footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}
