/* Collision Theory Simulator Specific Styles */

:root {
  --sim-blue: #3b82f6;   /* Reactant A */
  --sim-orange: #f97316; /* Reactant B */
  --sim-green: #22c55e;  /* Product */
  --sim-red: #ef4444;    /* Failed bounce marker */
  --ea-color: #8b5cf6;   /* Activation Energy Purple */
}

/* Layout */
.sim-container {
  max-width: 1200px;
  margin: 0 auto;
}

.back-link {
  display: inline-block;
  color: var(--brand-teal);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}
.back-link:hover {
  opacity: 0.8;
}

.sim-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 992px) {
  .sim-layout {
    flex-direction: row;
    align-items: flex-start;
  }
  .sim-left {
    flex: 6;
  }
  .sim-right {
    flex: 4;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    /* Custom scrollbar to keep it neat */
    padding-right: 10px;
  }
  .sim-right::-webkit-scrollbar { width: 6px; }
  .sim-right::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
}

/* Canvas Area */
.canvas-container {
  position: relative;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  overflow: hidden;
  margin-bottom: 1rem;
  /* Box aspect ratio handled by JS but set min height */
  min-height: 400px;
}

#particleCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sim-legend {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  pointer-events: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.legend-item:last-child { margin-bottom: 0; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-normal { background: var(--sim-red); }
.dot-success { background: var(--sim-green); box-shadow: 0 0 6px var(--sim-green); }
.ea-line-legend {
  width: 16px; 
  height: 2px; 
  background-color: var(--ea-color); 
  border: none; 
  margin: 0;
}

/* Controls */
.controls-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.pb-controls .btn {
  flex: 1;
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn-preset {
  background: white;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.85rem;
  padding: 0.4rem;
  transition: all 0.2s;
}
.btn-preset:hover {
  border-color: var(--brand-teal);
  color: var(--brand-teal);
  background: #f0fdfa;
}

/* Right Panel Tiers */
.tier-switch {
  display: flex;
  background: #e2e8f0;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 1.5rem;
}

.tier-switch input[type="radio"] {
  display: none;
}

.tier-switch label {
  flex: 1;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.tier-switch input[type="radio"]:checked + label {
  background: #ffffff;
  color: var(--brand-teal);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Telemetry Grid */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.metric-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.metric-val {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  font-family: monospace;
}

/* Sliders */
.slider-group {
  margin-bottom: 1rem;
}
.slider-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
  cursor: help; /* indicates tooltip */
}
.slider-val {
  color: var(--brand-teal);
  font-family: monospace;
  font-size: 0.95rem;
}
.slider-val.disabled {
  color: #aaa;
}

input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--brand-teal);
  cursor: pointer;
  margin-top: -6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: #cbd5e1;
  border-radius: 2px;
}
input[type=range]:disabled::-webkit-slider-thumb {
  background: #94a3b8;
}

/* Catalyst Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  margin-right: 10px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider.round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 24px;
}
.slider.round:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}
input:checked + .slider.round {
  background-color: var(--ea-color);
}
input:checked + .slider.round:before {
  transform: translateX(20px);
}

.toggle-group {
  display: flex;
  align-items: center;
}

/* Microtags array */
.microtag {
  position: absolute;
  font-size: 10px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 4px;
  border-radius: 3px;
  pointer-events: none;
  font-family: sans-serif;
  opacity: 1;
  transition: opacity 1s, transform 1s;
}

/* GCSE Quick Tasks */
.quick-tasks-card {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
#task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
}
#task-list li {
  padding: 6px 0;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
}
#task-list li:last-child {
  border-bottom: none;
}
.task-status.complete {
  color: var(--sim-green);
  font-weight: bold;
}
.task-status.complete::after {
  content: " ✓";
}
