/* =============================================================================
   SDGQUEST HUD OVERLAY - Floating Panels on Galaxy Map
   CASi Labs - December 2025
   ============================================================================= */

/* ============================================
   LAYOUT: Full-viewport Map with HUD Overlay
   ============================================ */

/* Map section becomes the hero - full viewport */
.map-section {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  margin: 0;
  padding: 0;
  max-width: none;
}
.map-section .map-title,
.map-section .map-subtitle {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
  pointer-events: none;
}
.map-section .map-title {
  top: 15px;
  font-size: 1.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  padding-bottom: 1rem;
}
.map-section .map-subtitle {
  top: 65px;
  font-size: 0.95rem;
  opacity: 0.8;
}
#galaxyCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 0;
  box-shadow: none;
}

/* Footer inside map section */
.map-section .footer {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: transparent;
  padding: 0.5rem 1rem;
  pointer-events: none;
}

.map-section .footer p {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(200, 210, 230, 0.6);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ============================================
   HUD CONTAINER - Floating Panel Stack
   ============================================ */

.hud-container {
  position: absolute;
  top: 90px;
  left: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

/* ============================================
   HUD PANEL - Base Styling (Space Theme)
   ============================================ */

.hud-panel {
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.92) 0%,
    rgba(30, 41, 59, 0.88) 100%
  );
  border: 1px solid rgba(100, 149, 237, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  width: 240px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(100, 149, 237, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.hud-panel:hover {
  border-color: rgba(100, 149, 237, 0.5);
  box-shadow: 
    0 4px 25px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(100, 149, 237, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Panel Header */
.hud-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(100, 149, 237, 0.2);
}

.hud-panel-header .hud-icon {
  font-size: 1.1rem;
  filter: drop-shadow(0 0 4px currentColor);
}

.hud-panel-header h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(200, 210, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
  padding: 0;
  border: none;
  text-align: left;
}

/* ============================================
   TIMELINE PANEL
   ============================================ */

.hud-panel.timeline .hud-panel-header {
  border-bottom-color: rgba(139, 92, 246, 0.3);
}

.hud-timeline-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.hud-current-date {
  font-size: 1.1rem;
  font-weight: 700;
  color: #a78bfa;
  text-shadow: 0 0 10px rgba(167, 139, 250, 0.5);
}

.hud-time-remaining {
  font-size: 0.75rem;
  color: rgba(200, 200, 255, 0.7);
}

/* Compact Timeline Bar */
.hud-timeline-bar {
  height: 6px;
  background: rgba(100, 100, 150, 0.3);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.hud-timeline-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
  border-radius: 3px;
  transition: width 0.6s ease;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
}

/* Mini Trend Chart */
.hud-trend-container {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(100, 149, 237, 0.15);
}

.hud-trend-header {
  font-size: 0.65rem;
  color: rgba(180, 180, 220, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

#hudTrendChart {
  width: 100%;
  height: 55px;
  display: block;
  border-radius: 4px;
  background: rgba(30, 41, 59, 0.3);
}

.hud-trend-legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
  font-size: 0.7rem;
}

.hud-trend-legend .legend-item {
  opacity: 0.8;
}

/* ============================================
   METERS PANEL (World Balance)
   ============================================ */

.hud-panel.meters .hud-panel-header {
  border-bottom-color: rgba(16, 185, 129, 0.3);
}

.hud-meters-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-meter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-meter-icon {
  font-size: 0.9rem;
  width: 20px;
  text-align: center;
}

.hud-meter-bar {
  flex: 1;
  height: 14px;
  background: rgba(100, 100, 150, 0.25);
  border-radius: 7px;
  overflow: hidden;
  position: relative;
}

.hud-meter-fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
}

.hud-meter-fill.planet {
  background: linear-gradient(90deg, #059669, #10b981);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.hud-meter-fill.equity {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.hud-meter-fill.prosperity {
  background: linear-gradient(90deg, #d97706, #f59e0b);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.hud-meter-value {
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  min-width: 18px;
  text-align: right;
}

/* Critical state animation */
.hud-meter-fill.critical {
  animation: hud-pulse 1.5s ease-in-out infinite;
}

@keyframes hud-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
  50% { opacity: 0.7; box-shadow: 0 0 15px rgba(239, 68, 68, 0.8); }
}

/* ============================================
   PROGRESS PANEL
   ============================================ */

.hud-panel.progress .hud-panel-header {
  border-bottom-color: rgba(245, 158, 11, 0.3);
}

.hud-progress-main {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.hud-progress-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
}

.hud-progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.hud-progress-count {
  color: #fbbf24;
  font-weight: 700;
}

/* Status Message */
.hud-status-message {
  font-size: 0.72rem;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.hud-status-message.neutral {
  background: rgba(100, 149, 237, 0.15);
  color: rgba(180, 200, 255, 0.9);
  border-left: 2px solid rgba(100, 149, 237, 0.5);
}

.hud-status-message.warning {
  background: rgba(245, 158, 11, 0.15);
  color: rgba(255, 220, 150, 0.95);
  border-left: 2px solid rgba(245, 158, 11, 0.6);
}

.hud-status-message.danger {
  background: rgba(239, 68, 68, 0.15);
  color: rgba(255, 180, 180, 0.95);
  border-left: 2px solid rgba(239, 68, 68, 0.6);
}

.hud-status-message.success {
  background: rgba(16, 185, 129, 0.15);
  color: rgba(180, 255, 220, 0.95);
  border-left: 2px solid rgba(16, 185, 129, 0.6);
}

/* Risk Indicators */
.hud-risk-indicators {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hud-risk-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(100, 100, 150, 0.2);
}

.hud-risk-item .risk-icon {
  font-size: 0.75rem;
}

.hud-risk-item .risk-status {
  font-weight: 600;
}

.hud-risk-item .risk-status.stable {
  color: #10b981;
}

.hud-risk-item .risk-status.warning {
  color: #f59e0b;
}

.hud-risk-item .risk-status.critical {
  color: #ef4444;
  animation: blink 1s infinite;
}

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

/* ============================================
   CRISIS WARNING (appears in progress panel)
   ============================================ */

.hud-crisis-warning {
  margin-top: 8px;
  padding: 6px 8px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.15));
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 6px;
  animation: crisis-glow 2s ease-in-out infinite;
}

@keyframes crisis-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }
  50% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.4); }
}

.hud-crisis-warning .crisis-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fca5a5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.hud-crisis-warning .crisis-text {
  font-size: 0.68rem;
  color: rgba(255, 200, 200, 0.9);
  line-height: 1.3;
}

/* ============================================
   HUD COLLAPSE TOGGLE
   ============================================ */

.hud-collapse-toggle {
  position: absolute;
  top: 90px;
  left: 270px;
  z-index: 101;
  width: 28px;
  height: 28px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(100, 149, 237, 0.3);
  border-radius: 6px;
  color: rgba(200, 210, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.hud-collapse-toggle:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(100, 149, 237, 0.5);
  color: white;
}

.hud-container.collapsed {
  transform: translateX(-260px);
}

.hud-container.collapsed + .hud-collapse-toggle {
  left: 20px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .hud-container {
    top: auto;
    bottom: 20px;
    left: 10px;
    right: 10px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }
  
  .hud-panel {
    width: calc(50% - 4px);
    min-width: 150px;
    max-width: 200px;
    padding: 10px 12px;
  }
  
  .hud-panel.progress {
    width: 100%;
    max-width: 320px;
  }
  
  .map-section .map-title {
    font-size: 1.2rem;
  }
  
  .map-section .map-subtitle {
    font-size: 0.8rem;
  }
  
  .hud-collapse-toggle {
    display: none;
  }
}

@media (max-width: 480px) {
  .hud-panel {
    width: 100%;
    max-width: none;
  }
  
  .hud-container {
    flex-direction: column;
    align-items: center;
  }
}

/* ============================================
   HIDE ORIGINAL DASHBOARD
   ============================================ */

.dashboard-horizontal-triple {
  display: none !important;
}