/* ═══════════════════════════════════════════════════════════════════
   SimEngine.css — Shared styles for all equation-driven sims
   Theme: matches /school page (white, green #059669, blue #0ea5e9)
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #ffffff;
  --bg2:      #f8fafc;
  --bg3:      #f1f5f9;
  --border:   #e2e8f0;
  --border2:  #cbd5e1;
  --primary:  #059669;
  --pri2:     #047857;
  --pri-light:#d1fae5;
  --blue:     #0ea5e9;
  --blue2:    #0284c7;
  --blue-light:#e0f2fe;
  --amber:    #d97706;
  --amber-light:#fef3c7;
  --rose:     #e11d48;
  --rose-light:#ffe4e6;
  --text:     #0f172a;
  --muted:    #64748b;
  --muted2:   #94a3b8;
  --shadow:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

/* ── Root container ─────────────────────────────────────────── */
.se-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────── */
.se-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: var(--shadow);
  z-index: 10;
}

.se-title-block { flex-shrink: 0; }
.se-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(135deg, #059669, #0ea5e9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.se-subtitle { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* Equation bar — live equations in header */
.se-eq-bar {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 0 8px;
  overflow: hidden;
}
.se-eq-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
}
.se-eq-lhs  { color: var(--pri2); font-weight: 700; }
.se-eq-rhs  { color: var(--muted); }
.se-eq-val  { color: var(--blue2); font-weight: 700; }
.se-eq-val b{ color: var(--primary); }

/* Curriculum tags */
.se-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.se-curr-tags    { display: flex; gap: 5px; }
.se-curr-tag {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
  border: 1.5px solid; letter-spacing: .3px;
}
.se-curr-tag.ib { color: #7c3aed; border-color: #7c3aed; background: #f5f3ff; }
.se-curr-tag.ap { color: var(--pri2); border-color: var(--primary); background: var(--pri-light); }
.se-curr-tag.ig { color: var(--blue2); border-color: var(--blue); background: var(--blue-light); }
.se-curr-tag.cb { color: var(--amber); border-color: var(--amber); background: var(--amber-light); }

/* ── Body — 3 column grid ───────────────────────────────────── */
.se-body {
  display: grid;
  grid-template-columns: 230px 1fr 290px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Workspace (left panel) ─────────────────────────────────── */
.se-workspace {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px 10px;
  gap: 10px;
}

.se-section { display: flex; flex-direction: column; gap: 6px; }
.se-section-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted);
}

/* Variable cards */
.se-var-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
}
.se-var-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.se-var-name  { font-size: 12px; font-weight: 600; color: var(--text); }
.se-var-value {
  font-size: 11px; font-weight: 700;
  color: var(--primary); font-family: 'Courier New', monospace;
  background: var(--pri-light); padding: 1px 6px;
  border-radius: 4px;
}

/* Slider */
.se-slider {
  width: 100%; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px; outline: none; cursor: pointer;
  background: linear-gradient(to right, var(--primary) var(--pct, 50%), var(--border2) var(--pct, 50%));
}
.se-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--primary);
  box-shadow: 0 0 0 3px rgba(5,150,105,0.15); cursor: pointer;
}
.se-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary); border: none; cursor: pointer;
}

/* Controls */
.se-btn-run {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 700; cursor: pointer; border: none;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  color: #fff; transition: opacity .15s; letter-spacing: .3px;
}
.se-btn-run:hover { opacity: .9; }
.se-btn-run.running {
  background: linear-gradient(135deg, #dc2626, #f59e0b);
}

.se-btn-reset {
  width: 100%; padding: 7px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--bg); border: 1.5px solid var(--border2);
  color: var(--muted); transition: all .15s;
}
.se-btn-reset:hover { border-color: var(--primary); color: var(--primary); }

.se-speed-row {
  display: flex; align-items: center; gap: 6px; margin: 2px 0;
}
.se-speed-label { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.se-speed-val   { font-size: 11px; font-weight: 700; color: var(--blue2); min-width: 24px; }

/* Stats */
.se-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 8px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px;
}
.se-stat-key { font-size: 11px; color: var(--muted); font-family: 'Courier New', monospace; }
.se-stat-val {
  font-size: 11px; font-weight: 700;
  color: var(--blue2); font-family: 'Courier New', monospace;
}

/* Divider */
.se-divider { height: 1px; background: var(--border); }

/* ── Canvas area (center) ───────────────────────────────────── */
.se-canvas-area {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border-right: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.se-canvas-area canvas {
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  max-width: 100%;
  max-height: 100%;
}

/* ── Plots panel (right) ────────────────────────────────────── */
.se-plots-panel {
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 10px 8px;
  gap: 8px;
}

.se-plot-wrapper {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  box-shadow: var(--shadow);
}
.se-plot-label {
  font-size: 10px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 5px;
  display: flex; align-items: center;
}
.se-plot-svg { width: 100%; display: block; }

/* ── AI bar (bottom) ────────────────────────────────────────── */
.se-ai-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 -1px 3px rgba(0,0,0,.05);
}
.se-btn-ai {
  flex-shrink: 0; padding: 7px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 700; cursor: pointer; border: none;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff; white-space: nowrap; transition: opacity .15s;
}
.se-btn-ai:hover { opacity: .9; }
.se-ai-resp {
  flex: 1; font-size: 12px; color: var(--muted); line-height: 1.5;
}
.se-ai-resp.loading { color: var(--primary); font-style: italic; }
.se-ai-resp.loaded  { color: var(--text); }
.se-btn-export {
  flex-shrink: 0; padding: 7px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--bg); border: 1.5px solid var(--border2);
  color: var(--muted); transition: all .15s; white-space: nowrap;
}
.se-btn-export:hover { border-color: var(--blue); color: var(--blue2); }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .se-body { grid-template-columns: 200px 1fr; }
  .se-plots-panel { display: none; }
}
