/* CSS Variables */
:root {
  --bg: #0a0a0b;
  --bg-secondary: #111113;
  --bg-tertiary: #18181b;
  --border: #27272a;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dimmed: #71717a;

  --status-up: #22c55e;
  --status-up-bg: rgba(34, 197, 94, 0.1);
  --status-down: #ef4444;
  --status-down-bg: rgba(239, 68, 68, 0.1);
  --status-degraded: #f59e0b;
  --status-degraded-bg: rgba(245, 158, 11, 0.1);
  --status-unknown: #71717a;
  --status-unknown-bg: rgba(113, 113, 122, 0.1);

  --accent: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  transition: opacity 0.2s;
}

.logo:hover {
  opacity: 0.8;
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

/* Status Banner */
.status-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: var(--radius);
  margin: 2rem 0;
  transition: all 0.3s ease;
}

.status-banner.status-up {
  background: var(--status-up-bg);
  border: 1px solid var(--status-up);
}

.status-banner.status-down {
  background: var(--status-down-bg);
  border: 1px solid var(--status-down);
}

.status-banner.status-degraded {
  background: var(--status-degraded-bg);
  border: 1px solid var(--status-degraded);
}

.status-banner.status-unknown,
.status-banner.status-loading {
  background: var(--status-unknown-bg);
  border: 1px solid var(--status-unknown);
}

.status-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.status-up .status-icon {
  background: var(--status-up);
  color: white;
}

.status-down .status-icon {
  background: var(--status-down);
  color: white;
}

.status-degraded .status-icon {
  background: var(--status-degraded);
  color: white;
}

.status-unknown .status-icon,
.status-loading .status-icon {
  background: var(--status-unknown);
  color: white;
}

.status-text h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.status-up .status-text h1 { color: var(--status-up); }
.status-down .status-text h1 { color: var(--status-down); }
.status-degraded .status-text h1 { color: var(--status-degraded); }
.status-unknown .status-text h1,
.status-loading .status-text h1 { color: var(--status-unknown); }

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

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Sections */
.section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Monitor Cards */
.monitors-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.monitor-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.monitor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.monitor-info h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.monitor-info a {
  font-size: 0.75rem;
  color: var(--text-dimmed);
  transition: color 0.2s;
}

.monitor-info a:hover {
  color: var(--accent);
}

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

.latency {
  font-size: 0.75rem;
  color: var(--text-dimmed);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.up {
  background: var(--status-up-bg);
  color: var(--status-up);
}

.status-badge.down {
  background: var(--status-down-bg);
  color: var(--status-down);
}

.status-badge.degraded {
  background: var(--status-degraded-bg);
  color: var(--status-degraded);
}

.status-badge.unknown {
  background: var(--status-unknown-bg);
  color: var(--status-unknown);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.up .status-dot,
.status-badge.down .status-dot {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Uptime Bar */
.uptime-bar {
  display: flex;
  gap: 2px;
  height: 32px;
  margin-bottom: 0.5rem;
}

.uptime-day {
  flex: 1;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  position: relative;
}

.uptime-day:first-child {
  border-radius: 9999px 4px 4px 9999px;
}

.uptime-day:last-child {
  border-radius: 4px 9999px 9999px 4px;
}

.uptime-day:hover {
  transform: scaleY(1.1);
  opacity: 0.9;
}

.uptime-day.up { background: var(--status-up); }
.uptime-day.down { background: var(--status-down); }
.uptime-day.degraded { background: var(--status-degraded); }
.uptime-day.no-data { background: var(--border); }

.uptime-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dimmed);
}

.uptime-summary {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.uptime-summary strong {
  color: var(--text);
}

/* Tooltip */
.tooltip {
  position: fixed;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  z-index: 1000;
  pointer-events: none;
  transform: translate(-50%, -100%);
  margin-top: -8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip-date {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.tooltip-uptime {
  color: var(--text-muted);
}

/* Skeleton Loading */
.skeleton {
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.skeleton-line {
  height: 20px;
  background: var(--border);
  border-radius: 4px;
  width: 40%;
  margin-bottom: 1rem;
}

.skeleton-bar {
  height: 32px;
  background: var(--border);
  border-radius: var(--radius-sm);
}

/* Last Updated */
.last-updated {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dimmed);
  padding: 1rem 0;
}

/* Footer */
.footer {
  margin-top: auto;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-dimmed);
}

.footer a:hover {
  color: var(--text);
}

/* Incidents Page */
.incidents-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.incident-date {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.incident-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
}

.incident-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 0.5rem;
  flex-shrink: 0;
}

.incident-dot.resolved { background: var(--status-up); }
.incident-dot.ongoing { background: var(--status-down); animation: pulse 2s infinite; }

.incident-content {
  flex: 1;
}

.incident-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.incident-message {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.incident-time {
  font-size: 0.75rem;
  color: var(--text-dimmed);
}

.incident-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  align-self: flex-start;
}

.incident-status.resolved {
  background: var(--status-up-bg);
  color: var(--status-up);
}

.incident-status.ongoing {
  background: var(--status-down-bg);
  color: var(--status-down);
}

.incident-duration {
  font-size: 0.75rem;
  color: var(--text-dimmed);
  margin-top: 0.25rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Updates Page */
.updates-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.update-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.update-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.update-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.update-icon.info { background: var(--accent); color: white; }
.update-icon.maintenance { background: var(--status-degraded); color: white; }
.update-icon.incident { background: var(--status-down); color: white; }
.update-icon.resolved { background: var(--status-up); color: white; }

.update-meta {
  flex: 1;
}

.update-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.update-date {
  font-size: 0.75rem;
  color: var(--text-dimmed);
}

.update-type {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.update-content {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.7;
}

/* Error State */
.error-state {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--status-down-bg);
  border: 1px solid var(--status-down);
  border-radius: var(--radius);
}

.error-state h3 {
  color: var(--status-down);
  margin-bottom: 0.5rem;
}

.error-state p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.retry-btn {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--status-down);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  transition: opacity 0.2s;
}

.retry-btn:hover {
  opacity: 0.9;
}

/* Responsive */
@media (max-width: 640px) {
  .header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .nav {
    gap: 1rem;
  }

  .status-banner {
    flex-direction: column;
    text-align: center;
  }

  .monitor-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}
