/* Food Chain Explorer - Styles */

:root {
  --bg-dark: rgba(0, 0, 0, 0.75);
  --bg-card: rgba(10, 20, 40, 0.85);
  --primary: #ff6b35;
  --secondary: #4ecdc4;
  --text-primary: #ffffff;
  --text-secondary: #a0c4ff;
  --border-glow: rgba(78, 205, 196, 0.5);

  /* Trophic level colors */
  --level-1: #4ade80;  /* Producers - green */
  --level-2: #60a5fa;  /* Herbivores - blue */
  --level-3: #f59e0b;  /* Carnivores - orange */
  --level-4: #ef4444;  /* Apex - red */
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #000;
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Header */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glow);
  z-index: 100;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

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

.version {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.1);
  padding: 4px 12px;
  border-radius: 12px;
}

/* Main area */
#main {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Webcam (background) */
#webcam {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  z-index: 0;
  opacity: 0.3;
}

/* Network canvas (visualization) */
#network-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
}

/* Hand tracking canvas */
#hand-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  transform: scaleX(-1);
  pointer-events: none;
}

/* Detail panel */
.detail-panel {
  position: absolute;
  top: 80px;
  right: 24px;
  width: 320px;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(25px);
  border: 2px solid var(--border-glow);
  box-shadow:
    0 0 40px rgba(78, 205, 196, 0.2),
    0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 20;
  transition: opacity 0.3s, transform 0.3s;
}

.detail-panel.hidden {
  opacity: 0;
  transform: translateX(50px);
  pointer-events: none;
}

.detail-image-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  background: rgba(0,0,0,0.3);
}

.detail-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-info h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.detail-section {
  margin-bottom: 12px;
}

.detail-section h3 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-list .tag {
  background: rgba(255,255,255,0.1);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
}

/* Legend */
.legend {
  position: absolute;
  bottom: 24px;
  left: 24px;
  display: flex;
  gap: 16px;
  background: var(--bg-card);
  padding: 12px 20px;
  border-radius: 16px;
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glow);
  z-index: 20;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.level-1 { background: var(--level-1); }
.legend-dot.level-2 { background: var(--level-2); }
.legend-dot.level-3 { background: var(--level-3); }
.legend-dot.level-4 { background: var(--level-4); }

/* Gesture hints */
.gesture-hints {
  position: absolute;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.hint {
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
}

/* Gesture feedback */
.gesture-feedback {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--primary);
  padding: 16px 32px;
  border-radius: 16px;
  font-size: 1.25rem;
  font-weight: 600;
  backdrop-filter: blur(20px);
  border: 2px solid var(--primary);
  z-index: 50;
  transition: opacity 0.3s, transform 0.3s;
}

.gesture-feedback.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
  pointer-events: none;
}

/* Loading screen */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: opacity 0.5s;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
}

.loading-content h1 {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 16px;
}

.loading-content p {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s linear infinite;
}

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