/* ═══════════════════════════════════════════════════════════════
   canvas.css  —  EduNudge SciLab | Structure of the Atom
   Three.js canvas container, shell label overlay, speed bar
═══════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────
   1.  CANVAS SECTION  (centre column)
─────────────────────────────────────────────────────────────── */
.canvas-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--bg-page);

  /* Subtle inner border on left and right */
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}

/* ───────────────────────────────────────────────────────────────
   2.  THREE.JS CANVAS CONTAINER
─────────────────────────────────────────────────────────────── */
#canvasContainer {
  flex: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  cursor: default;
}

/* The actual <canvas> injected by Three.js renderer */
#canvasContainer canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ───────────────────────────────────────────────────────────────
   3.  SHELL LABELS OVERLAY
   Floating K / L / M / N labels positioned over the canvas
─────────────────────────────────────────────────────────────── */
.shell-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* clicks pass through to canvas */
  z-index: 5;
}

/* ── Individual shell label ── */
.shell-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  transform: translateY(-50%);

  /* Glass card effect */
  background: rgba(13, 18, 37, 0.72);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  backdrop-filter: blur(6px);

  /* Soft glow */
  box-shadow: 0 0 12px rgba(79, 195, 247, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.4);

  /* Animate in when element changes */
  animation: labelFadeIn 0.35s ease forwards;
}

@keyframes labelFadeIn {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(6px);
  }

  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* ── Shell letter  K / L / M / N ── */
.shell-letter {
  font-size: 13px;
  font-weight: 800;
  color: var(--brand-glow);
  letter-spacing: 0.06em;
  line-height: 1;
}

/* ── Electron count  e.g. "8 e⁻" ── */
.shell-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

/* ── Max capacity  e.g. "(max 8)" ── */
.shell-max {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1;
}

/* ───────────────────────────────────────────────────────────────
   4.  CANVAS CORNER BADGE  (element name + symbol, top-centre)
─────────────────────────────────────────────────────────────── */
.canvas-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
      transparent 0%,
      var(--brand-blue) 30%,
      var(--brand-glow) 50%,
      var(--brand-blue) 70%,
      transparent 100%);
  z-index: 6;
  opacity: 0.6;
}

/* ───────────────────────────────────────────────────────────────
   5.  SPEED CONTROL BAR  (bottom of canvas section)
─────────────────────────────────────────────────────────────── */
.speed-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-panel);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  height: 46px;
}

/* ── Label ── */
.speed-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Range Slider ── */
#speedSlider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 4px;
  background: var(--border-bright);
  outline: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

#speedSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand-glow);
  cursor: pointer;
  border: 2px solid var(--bg-page);
  box-shadow: 0 0 8px rgba(79, 195, 247, 0.6);
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

#speedSlider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 14px rgba(79, 195, 247, 0.9);
}

#speedSlider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand-glow);
  cursor: pointer;
  border: 2px solid var(--bg-page);
  box-shadow: 0 0 8px rgba(79, 195, 247, 0.6);
}

/* ── Speed value readout ── */
.speed-value {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--brand-glow);
  min-width: 30px;
  text-align: right;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* ───────────────────────────────────────────────────────────────
   6.  PAUSE BUTTON
─────────────────────────────────────────────────────────────── */
.btn-pause {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  background: var(--bg-panel-section);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
  letter-spacing: 0.03em;
}

.btn-pause:hover {
  background: var(--bg-panel-hover);
  border-color: var(--brand-glow);
  color: var(--brand-glow);
  box-shadow: 0 0 10px rgba(79, 195, 247, 0.2);
}

/* When paused — button turns amber */
.btn-pause.paused {
  background: rgba(255, 180, 0, 0.1);
  border-color: #ffb400;
  color: #ffb400;
  box-shadow: 0 0 10px rgba(255, 180, 0, 0.2);
}

.btn-pause.paused:hover {
  background: rgba(255, 180, 0, 0.18);
  box-shadow: 0 0 16px rgba(255, 180, 0, 0.35);
}

/* ───────────────────────────────────────────────────────────────
   7.  RESPONSIVE
─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .shell-label {
    padding: 3px 6px;
  }

  .shell-letter {
    font-size: 11px;
  }

  .shell-count {
    font-size: 10px;
  }

  .shell-max {
    display: none;
  }

  .speed-bar {
    padding: var(--space-xs) var(--space-md);
    gap: var(--space-sm);
    height: 40px;
  }

  .speed-label {
    display: none;
  }
}

@media (max-width: 480px) {
  .shell-labels {
    display: none;
  }
}