/* SwarmVisualization Styles */

.swarm-visualization {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--primary-bg);
  overflow: hidden;
}

.visualization-canvas {
  width: 100%;
  height: 100%;
  cursor: grab;
}

.visualization-canvas:active {
  cursor: grabbing;
}


.visualization-info {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  z-index: 10;
  pointer-events: none;
}

/* Classic SETI@home floating panels - Responsive */
.seti-panel {
  background: rgba(0, 100, 200, 0.15);
  border: 2px solid rgba(0, 150, 255, 0.6);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  min-width: 250px; /* Reduced from 280px */
  max-width: 320px; /* Add max-width constraint */
  backdrop-filter: blur(8px);
  box-shadow: 
    0 0 20px rgba(0, 150, 255, 0.3),
    inset 0 0 20px rgba(0, 150, 255, 0.1);
  color: #ffffff;
  font-family: 'Courier New', monospace;
  pointer-events: auto;
  animation: seti-panel-glow 3s ease-in-out infinite alternate;
  box-sizing: border-box; /* Include padding in width */
}

@keyframes seti-panel-glow {
  0% {
    box-shadow: 
      0 0 15px rgba(0, 150, 255, 0.2),
      inset 0 0 15px rgba(0, 150, 255, 0.08);
  }
  100% {
    box-shadow: 
      0 0 25px rgba(0, 150, 255, 0.4),
      inset 0 0 25px rgba(0, 150, 255, 0.15);
  }
}

.seti-panel.agent-info {
  background: rgba(0, 150, 80, 0.15);
  border-color: rgba(0, 255, 136, 0.6);
  box-shadow: 
    0 0 20px rgba(0, 255, 136, 0.3),
    inset 0 0 20px rgba(0, 255, 136, 0.1);
}

.seti-panel h3 {
  color: #00ddff;
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px #00ddff;
}

.seti-data-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.seti-data-line span:first-child {
  color: #aaccff;
  font-weight: normal;
}

.data-value {
  color: #ffffff;
  font-weight: bold;
  text-shadow: 0 0 5px currentColor;
}

.data-value.highlight {
  color: #ffaa00;
  text-shadow: 0 0 8px #ffaa00;
}

.data-value.success {
  color: #00ff88;
  text-shadow: 0 0 8px #00ff88;
}

.spectrum-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.spectrum-red {
  background: linear-gradient(90deg, #ff0000, #ff4444);
  box-shadow: 0 0 8px #ff0000;
}

.spectrum-yellow {
  background: linear-gradient(90deg, #ffff00, #ffaa00);
  box-shadow: 0 0 8px #ffaa00;
}

.spectrum-green {
  background: linear-gradient(90deg, #00ff00, #44ff44);
  box-shadow: 0 0 8px #00ff00;
}

.spectrum-blue {
  background: linear-gradient(90deg, #0088ff, #4444ff);
  box-shadow: 0 0 8px #0088ff;
}

.info-panel {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  min-width: 200px;
}

.info-panel h3 {
  color: var(--primary-text);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.legend-item span {
  color: var(--secondary-text);
  font-size: 0.9rem;
  font-weight: 500;
}

.agent-info-panel {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  min-width: 250px;
  animation: slide-in-right 0.3s ease-out;
}

.agent-info-panel h3 {
  color: var(--primary-text);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.agent-info-panel p {
  color: var(--secondary-text);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.agent-info-panel strong {
  color: var(--primary-text);
  font-weight: 600;
}

/* Loading states */
.visualization-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 20;
}

.visualization-loading h3 {
  color: var(--primary-text);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 20px var(--glow-color);
}

.visualization-loading p {
  color: var(--secondary-text);
  font-size: 1rem;
  opacity: 0.8;
}

/* Performance indicator */
.performance-indicator {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.8rem 1.2rem;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.performance-indicator span {
  color: var(--secondary-text);
  font-size: 0.8rem;
  margin-right: 1rem;
}

.fps-counter {
  color: var(--primary-text);
  font-weight: 700;
}

/* WebGL Fallback Styles - Classic SETI@home inspired */
.webgl-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #000011 0%, #000033 100%);
  z-index: 10;
}

.fallback-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2rem;
  max-width: 800px;
  width: 90%;
  color: var(--primary-text);
}

.seti-header {
  text-align: center;
  margin-bottom: 1rem;
}

.seti-header h3 {
  color: #00ccff;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px #00ccff;
  letter-spacing: 0.1em;
}

.seti-header p {
  color: #88ccff;
  font-size: 1.1rem;
  text-shadow: 0 0 10px #88ccff;
}

.analysis-panels {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.data-panel {
  background: rgba(0, 50, 100, 0.3);
  border: 2px solid #0066cc;
  border-radius: 8px;
  padding: 1.5rem;
  min-width: 300px;
  box-shadow: 0 0 20px rgba(0, 102, 204, 0.3);
}

.data-panel h4 {
  color: #00ccff;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 10px #00ccff;
}

.spectrum-bars {
  display: flex;
  align-items: end;
  gap: 3px;
  height: 80px;
  margin: 1rem 0;
  padding: 0 1rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}

.spectrum-bar {
  width: 8px;
  min-height: 2px;
  border-radius: 2px;
  box-shadow: 0 0 5px currentColor;
  animation: spectrum-pulse 2s ease-in-out infinite;
}

@keyframes spectrum-pulse {
  0%, 100% { opacity: 0.7; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(1.2); }
}

.info-panel-fallback {
  background: rgba(0, 80, 50, 0.3);
  border: 2px solid #00aa66;
  border-radius: 8px;
  padding: 1.5rem;
  min-width: 250px;
  box-shadow: 0 0 20px rgba(0, 170, 102, 0.3);
}

.info-panel-fallback h4 {
  color: #00ff88;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 10px #00ff88;
}

.info-panel-fallback p {
  color: #88ffaa;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  font-family: 'Courier New', monospace;
}

.fallback-note {
  text-align: center;
  padding: 1rem;
  background: rgba(100, 50, 0, 0.3);
  border: 1px solid #cc6600;
  border-radius: 6px;
  color: #ffaa66;
}

.fallback-note p {
  margin: 0.3rem 0;
  font-size: 0.9rem;
}

/* Animations */
@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 5px currentColor;
  }
  50% {
    box-shadow: 0 0 20px currentColor;
  }
}

/* Fullscreen mode */
.swarm-visualization.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  background: var(--primary-bg);
}


.swarm-visualization.fullscreen .visualization-info {
  top: 2rem;
  right: 2rem;
}

/* Responsive Design - Prevent Overlapping */
@media (max-width: 1400px) {
  .visualization-info {
    max-width: 300px; /* Constrain panel width */
  }
  
  .seti-panel {
    min-width: 220px; /* Smaller panels */
    max-width: 280px;
  }
}

@media (max-width: 1024px) {
  .visualization-info {
    position: absolute; /* Keep floating but constrained */
    top: 1rem;
    right: 1rem;
    max-width: 280px; /* Prevent overflow */
    max-height: calc(100vh - 200px); /* Prevent vertical overflow */
    overflow-y: auto; /* Allow scrolling if needed */
  }
  
  .seti-panel {
    min-width: 200px; /* Even smaller */
    max-width: 250px;
    padding: 0.8rem 1rem; /* Smaller padding */
  }
}

@media (max-width: 768px) {
  .visualization-info {
    position: absolute;
    top: 1rem;
    right: 1rem;
    max-width: 280px;
    gap: 1rem; /* Smaller gap between panels */
  }
  
  .seti-panel {
    min-width: 180px;
    max-width: 220px;
    padding: 0.8rem;
  }
  
  .seti-data-line {
    font-size: 0.8rem; /* Smaller text */
  }
}

@media (max-width: 600px) {
  /* Stack panels vertically to prevent horizontal overlap */
  .visualization-info {
    position: static; /* Remove floating */
    display: flex;
    flex-direction: row; /* Horizontal layout */
    flex-wrap: wrap;
    gap: 0.8rem;
    margin: 1rem;
    max-width: none;
    justify-content: center;
  }
  
  .seti-panel {
    min-width: 150px;
    max-width: 180px;
    flex: 1;
    padding: 0.6rem;
  }
  
  .seti-panel h3 {
    font-size: 0.9rem; /* Smaller headings */
  }
  
  .seti-data-line {
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
  }
}

@media (max-width: 480px) {
  /* Single column layout on very small screens */
  .visualization-info {
    flex-direction: column;
    align-items: center;
  }
  
  .seti-panel {
    min-width: 140px;
    max-width: calc(100vw - 2rem); /* Full width minus margins */
    padding: 0.5rem;
  }
}