/* ============================================================
   QUANTUM CODEX — Simulation Lab & Quantum Chart Styles
   ============================================================ */

/* ──────────────────────────────────────────
   LAB PAGE LAYOUT
   ────────────────────────────────────────── */
.lab-page {
  min-height: 100vh;
  background: var(--bg-void);
  padding-top: var(--nav-height);
}

.lab-header {
  padding: 40px var(--section-pad-x) 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-deep);
}

.lab-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

.lab-breadcrumb a { color: var(--accent-cyan); transition: opacity 0.2s; }
.lab-breadcrumb a:hover { opacity: 0.7; }
.lab-breadcrumb span { color: var(--text-muted); }

.lab-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.lab-title {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.lab-subtitle {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  max-width: 620px;
  line-height: 1.65;
}

.lab-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.lab-meta-chip {
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip-quantum {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.chip-interactive {
  background: rgba(0, 255, 157, 0.08);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 157, 0.15);
}

/* ──────────────────────────────────────────
   LAB BODY (canvas/chart + controls side by side)
   ────────────────────────────────────────── */
.lab-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  min-height: calc(100vh - var(--nav-height) - 200px);
}

.lab-canvas-area {
  position: relative;
  background: #04060d;
  border-right: 1px solid var(--border-subtle);
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-container {
  width: 100%;
  height: 100%;
  min-height: 560px;
  position: relative;
}

#sim-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-corner-label {
  position: absolute;
  top: 16px; left: 20px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  color: rgba(0, 212, 255, 0.4);
  text-transform: uppercase;
  pointer-events: none;
}

.canvas-fps {
  position: absolute;
  top: 16px; right: 20px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: rgba(0, 212, 255, 0.3);
  pointer-events: none;
}

/* ──────────────────────────────────────────
   CONTROL PANEL
   ────────────────────────────────────────── */
.control-panel {
  background: var(--bg-deep);
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cp-section-title {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cp-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--dur-fast) ease;
}

.control-item:focus-within { border-color: var(--border-accent); }

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.control-label {
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.control-value {
  font-size: 0.825rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-card);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
  cursor: pointer;
  transition: transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.7);
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.toggle-label {
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.toggle {
  position: relative;
  width: 40px; height: 22px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-card);
  border-radius: 100px;
  cursor: pointer;
  transition: background var(--dur-fast) ease;
  border: 1px solid var(--border-soft);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--dur-base) var(--ease-spring),
              background var(--dur-fast) ease;
}

.toggle input:checked + .toggle-track {
  background: rgba(0, 212, 255, 0.15);
  border-color: rgba(0, 212, 255, 0.3);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}

/* ──────────────────────────────────────────
   STANDARDIZED CONTROL BAR (Play, Pause, Reset, Speed, Step, Fullscreen)
   ────────────────────────────────────────── */
.std-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-ctrl {
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
  transition: all var(--dur-fast) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-ctrl:hover {
  border-color: var(--border-accent);
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.08);
}

.btn-ctrl.active {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.btn-ctrl--full {
  grid-column: span 2;
}

/* Mode Switcher Pills */
.mode-switcher {
  display: flex;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.mode-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  transition: all var(--dur-fast) ease;
}

.mode-btn:hover { color: var(--text-secondary); }

.mode-btn.active {
  background: var(--bg-card);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 212, 255, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Advanced Settings Accordion */
.advanced-settings {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.advanced-settings summary {
  padding: 12px 16px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.advanced-settings summary::-webkit-details-marker { display: none; }

.advanced-settings summary::after {
  content: '▼';
  font-size: 0.65rem;
  transition: transform var(--dur-fast) ease;
}

.advanced-settings[open] summary::after {
  transform: rotate(180deg);
}

.advanced-settings-content {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ──────────────────────────────────────────
   THEORY PLACEHOLDER SECTION
   ────────────────────────────────────────── */
.lab-explainer {
  padding: 56px var(--section-pad-x);
  background: var(--bg-deep);
  border-top: 1px solid var(--border-subtle);
}

.theory-placeholder-card {
  margin-top: 24px;
  padding: 48px 36px;
  background: var(--bg-card);
  border: 1px dashed rgba(0, 212, 255, 0.25);
  border-radius: var(--radius-lg);
  text-align: center;
  max-width: 680px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.placeholder-icon {
  font-size: 2.2rem;
  margin-bottom: 16px;
  display: inline-block;
  filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.4));
}

.placeholder-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-cyan);
  font-family: var(--font-sans);
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.placeholder-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  font-family: var(--font-sans);
}

/* Quick Actions & Preset Buttons */
.cp-reset-btn {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-smooth);
  width: 100%;
}

.cp-reset-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.preset-btn {
  font-family: var(--font-mono) !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  padding: 10px !important;
  background: rgba(0, 212, 255, 0.05) !important;
  border: 1px solid rgba(0, 212, 255, 0.2) !important;
  color: var(--text-secondary) !important;
}

.preset-btn:hover {
  background: rgba(0, 212, 255, 0.15) !important;
  border-color: var(--accent-cyan) !important;
  color: var(--accent-cyan) !important;
  box-shadow: var(--glow-cyan) !important;
}

/* Fullscreen Canvas */
.lab-canvas-area:fullscreen {
  background: #04060d;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lab-canvas-area:fullscreen #sim-canvas,
.lab-canvas-area:fullscreen .chart-container {
  width: 100vw !important;
  height: 100vh !important;
}

/* Responsive */
@media (max-width: 1024px) {
  .lab-body { grid-template-columns: 1fr; }
  .lab-canvas-area, .chart-container { min-height: 440px; border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .control-panel { flex-direction: row; flex-wrap: wrap; }
  .control-group { flex: 1; min-width: 240px; }
}

@media (max-width: 640px) {
  .lab-header { padding: 32px 20px 24px; }
  .control-panel { padding: 20px 16px; }
  .lab-canvas-area, .chart-container { min-height: 340px; }
}
