/* ============================================
   BRIDGE MONITOR - MISSION CONTROL THEME
   ============================================ */

:root {
  /* Base colors */
  --bg-primary: #0a0f1a;
  --bg-secondary: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #273548;

  /* Text colors */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Status colors */
  --status-healthy: #10b981;
  --status-healthy-glow: rgba(16, 185, 129, 0.3);
  --status-warning: #f59e0b;
  --status-warning-glow: rgba(245, 158, 11, 0.3);
  --status-critical: #ef4444;
  --status-critical-glow: rgba(239, 68, 68, 0.3);

  /* Accent colors */
  --accent-cyan: #06b6d4;
  --accent-violet: #8b5cf6;
  --accent-emerald: #10b981;

  /* Borders */
  --border-subtle: rgba(148, 163, 184, 0.1);
  --border-medium: rgba(148, 163, 184, 0.2);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Typography */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  margin: 0;
  padding: var(--space-lg);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at top, rgba(6, 182, 212, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
}

/* ============================================
   STATUS BANNER
   ============================================ */

.status-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin-bottom: var(--space-xl);
}

.status-banner.status-healthy {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.1);
}

.status-banner.status-warning {
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.1);
}

.status-banner.status-critical {
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.1);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.status-healthy {
  background: var(--status-healthy);
  box-shadow: 0 0 12px var(--status-healthy-glow);
}

.status-dot.status-warning {
  background: var(--status-warning);
  box-shadow: 0 0 12px var(--status-warning-glow);
  animation: pulse-warning 1s ease-in-out infinite;
}

.status-dot.status-critical {
  background: var(--status-critical);
  box-shadow: 0 0 12px var(--status-critical-glow);
  animation: pulse-critical 0.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.95); }
}

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

@keyframes pulse-critical {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.status-text {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-healthy .status-text { color: var(--status-healthy); }
.status-warning .status-text { color: var(--status-warning); }
.status-critical .status-text { color: var(--status-critical); }

/* Network Badge */
.network-badge {
  margin-left: var(--space-md);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 0.2s ease;
}

.network-badge.network-mainnet {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-healthy);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.network-badge.network-mainnet:hover {
  background: rgba(16, 185, 129, 0.25);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.network-badge.network-testnet {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.network-badge.network-testnet:hover {
  background: rgba(245, 158, 11, 0.25);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.status-metrics {
  display: flex;
  gap: var(--space-lg);
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--space-md);
  border-left: 1px solid var(--border-subtle);
}

.metric:first-child {
  border-left: none;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gas-strip {
  display: flex;
  gap: var(--space-xs);
  background: var(--bg-primary);
  padding: var(--space-xs);
  border-radius: 8px;
}

.gas-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 6px;
  min-width: 56px;
}

.gas-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  opacity: 0.7;
}

.gas-value {
  font-size: 0.75rem;
  font-weight: 600;
}

.gas-slow { color: var(--status-healthy); }
.gas-standard { color: var(--accent-cyan); }
.gas-fast { color: var(--status-warning); }
.gas-rapid { color: var(--status-critical); }

/* ============================================
   SECTION TITLES
   ============================================ */

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
}

.section-title svg {
  color: var(--accent-cyan);
}

/* ============================================
   VALIDATORS GRID
   ============================================ */

.validators-section {
  margin-bottom: var(--space-xl);
}

.validators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

.validator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: var(--space-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.validator-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.validator-card.status-healthy {
  border-left: 3px solid var(--status-healthy);
}

.validator-card.status-warning {
  border-left: 3px solid var(--status-warning);
  background: rgba(245, 158, 11, 0.05);
}

.validator-card.status-critical {
  border-left: 3px solid var(--status-critical);
  background: rgba(239, 68, 68, 0.05);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.validator-address {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color 0.2s;
}

.validator-address:hover {
  color: var(--text-primary);
}

.validator-status-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.validator-status-badge.status-healthy {
  color: var(--status-healthy);
  background: rgba(16, 185, 129, 0.15);
}

.validator-status-badge.status-warning {
  color: var(--status-warning);
  background: rgba(245, 158, 11, 0.15);
}

.validator-status-badge.status-critical {
  color: var(--status-critical);
  background: rgba(239, 68, 68, 0.15);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sparkline-container {
  position: relative;
  height: 40px;
}

.sparkline {
  width: 100%;
  height: 30px;
}

.sparkline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-metrics {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
}

.card-metric {
  display: flex;
  flex-direction: column;
}

.card-metric-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-metric-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.card-metric-value.low-balance {
  color: var(--status-warning);
}

.nonce-delta {
  font-size: 0.7rem;
  margin-left: 2px;
}

.nonce-delta.positive {
  color: var(--status-healthy);
}

.nonce-delta.neutral {
  color: var(--text-muted);
}

/* Card Details (Expanded) */
.card-details {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-xs) 0;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.detail-value {
  font-size: 0.75rem;
  font-weight: 500;
}

.detail-value.positive {
  color: var(--status-healthy);
}

.detail-value.negative {
  color: var(--status-critical);
}

/* ============================================
   BRIDGE PANELS
   ============================================ */

.bridge-section {
  margin-bottom: var(--space-xl);
}

.bridge-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-lg);
}

.bridge-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
}

.pending-panel.has-pending {
  border-color: rgba(245, 158, 11, 0.3);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.panel-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pending-icon {
  background: var(--status-warning);
  box-shadow: 0 0 8px var(--status-warning-glow);
}

.completed-icon {
  background: var(--status-healthy);
  box-shadow: 0 0 8px var(--status-healthy-glow);
}

.panel-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: var(--space-xs);
}

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

.panel-body {
  padding: var(--space-md);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--text-muted);
  gap: var(--space-sm);
}

.empty-state svg {
  color: var(--status-healthy);
  opacity: 0.5;
}

.request-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.request-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid transparent;
}

.request-item.over-time {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}

.request-item.completed {
  background: rgba(16, 185, 129, 0.05);
}

.request-hash {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  text-decoration: none;
  flex-shrink: 0;
}

.request-hash:hover {
  color: var(--text-primary);
}

.request-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.request-time.over-time {
  color: var(--status-critical);
  font-weight: 600;
}

.request-duration {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.request-duration.fast {
  color: var(--status-healthy);
}

.request-duration.slow {
  color: var(--status-critical);
}

.signature-bar {
  position: relative;
  flex: 1;
  height: 16px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
}

.signature-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.signature-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.show-more-btn {
  display: block;
  width: 100%;
  margin-top: var(--space-md);
  padding: var(--space-sm);
  background: transparent;
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.show-more-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

/* ============================================
   CHARTS SECTION
   ============================================ */

.charts-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--space-lg);
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: var(--space-lg);
}

.chart-title {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 var(--space-md) 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chart-wrapper {
  height: 200px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  body {
    padding: var(--space-md);
  }

  .status-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .status-metrics {
    width: 100%;
    justify-content: space-between;
  }

  .metric {
    padding: 0;
    border-left: none;
  }

  .gas-strip {
    width: 100%;
    justify-content: space-between;
  }

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

  .bridge-panels {
    grid-template-columns: 1fr;
  }

  .charts-section {
    grid-template-columns: 1fr;
  }

  .request-item {
    flex-wrap: wrap;
  }

  .signature-bar {
    width: 100%;
    order: 3;
    margin-top: var(--space-xs);
  }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-card);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-card-hover);
}

/* ============================================
   SELECTION STYLING
   ============================================ */

::selection {
  background: var(--accent-cyan);
  color: var(--bg-primary);
}

/* ============================================
   FOCUS STATES
   ============================================ */

a:focus,
button:focus {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* ============================================
   LOADING STATE
   ============================================ */

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.loading {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
