@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --border: #e5e7eb;
  --primary: #3b82f6;
  --up: #22c55e;
  --down: #dc2626;
  --warning: #f59e0b;
  --text: #1a1a2e;
  --muted: #6b7280;
  --surface-hover: #f1f3f5;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ========================
   PUBLIC STATUS PAGE NAV
   ======================== */
.status-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.status-nav-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
}

.nav-brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  margin-right: auto;
  letter-spacing: -0.3px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
}

.nav-tab {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: transparent;
  text-decoration: none;
}

.nav-tab:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-tab.active {
  color: var(--text);
  background: var(--surface);
  font-weight: 600;
}

/* Status indicator line below nav */
.status-line {
  height: 3px;
  width: 100%;
  transition: background 0.3s;
}

.status-line.all-up {
  background: var(--up);
}

.status-line.some-down {
  background: var(--down);
}

.status-line.unknown {
  background: var(--border);
}

/* ========================
   LAYOUT
   ======================== */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========================
   HERO SECTION
   ======================== */
.hero {
  text-align: center;
  padding: 48px 24px 40px;
}

.hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
}

.hero-icon.up {
  background: rgba(34, 197, 94, 0.1);
  color: var(--up);
}

.hero-icon.down {
  background: rgba(220, 38, 38, 0.1);
  color: var(--down);
}

.hero-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.hero-subtitle {
  font-size: 14px;
  color: var(--muted);
}

/* ========================
   SERVICE CARD
   ======================== */
.service-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 32px;
}

.service-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.service-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.status-filter {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  outline: none;
}

.status-filter:focus {
  border-color: var(--primary);
}

/* Service row */
.service-row {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.service-row:last-child {
  border-bottom: none;
}

.service-row:hover {
  background: var(--surface);
}

.service-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.service-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.up { background: var(--up); }
.status-dot.down { background: var(--down); }
.status-dot.pending { background: var(--muted); }

.service-uptime {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.service-uptime.good { color: var(--up); }
.service-uptime.bad { color: var(--down); }

/* Uptime bar */
.uptime-bar-container {
  margin-top: 4px;
}

.uptime-bar {
  display: flex;
  gap: 1px;
  height: 28px;
  align-items: stretch;
}

.uptime-bar .day-segment {
  flex: 1;
  min-width: 3px;
  border-radius: 2px;
  transition: opacity 0.1s;
  cursor: pointer;
  position: relative;
}

.uptime-bar .day-segment:hover {
  opacity: 0.7;
}

.uptime-bar .day-segment.up { background: var(--up); }
.uptime-bar .day-segment.down { background: var(--down); }
.uptime-bar .day-segment.partial { background: var(--warning); }
.uptime-bar .day-segment.no-data { background: #e5e7eb; }

.uptime-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* Tooltip for uptime bars */
.day-segment .tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
}

.day-segment:hover .tooltip {
  display: block;
}

/* ========================
   INCIDENTS SECTION
   ======================== */
.incidents-section {
  margin-bottom: 48px;
  padding-bottom: 48px;
}

.incidents-section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text);
}

.incident-date-group {
  margin-bottom: 24px;
}

.incident-date-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.incident-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.incident-item:hover {
  border-color: var(--primary);
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.1);
}

.incident-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.incident-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.incident-meta {
  font-size: 12px;
  color: var(--muted);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-up { background: rgba(34, 197, 94, 0.1); color: var(--up); }
.badge-down { background: rgba(220, 38, 38, 0.1); color: var(--down); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.badge-pending { background: rgba(107, 114, 128, 0.1); color: var(--muted); }

.badge-downtime { background: rgba(220, 38, 38, 0.1); color: var(--down); }
.badge-degraded { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-maintenance { background: rgba(59, 130, 246, 0.1); color: var(--primary); }

/* ========================
   INCIDENT DETAIL PAGE
   ======================== */
.incident-detail-header {
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.incident-detail-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.incident-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}

.incident-detail-meta .badge {
  font-size: 12px;
}

/* Timeline */
.timeline {
  padding-left: 24px;
  border-left: 2px solid var(--border);
  margin-top: 8px;
}

.timeline-entry {
  position: relative;
  padding: 0 0 24px 24px;
}

.timeline-entry:last-child {
  padding-bottom: 0;
}

.timeline-entry::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
}

.timeline-time {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.timeline-message {
  font-size: 14px;
  color: var(--text);
}

/* Expandable incident */
.incident-expand-body {
  display: none;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

.incident-item.expanded .incident-expand-body {
  display: block;
}

/* ========================
   LOADING / SPINNER
   ======================== */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--muted);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================
   EMPTY STATE
   ======================== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ========================
   FLASH ANIMATION
   ======================== */
.flash {
  animation: flash-anim 0.5s ease-out;
}

@keyframes flash-anim {
  0% { background: rgba(59, 130, 246, 0.08); }
  100% { background: transparent; }
}

/* ========================
   NO-INCIDENTS MESSAGE
   ======================== */
.no-incidents {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-size: 14px;
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 640px) {
  .status-nav-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 8px;
  }

  .nav-brand {
    width: 100%;
    text-align: center;
    margin-right: 0;
  }

  .nav-tabs {
    width: 100%;
    justify-content: center;
  }

  .hero {
    padding: 32px 16px 24px;
  }

  .hero-title {
    font-size: 20px;
  }

  .service-card-header {
    padding: 16px;
  }

  .service-row {
    padding: 12px 16px;
  }

  .uptime-bar {
    height: 20px;
  }

  .container {
    padding: 0 16px;
  }

  .incident-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
