/* ===== SIMULATION PAGE STYLES ===== */

.sim-page {
  display: flex;
  min-height: 100vh;
  padding-top: 64px;
}

/* Sidebar */
.sim-sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  width: 280px;
  flex-shrink: 0;
  padding: 1.5rem 1.25rem;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sim-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.sim-sidebar-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.sidebar-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(16,185,129,0.12);
  color: var(--accent-green);
  border: 1px solid rgba(16,185,129,0.2);
}

.sidebar-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse 2s ease infinite;
}

/* Control Groups */
.control-group {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.control-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Type Toggle */
.type-toggle {
  display: flex;
  gap: 0.5rem;
}

.type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: var(--font-body);
}

.type-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.type-btn.active.lpf-active {
  background: rgba(6,182,212,0.12);
  border-color: rgba(6,182,212,0.35);
  color: var(--lpf-color);
}

.type-btn.active.hpf-active {
  background: rgba(139,92,246,0.12);
  border-color: rgba(139,92,246,0.35);
  color: var(--hpf-color);
}

.type-dot { width: 8px; height: 8px; border-radius: 50%; }
.type-dot.lpf { background: var(--lpf-color); }
.type-dot.hpf { background: var(--hpf-color); }

/* Slider Row */
.slider-row {
  margin-bottom: 0.5rem;
}

.slider-info {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.slider-info-val {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.slider-info-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Frequency Visualizer */
.freq-viz {
  position: relative;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: visible;
  margin-top: 0.5rem;
}

.freq-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.2s ease;
}

.lpf-active-bar .freq-bar { background: linear-gradient(to right, rgba(6,182,212,0.6), rgba(6,182,212,0.2)); }
.hpf-active-bar .freq-bar { background: linear-gradient(to right, rgba(139,92,246,0.2), rgba(139,92,246,0.6)); }

.freq-cutoff {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--accent-orange);
  border-radius: 1px;
  transform: translateX(-50%);
  transition: left 0.2s ease;
}

/* Stats Panel */
.stats-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1rem 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child { border-bottom: none; }

.stat-val {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.reset-btn {
  width: 100%;
  margin-top: 0.5rem;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.reset-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: none;
  box-shadow: none;
}

/* Sim Main */
.sim-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem;
  overflow-y: auto;
}

/* Tabs */
.sim-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.375rem;
  margin-bottom: 1.5rem;
  max-width: 600px;
}

.sim-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: var(--font-body);
  white-space: nowrap;
}

.sim-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.sim-tab.active {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #fff;
  box-shadow: 0 4px 12px rgba(59,130,246,0.4);
}

/* Panel */
.sim-panel { display: block; }
.sim-panel.hidden { display: none; }

.panel-header {
  margin-bottom: 1.5rem;
}

.panel-header h2 {
  font-size: 1.375rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.panel-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color var(--transition-base);
}

.chart-card:hover { border-color: rgba(59,130,246,0.2); }

.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(59,130,246,0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(59,130,246,0.2);
  font-family: var(--font-mono);
}

.grey-badge {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-color: var(--border-color);
}


.chart-wrap {
  height: 180px;
  position: relative;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.tall-wrap { height: 260px; }

.wide-card { grid-column: span 2; }

/* Legend */
.legend-row {
  display: flex;
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 3px;
  border-radius: 1px;
}

.legend-dot.grey { background: var(--text-muted); opacity: 0.5; }

.legend-dot.colored { background: var(--accent-cyan); }

/* 3D Container */
.three-container {
  position: relative;
  width: 100%;
  height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
}

.three-overlay {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
}

.three-hint {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  backdrop-filter: blur(8px);
}

.three-info {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 5;
}

.three-legend {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}


.tl-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.775rem;
  color: var(--text-secondary);
}

.tl-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.three-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Mobile menu open state */
.nav-links.open {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem;
  gap: 0.25rem;
  z-index: 999;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .sim-sidebar { width: 240px; }
  .charts-grid { grid-template-columns: 1fr; }
  .wide-card { grid-column: span 1; }
}

@media (max-width: 768px) {
  .sim-page { flex-direction: column; }
  .sim-sidebar {
    position: relative;
    top: 0;
    height: auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .sim-main { padding: 1rem; }
  .sim-tabs { flex-direction: column; max-width: 100%; }
  .three-container { height: 360px; }
}
