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

:root {
  --bg-dark: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 35, 54, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-primary: #6366f1;
  --accent-cyan: #06b6d4;

  --color-operational: #10b981;
  --color-operational-bg: rgba(16, 185, 129, 0.12);
  --color-degraded: #f59e0b;
  --color-degraded-bg: rgba(245, 158, 11, 0.12);
  --color-outage: #ef4444;
  --color-outage-bg: rgba(239, 68, 68, 0.12);
  --color-maintenance: #3b82f6;
  --color-maintenance-bg: rgba(59, 130, 246, 0.12);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.2);
  --shadow-glow-amber: 0 0 20px rgba(245, 158, 11, 0.2);
  --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.2);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.12) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand-title {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

/* Layout Elements */
.app-header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 0;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.container {
  max-width: 1280px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Flash alerts */
.flash-message {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.flash-notice {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.flash-alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Hero Banner & Overall Status */
.hero-status-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.status-indicator-huge {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.pulse-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulse-operational {
  background-color: var(--color-operational);
  box-shadow: var(--shadow-glow-green);
}
.pulse-operational::after { background-color: rgba(16, 185, 129, 0.4); }

.pulse-degraded {
  background-color: var(--color-degraded);
  box-shadow: var(--shadow-glow-amber);
}
.pulse-degraded::after { background-color: rgba(245, 158, 11, 0.4); }

.pulse-outage {
  background-color: var(--color-outage);
  box-shadow: var(--shadow-glow-red);
}
.pulse-outage::after { background-color: rgba(239, 68, 68, 0.4); }

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

.status-title {
  font-size: 1.65rem;
  font-weight: 700;
}

.status-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Stat Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(8px);
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}

/* Services Grid & Cards */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
}

.services-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  transition: all 0.25 ease;
}

.service-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.service-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

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

.service-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.service-name:hover {
  color: var(--accent-cyan);
}

.http-method-badge {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--accent-cyan);
}

.service-url {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: 'Fira Code', monospace;
  margin-top: 0.25rem;
}

.service-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-operational { background: var(--color-operational-bg); color: var(--color-operational); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-degraded { background: var(--color-degraded-bg); color: var(--color-degraded); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-outage { background: var(--color-outage-bg); color: var(--color-outage); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-maintenance { background: var(--color-maintenance-bg); color: var(--color-maintenance); border: 1px solid rgba(59, 130, 246, 0.3); }

/* Timeline Bar Visualization */
.timeline-container {
  margin-top: 1rem;
}

.timeline-bars {
  display: flex;
  gap: 3px;
  height: 28px;
  align-items: flex-end;
}

.timeline-bar {
  flex: 1;
  height: 24px;
  border-radius: 3px;
  transition: all 0.2s ease;
  position: relative;
}

.timeline-bar:hover {
  height: 28px;
  transform: scaleY(1.1);
  filter: brightness(1.2);
}

.bar-success { background-color: var(--color-operational); }
.bar-degraded { background-color: var(--color-degraded); }
.bar-failed { background-color: var(--color-outage); }
.bar-empty { background-color: rgba(255, 255, 255, 0.05); }

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* Incidents Section */
.incident-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.incident-card.severity-major_outage { border-left-color: var(--color-outage); }
.incident-card.severity-partial_outage { border-left-color: var(--color-degraded); }

.incident-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.incident-title {
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-primary);
}

.incident-title:hover { color: var(--accent-primary); }

.incident-timeline {
  margin-top: 1.25rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-color);
}

.update-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.update-item::before {
  content: '';
  position: absolute;
  left: -1.35rem;
  top: 0.2rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.update-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.update-body {
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* Forms & UI Controls */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.form-control, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(9, 13, 22, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.form-control:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-control-code {
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* Public Status Page Specific */
.status-page-layout {
  max-width: 960px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Countdown to a service's next scheduled health check. tabular-nums keeps the
   digits from jittering as the seconds tick down. */
.service-countdown {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
  min-height: 1rem;
}

/* Suspended monitoring. Amber rather than red: paused is a deliberate operator
   action, not a failure, and must not read as an outage at a glance. */
.paused-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-degraded);
  background: var(--color-degraded-bg);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Dim a paused card so the eye skips it when scanning for live problems. */
.service-card:has(.paused-badge) .service-status-badge {
  opacity: 0.55;
}
