/* Status Page Styles */

:root {
  --color-healthy: #22c55e;
  --color-degraded: #f59e0b;
  --color-critical: #ef4444;
  --color-bg-dark: #f8f9fa;
  --color-bg-darker: #ffffff;
  --color-surface: rgba(255, 255, 255, 0.95);
  --color-surface-hover: rgba(255, 255, 255, 1);
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-border: rgba(209, 213, 219, 0.5);
  --color-border-light: rgba(209, 213, 219, 0.8);
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  --transition: all 0.2s ease;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  color: var(--color-text);
  line-height: 1.6;
}

.status-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========================
   Header
   ======================== */

.status-header {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--color-border);
  padding: 24px 0;
  backdrop-filter: blur(18px);
}

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

.header-title h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.header-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

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

.btn-refresh {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ecfdf3;
  border: none;
  border-radius: 999px;
  padding: 11px 24px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-refresh:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
}

.btn-refresh:active {
  transform: translateY(0);
}

.btn-back {
  background: #f3f4f6;
  color: var(--color-text);
  border: 1px solid var(--color-border-light);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-back:hover {
  background: #e5e7eb;
  border-color: rgba(107, 114, 128, 0.5);
  transform: translateX(-2px);
}

.last-updated {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* ========================
   Main Content
   ======================== */

.status-main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 28px;
}

/* ========================
   Global Status Section
   ======================== */

.section-global-status {
  margin-bottom: 48px;
}

.global-status-card {
  background: var(--color-surface);
  border-radius: 20px;
  padding: 32px;
  border: 1px solid var(--color-border);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 28px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.global-status-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.status-indicator {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2s infinite;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

.status-indicator.healthy {
  background: var(--color-healthy);
}

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

.status-indicator.critical {
  background: var(--color-critical);
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(34, 197, 94, 0);
  }
}

.status-content h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.status-message {
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stat-item {
  background: var(--color-surface);
  border-radius: 14px;
  padding: 24px 20px;
  border: 1px solid var(--color-border);
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-healthy);
  background: linear-gradient(135deg, #22c55e, #16a34a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========================
   Section Title
   ======================== */

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

/* ========================
   Components Section
   ======================== */

.section-components {
  margin-bottom: 48px;
}

.components-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.component-card {
  background: var(--color-surface);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--color-border);
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.component-card:hover {
  border-color: var(--color-border-light);
  background: var(--color-surface-hover);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.component-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

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

.component-name {
  font-weight: 600;
  font-size: 0.95rem;
}

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

.component-message {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

.component-response-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ========================
   Daemon Section
   ======================== */

.section-daemon {
  margin-bottom: 48px;
}

.daemon-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}

.daemon-card {
  background: var(--color-surface);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--color-border);
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.daemon-card:hover {
  border-color: var(--color-border-light);
  background: var(--color-surface-hover);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.daemon-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

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

.daemon-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.daemon-running-status {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
  display: inline-block;
}

.daemon-running-status.running {
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-healthy);
  border: 1px solid rgba(34, 197, 94, 0.5);
}

.daemon-running-status.offline {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-critical);
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.daemon-status-info {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.daemon-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.daemon-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--color-border);
  padding-top: 8px;
}

.daemon-stat:first-child {
  border-top: none;
  padding-top: 0;
}

.daemon-stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.daemon-stat-value {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text);
}

/* ========================
   Cities Section
   ======================== */

.section-cities {
  margin-bottom: 48px;
}

.cities-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.city-card {
  background: var(--color-surface);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.city-card:hover {
  border-color: var(--color-border-light);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.city-header {
  padding: 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}

.city-info {
  flex: 1;
}

.city-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.city-stats {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.city-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.5);
}

.city-status-badge.degraded {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.5);
}

.city-status-badge.critical {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-healthy);
}

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

.status-dot.critical {
  background: var(--color-critical);
}

.city-providers {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.provider-card {
  background: rgba(243, 244, 246, 0.7);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid rgba(209, 213, 219, 0.5);
  cursor: pointer;
  transition: var(--transition);
}

.provider-card:hover {
  background: rgba(243, 244, 246, 1);
  border-color: rgba(209, 213, 219, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.provider-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.provider-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.provider-status {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.provider-stats {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.provider-stat {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-top: 1px solid rgba(209, 213, 219, 0.3);
  padding-top: 4px;
}

.provider-stat-label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.provider-stat-value {
  font-weight: 600;
  color: var(--color-text);
}

/* ========================
   Loading & Error States
   ======================== */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(34, 197, 94, 0.2);
  border-top-color: var(--color-healthy);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 12px;
  padding: 16px;
  color: #dc2626;
  margin-bottom: 24px;
}

/* ========================
   Footer
   ======================== */

.status-footer {
  text-align: center;
  padding: 24px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.5);
}

.status-footer p {
  margin: 4px 0;
}

/* ========================
   Responsive Design
   ======================== */

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .status-main {
    padding: 16px;
  }

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

  .status-indicator {
    animation: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .components-grid {
    grid-template-columns: 1fr;
  }

  .city-providers {
    grid-template-columns: 1fr;
  }

  .provider-stats {
    grid-template-columns: 1fr;
  }
}
