/* Brand New Interactive AI Playgrounds CSS */

:root {
  --sim-primary: #8b5cf6;
  --sim-secondary: #ec4899;
  --sim-accent: #10b981;
  --sim-bg: rgba(20, 20, 30, 0.6);
  --sim-border: rgba(255, 255, 255, 0.1);
  --sim-text: #f3f4f6;
  --sim-text-muted: #9ca3af;
}

.simulator-container {
  background: var(--sim-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--sim-border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  color: var(--sim-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.simulator-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.15);
}

.simulator-header {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #a78bfa, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.simulator-desc {
  font-size: 0.95rem;
  color: var(--sim-text-muted);
  margin-bottom: 1.5rem;
}

/* Common Controls */
.sim-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.sim-label {
  font-weight: 500;
  font-size: 0.9rem;
}

.sim-val {
  font-family: monospace;
  background: rgba(255,255,255,0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.sim-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.2);
  outline: none;
}
.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--sim-primary);
  cursor: pointer;
  box-shadow: 0 0 10px var(--sim-primary);
}

.sim-select, .sim-input {
  width: 100%;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
}
.sim-select:focus, .sim-input:focus {
  border-color: var(--sim-primary);
}

.sim-btn {
  background: linear-gradient(135deg, var(--sim-primary), var(--sim-secondary));
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  width: 100%;
}
.sim-btn:hover {
  opacity: 0.9;
}
.sim-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* NN Visualizer */
.nn-canvas {
  width: 100%;
  height: 250px;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
}
.nn-svg {
  width: 100%;
  height: 100%;
}
.nn-node {
  fill: rgba(255,255,255,0.1);
  stroke: var(--sim-primary);
  stroke-width: 2;
  transition: all 0.3s ease;
}
.nn-node.active {
  box-shadow: 0 0 20px var(--sim-primary);
}
.nn-text {
  fill: #fff;
  font-family: monospace;
  font-size: 14px;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}
.nn-link {
  stroke: rgba(255,255,255,0.2);
  stroke-width: 3;
  transition: stroke 0.3s;
}
.pulse-circle {
  fill: #fff;
  opacity: 0.8;
}

/* LLM Studio */
.llm-output-box {
  background: rgba(0,0,0,0.4);
  border-left: 4px solid var(--sim-secondary);
  border-radius: 8px;
  padding: 1.25rem;
  min-height: 120px;
  font-family: monospace;
  font-size: 1.05rem;
  line-height: 1.5;
  margin-top: 1rem;
  position: relative;
  white-space: pre-wrap;
}
.llm-cursor {
  display: inline-block;
  width: 8px;
  height: 18px;
  background: var(--sim-secondary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.thinking-dots::after {
  content: '.';
  animation: dots 1.5s steps(5, end) infinite;
}
@keyframes dots { 0%, 20% { content: '.'; } 40% { content: '..'; } 60% { content: '...'; } 80%, 100% { content: ''; } }

/* KNN Explorer */
.knn-canvas-wrap {
  width: 100%;
  height: 300px;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
  cursor: crosshair;
}
.knn-point {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  pointer-events: none;
}
.knn-point.class-a { background: #ef4444; }
.knn-point.class-b { background: #3b82f6; }
.knn-point.target { 
  width: 16px; 
  height: 16px; 
  background: #fff; 
  border: 2px solid #000;
  z-index: 10;
}
.knn-line {
  position: absolute;
  height: 2px;
  background: rgba(255,255,255,0.4);
  transform-origin: 0 50%;
  pointer-events: none;
  z-index: 5;
}

/* Toggle Group */
.toggle-group {
  display: flex;
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  overflow: hidden;
}
.toggle-btn {
  flex: 1;
  background: transparent;
  color: var(--sim-text-muted);
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}
.toggle-btn.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* Phase 2 Simulators CSS */

/* K-Means */
.kmeans-canvas {
  width: 100%;
  height: 300px;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
}
.km-point {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #6b7280;
  transition: background-color 0.4s ease;
}
.km-centroid {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 4px;
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 10px rgba(0,0,0,0.8);
  transition: left 0.6s ease, top 0.6s ease;
  z-index: 10;
}

/* CNN Filter */
.cnn-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: 200px;
  margin: 0 auto;
}
.cnn-pixel {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-family: monospace;
  transition: all 0.2s;
  cursor: crosshair;
}
.cnn-pixel.highlight {
  border: 2px solid var(--sim-primary);
  transform: scale(1.1);
  z-index: 5;
}
.cnn-math-box {
  background: rgba(0,0,0,0.4);
  padding: 1rem;
  border-radius: 8px;
  font-family: monospace;
  margin-top: 1rem;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Decision Tree */
.dt-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.dt-node {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 1rem;
  width: 100%;
  min-height: 100px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-content: flex-start;
  transition: all 0.4s;
}
.dt-item {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}
.dt-item.apple { background: #ef4444; }
.dt-item.orange { background: #f97316; }
.dt-split-row {
  display: flex;
  width: 100%;
  gap: 1rem;
}
.dt-branch {
  flex: 1;
  text-align: center;
}
.dt-branch-label {
  font-size: 0.9rem;
  color: var(--sim-text-muted);
  margin-bottom: 0.5rem;
}
