/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* HSL Sleek Dark Theme Color Scheme */
  --bg-dark: hsl(220, 20%, 6%);
  --bg-primary: hsl(222, 25%, 10%);
  --bg-card: hsla(223, 20%, 14%, 0.6);
  --bg-card-hover: hsla(223, 20%, 18%, 0.7);
  --border-card: hsla(223, 20%, 25%, 0.4);
  --border-glow: hsla(210, 100%, 50%, 0.15);
  
  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 75%);
  --text-muted: hsl(215, 12%, 50%);

  /* Status Colors */
  --color-success: hsl(150, 80%, 45%);
  --color-success-bg: hsla(150, 80%, 45%, 0.15);
  --color-warning: hsl(38, 95%, 50%);
  --color-warning-bg: hsla(38, 95%, 50%, 0.15);
  --color-error: hsl(0, 85%, 60%);
  --color-error-bg: hsla(0, 85%, 60%, 0.15);
  --color-info: hsl(210, 100%, 60%);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-title: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', monospace;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Dynamic Background Glows */
.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.12;
  pointer-events: none;
  mix-blend-mode: screen;
}

.bg-glow-1 {
  background: radial-gradient(circle, var(--color-info) 0%, transparent 70%);
  top: -200px;
  left: -200px;
}

.bg-glow-2 {
  background: radial-gradient(circle, var(--color-success) 0%, transparent 70%);
  bottom: -200px;
  right: -200px;
}

/* App Container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

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

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo-container {
  position: relative;
  width: 50px;
  height: 50px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.radar-svg {
  width: 30px;
  height: 30px;
  color: var(--color-info);
}

.radar-sweep {
  transform-origin: 12px 12px;
  animation: radar-spin 4s linear infinite;
  stroke: var(--color-info);
}

.radar-ring-1 { animation: pulse-ring 2s ease-out infinite; opacity: 0.2; }
.radar-ring-2 { animation: pulse-ring 2s ease-out infinite 0.6s; opacity: 0.4; }
.radar-ring-3 { opacity: 0.6; }

.pulse-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: var(--color-success);
  border-radius: 50%;
  top: 6px;
  right: 6px;
  box-shadow: 0 0 10px var(--color-success);
}

.header-title h1 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot-checking {
  background-color: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
  animation: pulse-glow 1.5s infinite;
}

.status-dot-connected {
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.status-dot-disconnected {
  background-color: var(--color-error);
  box-shadow: 0 0 8px var(--color-error);
  animation: pulse-glow 1s infinite;
}

.uptime-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
}

.uptime-badge .label {
  color: var(--text-muted);
  margin-right: 0.4rem;
}

.uptime-badge .value {
  font-family: var(--font-mono);
  color: var(--color-info);
  font-weight: 500;
}

/* Alert Banner */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background-color: var(--color-error-bg);
  border: 1px solid var(--color-error);
  border-radius: 12px;
  animation: slide-down 0.4s ease-out;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.15);
}

.alert-banner.hidden {
  display: none !important;
}

.alert-icon {
  width: 20px;
  height: 20px;
  color: var(--color-error);
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.alert-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.alert-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Dashboard Cards Base */
.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  padding: 1.75rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.dashboard-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: var(--bg-card-hover);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.card-header {
  margin-bottom: 1.5rem;
}

.card-header h2 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.25rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 2rem;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* System Health details */
.system-health {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}

.health-metrics {
  display: flex;
  justify-content: space-around;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.metric-gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.circular-gauge {
  position: relative;
  width: 110px;
  height: 110px;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 3;
}

.gauge-progress {
  fill: none;
  stroke: var(--color-info);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
}

.temp-progress {
  stroke: var(--color-success);
}

.gauge-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.loadavg-text, .temp-status-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.bar-metrics {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.bar-metric-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bar-metric-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.bar-metric-info .label {
  color: var(--text-secondary);
}

.bar-metric-info .value {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-info) 0%, hsl(210, 100%, 70%) 100%);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.progress-bar-fill.disk-fill {
  background: linear-gradient(90deg, hsl(260, 80%, 55%) 0%, hsl(260, 100%, 65%) 100%);
}

/* Feeder List Layout */
.status-group {
  display: flex;
  flex-direction: column;
}

.feeders-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.feeder-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
}

.feeder-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.05);
}

.feeder-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.feeder-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-bullet-active {
  background-color: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
}

.status-bullet-inactive {
  background-color: var(--color-error);
}

.feeder-name {
  font-family: var(--font-title);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.feeder-alias {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.feeder-status {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  text-align: center;
  min-width: 85px;
}

.status-label-active {
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.status-label-inactive {
  background-color: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

/* MLAT Checks Section */
.mlat-checks {
  display: flex;
  flex-direction: column;
}

.mlat-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mlat-item {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

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

.mlat-name {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.mlat-status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.mlat-status-pill.status-active {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.mlat-status-pill.status-warn {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
}

.mlat-status-pill.status-inactive {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.mlat-detail {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-all;
}

/* Active Flights Table Section */
.flights-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.flights-stats {
  display: flex;
  gap: 1rem;
}

.stat-badge {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.stat-badge .label {
  color: var(--text-muted);
  margin-right: 0.4rem;
}

.stat-badge .value {
  font-family: var(--font-mono);
  color: var(--color-info);
  font-weight: 600;
}

/* Table styling */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.15);
  max-height: 380px;
  overflow-y: auto;
}

.flights-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.flights-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 10;
}

.flights-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.flights-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.015);
  color: var(--text-primary);
}

.flights-table tr:last-child td {
  border-bottom: none;
}

.empty-table-msg {
  text-align: center;
  padding: 3rem !important;
  color: var(--text-muted);
  font-family: var(--font-sans) !important;
}

/* Animations */
@keyframes radar-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.5; }
  100% { transform: scale(1.1); opacity: 0; }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.8; box-shadow: 0 0 4px currentColor; }
  50% { opacity: 1; box-shadow: 0 0 12px currentColor; }
}

@keyframes slide-down {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Mobile Responsiveness Rules */
@media (max-width: 576px) {
  .app-container {
    padding: 1rem 0.75rem;
    gap: 1.25rem;
  }
  
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1rem;
  }
  
  .header-left {
    width: 100%;
  }
  
  .header-right {
    width: 100%;
    justify-content: space-between;
    gap: 0.75rem;
  }
  
  .connection-status, .uptime-badge {
    flex: 1;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }
  
  .dashboard-card {
    padding: 1.25rem;
    border-radius: 16px;
  }
  
  .card-header h2 {
    font-size: 1.1rem;
  }
  
  .feeder-item {
    padding: 0.6rem 0.75rem;
  }
  
  .feeder-name {
    font-size: 0.85rem;
  }
  
  .feeder-alias {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
  }
  
  .feeder-status {
    font-size: 0.7rem;
    min-width: 75px;
    padding: 0.2rem 0.4rem;
  }

  .mlat-name {
    font-size: 0.85rem;
  }

  .mlat-status-pill {
    font-size: 0.65rem;
  }

  .mlat-detail {
    font-size: 0.72rem;
  }

  /* Optimize active flights table for mobile screens */
  .flights-table th:nth-child(5),
  .flights-table td:nth-child(5),
  .flights-table th:nth-child(6),
  .flights-table td:nth-child(6),
  .flights-table th:nth-child(7),
  .flights-table td:nth-child(7) {
    display: none;
  }
}
