/* ==========================================================================
   OPERATIONAL AMPLIFIER (OP-AMP) VIRTUAL LAB — STYLESHEET
   PrayogSetu Design System (High-Contrast Engineering Lab Glassmorphism)
   ========================================================================== */

:root {
  /* Core Theme Colors */
  --bg-base: #060a12;
  --bg-card: rgba(13, 20, 36, 0.88);
  --bg-card-hover: rgba(18, 28, 50, 0.95);
  --bg-input: #0a1020;
  --border: rgba(255, 255, 255, 0.09);
  --border-focus: #38bdf8;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Text Shades */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-highlight: #38bdf8;

  /* Op-Amp Color System */
  --color-vin: #38bdf8;      /* Input Signal: Cyan */
  --color-vout: #a78bfa;     /* Output Signal: Purple */
  --color-gain: #10b981;     /* Voltage Gain: Emerald */
  --color-vref: #f59e0b;     /* Reference: Amber */
  --color-supply: #f43f5e;   /* Supply Rails: Rose Red */
  --color-sat: #f59e0b;      /* Saturation: Amber */
  --color-linear: #10b981;   /* Linear operation: Emerald */

  /* UI Tokens */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.55);
}

/* Base Reset & Layout */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(56, 189, 248, 0.12), transparent 70%),
    radial-gradient(ellipse 60% 40% at 90% 80%, rgba(167, 139, 250, 0.08), transparent 60%);
  background-attachment: fixed;
}

/* Utility Classes */
.text-cyan { color: #38bdf8 !important; }
.text-emerald { color: #10b981 !important; }
.text-amber { color: #f59e0b !important; }
.text-purple { color: #a78bfa !important; }
.text-rose { color: #f43f5e !important; }
.text-muted { color: #64748b !important; }
.text-highlight { color: #38bdf8; font-weight: 700; }

/* ── Top Navigation Bar ── */
.lab-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 10, 18, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
}

.nav-container {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.back-link:hover {
  background: rgba(56, 189, 248, 0.12);
  color: var(--text-highlight);
  border-color: rgba(56, 189, 248, 0.4);
}

.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.brand-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.badge-lab {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  border-radius: var(--radius-sm);
  letter-spacing: 0.06em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Mode Selector Tabs in Navbar */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.mode-tabs-wrap {
  display: flex;
  background: rgba(10, 16, 32, 0.8);
  border: 1px solid var(--border);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  gap: 0.25rem;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab .tab-icon {
  font-size: 1.05rem;
}

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

.mode-tab.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

/* Nav Action Buttons */
.sim-btn-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-action {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.4);
}

.btn-action:hover {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.6);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-color: var(--border);
}

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

.btn-primary {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
}

.btn-primary:hover {
  background: #0369a1;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.7rem;
}

/* ── Main Workspace Layout ── */
.lab-workspace {
  max-width: 1560px;
  width: 100%;
  margin: 1.25rem auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 1.25rem;
  flex: 1;
}

.left-column, .right-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Panel Cards ── */
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.circuit-header-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.tag-saturation {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
}

.tag-saturation.saturated {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
}

.tag-gain {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.pill {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.pill-live {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

/* ── Circuit Schematic Canvas & SVG ── */
.circuit-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 900 / 520;
  max-height: 520px;
  background: #080d18;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#opamp-particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

#circuit-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  user-select: none;
}

/* SVG Schematic Shapes & Styles */
.circuit-wire {
  stroke-width: 3.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.3s ease;
}

.wire-vin { stroke: #38bdf8; }
.wire-vout { stroke: #a78bfa; }
.wire-feedback { stroke: #10b981; }
.wire-gnd { stroke: #475569; }
.wire-supply-pos { stroke: #f43f5e; }
.wire-supply-neg { stroke: #38bdf8; }

.opamp-body {
  fill: #0c1527;
  stroke: #cbd5e1;
  stroke-width: 3px;
  transition: all 0.3s ease;
}

.opamp-body.saturated {
  stroke: #f59e0b;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.4));
}

.opamp-body.linear {
  stroke: #10b981;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.3));
}

.opamp-sign {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 800;
  fill: #f8fafc;
  text-anchor: middle;
  dominant-baseline: middle;
}

.resistor-zigzag, .resistor-zigzag-vert {
  fill: none;
  stroke-width: 3.5px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.rf-color { stroke: #10b981; }
.rin-color { stroke: #38bdf8; }
.r1-color { stroke: #38bdf8; }

.source-circle {
  fill: #0c1527;
  stroke-width: 2.5px;
}

.source-sign {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 800;
  fill: #f8fafc;
  text-anchor: middle;
  dominant-baseline: middle;
}

.comp-label-box {
  fill: #0c1527;
  stroke-width: 1px;
}

.comp-label-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}

.telemetry-sub-box {
  fill: #0c1220;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1px;
}

.telemetry-sub-text {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  fill: #94a3b8;
}

.branch-arrow-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
}

/* Nodes & GND */
.node-dot-cyan { fill: #38bdf8; stroke: #fff; stroke-width: 1.5px; }
.node-dot-emerald { fill: #10b981; stroke: #fff; stroke-width: 1.5px; }
.node-dot-purple { fill: #a78bfa; stroke: #fff; stroke-width: 1.5px; }
.node-dot-amber { fill: #f59e0b; stroke: #fff; stroke-width: 1.5px; }
.node-dot-rose { fill: #f43f5e; stroke: #fff; stroke-width: 1.5px; }

.gnd-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  fill: #64748b;
}

/* ── Circuit Status Footer Strip ── */
.circuit-footer-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border);
}

.footer-metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Oscilloscope Waveform Canvas ── */
.scope-controls-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.scope-wave-type {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.scope-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.scope-container {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.scope-canvas-wrap {
  width: 100%;
  background: #080d18;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  display: flex;
  justify-content: center;
}

#scope-canvas {
  width: 100%;
  max-height: 230px;
  display: block;
}

.scope-legend {
  display: flex;
  justify-content: space-around;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

.line-vin { background: #38bdf8; box-shadow: 0 0 6px #38bdf8; }
.line-vout { background: #a78bfa; box-shadow: 0 0 6px #a78bfa; }
.line-rails { background: #f43f5e; border-top: 1px dashed #f43f5e; height: 1px; }

/* ── Mathematical Solver Steps ── */
.solver-body {
  padding: 1.1rem;
}

.calc-steps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.calc-step-card {
  background: rgba(10, 16, 32, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.calc-step-card.highlight {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.04);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-highlight);
  letter-spacing: 0.08em;
}

.step-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.step-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.math-display-box {
  margin-top: 0.35rem;
  padding: 0.55rem 0.75rem;
  background: #060a12;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.math-val-blue { color: #38bdf8; font-weight: 700; }
.math-val-green { color: #10b981; font-weight: 700; }
.math-val-amber { color: #f59e0b; font-weight: 700; }
.math-val-purple { color: #a78bfa; font-weight: 700; }
.math-val-white { color: #ffffff; font-weight: 700; }

/* ── RIGHT COLUMN: Telemetry Hero & Controls ── */
.telemetry-card {
  display: flex;
  flex-direction: column;
}

/* Operating Status Hero Banner */
.hero-status-banner {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.3s ease;
}

.hero-status-banner.linear-mode {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.5), rgba(13, 20, 36, 0.8));
  border-left: 4px solid #10b981;
}

.hero-status-banner.saturated-mode {
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.5), rgba(13, 20, 36, 0.8));
  border-left: 4px solid #f59e0b;
}

.hero-status-banner.comparator-high {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.5), rgba(13, 20, 36, 0.8));
  border-left: 4px solid #38bdf8;
}

.hero-status-banner.comparator-low {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.5), rgba(13, 20, 36, 0.8));
  border-left: 4px solid #64748b;
}

.status-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.06em;
}

.linear-mode .status-badge { background: rgba(16, 185, 129, 0.25); color: #34d399; border: 1px solid #10b981; }
.saturated-mode .status-badge { background: rgba(245, 158, 11, 0.25); color: #fbbf24; border: 1px solid #f59e0b; }
.comparator-high .status-badge { background: rgba(56, 189, 248, 0.25); color: #38bdf8; border: 1px solid #38bdf8; }
.comparator-low .status-badge { background: rgba(100, 116, 139, 0.25); color: #cbd5e1; border: 1px solid #64748b; }

.status-mode-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.status-desc-text {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Quad Meters Grid */
.meters-quad-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  padding: 1.1rem;
}

.mini-meter-tile {
  background: rgba(10, 16, 32, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mini-meter-tile.highlight-meter {
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.04);
}

.mini-meter-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.mini-meter-value {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.mini-meter-sub {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

/* ── Circuit Controls Panel ── */
.controls-body {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.control-row-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.control-row-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

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

.control-label-row label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

.label-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-sm);
}

.vin-badge { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.4); }
.vref-badge { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.4); }
.rf-badge { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.4); }
.rin-badge { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.4); }
.vcc-badge { background: rgba(244, 63, 94, 0.15); color: #f43f5e; border: 1px solid rgba(244, 63, 94, 0.4); }

.label-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.direct-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.2rem 0.5rem;
  transition: all 0.2s ease;
}

.direct-input-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.numeric-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  width: 65px;
  text-align: right;
  outline: none;
}

.input-unit {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 0.3rem;
}

/* Sliders */
.slider-wrapper {
  width: 100%;
}

.styled-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #1e293b;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.styled-slider.slider-vref::-webkit-slider-thumb { border-color: #f59e0b; box-shadow: 0 0 10px rgba(245, 158, 11, 0.6); }
.styled-slider.slider-rf::-webkit-slider-thumb { border-color: #10b981; box-shadow: 0 0 10px rgba(16, 185, 129, 0.6); }
.styled-slider.slider-vcc::-webkit-slider-thumb { border-color: #f43f5e; box-shadow: 0 0 10px rgba(244, 63, 94, 0.6); }

.styled-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Quick Chips */
.quick-chips-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-btn:hover {
  background: rgba(56, 189, 248, 0.1);
  color: var(--text-primary);
  border-color: rgba(56, 189, 248, 0.4);
}

.chip-btn.active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

/* ── Student Experiment & Prediction Card ── */
.exp-body {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.task-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  display: flex;
  gap: 0.5rem;
}

.task-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  color: #f59e0b;
}

.task-text {
  font-size: 0.78rem;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.4;
}

.prediction-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.prediction-input-row label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pred-input-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pred-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.3rem 0.6rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  width: 90px;
  outline: none;
}

.pred-input:focus {
  border-color: var(--border-focus);
}

.pred-result-card {
  background: #080d18;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.result-msg {
  font-size: 0.74rem;
  font-weight: 700;
  color: #10b981;
}

/* ── Observation Table ── */
.table-card {
  display: flex;
  flex-direction: column;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

.table-scroll-wrap {
  max-height: 220px;
  overflow-y: auto;
}

.lab-obs-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-align: center;
}

.lab-obs-table th {
  position: sticky;
  top: 0;
  background: #0b1222;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border);
}

.lab-obs-table td {
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.lab-obs-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.empty-table-row td {
  padding: 1.5rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Academic Theory Section ── */
.lab-theory-section {
  max-width: 1560px;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

.theory-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.theory-section-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theory-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.theory-module {
  background: rgba(10, 16, 32, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.theory-header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.theory-num {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-highlight);
  letter-spacing: 0.08em;
}

.theory-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.theory-text {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.theory-list {
  font-size: 0.74rem;
  color: var(--text-secondary);
  padding-left: 1.1rem;
  line-height: 1.5;
}

.theory-list li {
  margin-bottom: 0.35rem;
}

.theory-equation {
  background: #060a12;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #38bdf8;
  text-align: center;
  font-weight: 700;
}

/* ── Footer ── */
.lab-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: rgba(6, 10, 18, 0.95);
  padding: 1.1rem 1.5rem;
}

.footer-container {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.footer-logo {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.footer-copy {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.tag-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
  border-radius: var(--radius-sm);
}

/* ── Responsive Media Queries ── */
@media (max-width: 1200px) {
  .lab-workspace {
    grid-template-columns: 1fr;
  }
  .theory-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .circuit-footer-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .calc-steps-grid {
    grid-template-columns: 1fr;
  }
  .meters-quad-grid {
    grid-template-columns: 1fr;
  }
  .theory-cards-grid {
    grid-template-columns: 1fr;
  }
  .mode-tabs-wrap {
    flex-wrap: wrap;
  }
}

/* ─────────────────────────────────────────────────────────────
   LIGHT THEME COMPREHENSIVE OVERRIDES
   ───────────────────────────────────────────────────────────── */
[data-theme="light"],
html[data-theme="light"],
html:not(.dark):not([data-theme="dark"]) {
  --bg-base: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --border: #e2e8f0;
  --border-focus: #0284c7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-highlight: #0284c7;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] body,
html[data-theme="light"] body {
  background-color: #f8fafc !important;
  background-image: none !important;
  color: #0f172a !important;
}

/* Navbar & Brand */
[data-theme="light"] .lab-navbar,
html[data-theme="light"] .lab-navbar {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .back-link,
html[data-theme="light"] .back-link {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

[data-theme="light"] .back-link:hover,
html[data-theme="light"] .back-link:hover {
  background: #e0f2fe !important;
  color: #0284c7 !important;
  border-color: #38bdf8 !important;
}

[data-theme="light"] .brand-title,
html[data-theme="light"] .brand-title {
  color: #0f172a !important;
}

[data-theme="light"] .mode-tabs-wrap,
html[data-theme="light"] .mode-tabs-wrap {
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .mode-tab,
html[data-theme="light"] .mode-tab {
  color: #475569 !important;
}

[data-theme="light"] .mode-tab:hover,
html[data-theme="light"] .mode-tab:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] .mode-tab.active,
html[data-theme="light"] .mode-tab.active {
  background: #ffffff !important;
  color: #0284c7 !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .btn-outline,
html[data-theme="light"] .btn-outline {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

[data-theme="light"] .btn-outline:hover,
html[data-theme="light"] .btn-outline:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

/* Panel Cards */
[data-theme="light"] .panel-card,
html[data-theme="light"] .panel-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .panel-header,
html[data-theme="light"] .panel-header {
  background: #f8fafc !important;
  border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .panel-title,
html[data-theme="light"] .panel-title {
  color: #0f172a !important;
}

/* Schematic Canvas & SVG Elements */
[data-theme="light"] .circuit-wrapper,
html[data-theme="light"] .circuit-wrapper {
  background: #f8fafc !important;
}

[data-theme="light"] .opamp-body,
html[data-theme="light"] .opamp-body {
  fill: #ffffff !important;
  stroke: #475569 !important;
}

[data-theme="light"] .opamp-body.saturated,
html[data-theme="light"] .opamp-body.saturated {
  stroke: #d97706 !important;
  filter: drop-shadow(0 0 6px rgba(217, 119, 6, 0.25)) !important;
}

[data-theme="light"] .opamp-body.linear,
html[data-theme="light"] .opamp-body.linear {
  stroke: #059669 !important;
  filter: drop-shadow(0 0 6px rgba(5, 150, 105, 0.25)) !important;
}

[data-theme="light"] .opamp-sign,
html[data-theme="light"] .opamp-sign {
  fill: #0f172a !important;
}

[data-theme="light"] .source-circle,
html[data-theme="light"] .source-circle {
  fill: #ffffff !important;
  stroke: #0284c7 !important;
}

[data-theme="light"] .source-sign,
html[data-theme="light"] .source-sign {
  fill: #0284c7 !important;
}

[data-theme="light"] .comp-label-box,
html[data-theme="light"] .comp-label-box {
  fill: #ffffff !important;
  stroke: #cbd5e1 !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.05)) !important;
}

[data-theme="light"] .comp-label-text,
html[data-theme="light"] .comp-label-text {
  fill: #0f172a !important;
}

[data-theme="light"] .telemetry-sub-box,
html[data-theme="light"] .telemetry-sub-box {
  fill: #f1f5f9 !important;
  stroke: #cbd5e1 !important;
}

[data-theme="light"] .telemetry-sub-text,
html[data-theme="light"] .telemetry-sub-text {
  fill: #475569 !important;
}

[data-theme="light"] .circuit-footer-strip,
html[data-theme="light"] .circuit-footer-strip {
  background: #f8fafc !important;
  border-top-color: #e2e8f0 !important;
}

[data-theme="light"] .metric-label,
html[data-theme="light"] .metric-label {
  color: #64748b !important;
}

[data-theme="light"] .metric-val,
html[data-theme="light"] .metric-val {
  color: #0f172a !important;
}

/* Oscilloscope */
[data-theme="light"] .scope-select,
html[data-theme="light"] .scope-select {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .scope-canvas-wrap,
html[data-theme="light"] .scope-canvas-wrap {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .scope-legend,
html[data-theme="light"] .scope-legend {
  border-top-color: #e2e8f0 !important;
  color: #475569 !important;
}

/* Calculation Steps */
[data-theme="light"] .calc-step-card,
html[data-theme="light"] .calc-step-card {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .calc-step-card.highlight,
html[data-theme="light"] .calc-step-card.highlight {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
}

[data-theme="light"] .step-title,
html[data-theme="light"] .step-title {
  color: #0f172a !important;
}

[data-theme="light"] .step-desc,
html[data-theme="light"] .step-desc {
  color: #475569 !important;
}

[data-theme="light"] .math-display-box,
html[data-theme="light"] .math-display-box {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

[data-theme="light"] .math-val-white,
html[data-theme="light"] .math-val-white {
  color: #0f172a !important;
}

/* Telemetry Hero & Operating Status */
[data-theme="light"] .hero-status-banner.linear-mode,
html[data-theme="light"] .hero-status-banner.linear-mode {
  background: linear-gradient(135deg, #ecfdf5 0%, #f8fafc 100%) !important;
  border-left: 4px solid #10b981 !important;
  border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .hero-status-banner.saturated-mode,
html[data-theme="light"] .hero-status-banner.saturated-mode {
  background: linear-gradient(135deg, #fffbeb 0%, #f8fafc 100%) !important;
  border-left: 4px solid #f59e0b !important;
  border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .hero-status-banner.comparator-high,
html[data-theme="light"] .hero-status-banner.comparator-high {
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%) !important;
  border-left: 4px solid #0284c7 !important;
  border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .hero-status-banner.comparator-low,
html[data-theme="light"] .hero-status-banner.comparator-low {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
  border-left: 4px solid #64748b !important;
  border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .status-mode-name,
html[data-theme="light"] .status-mode-name {
  color: #0f172a !important;
}

[data-theme="light"] .status-desc-text,
html[data-theme="light"] .status-desc-text {
  color: #475569 !important;
}

/* Quad Meters */
[data-theme="light"] .mini-meter-tile,
html[data-theme="light"] .mini-meter-tile {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .mini-meter-tile.highlight-meter,
html[data-theme="light"] .mini-meter-tile.highlight-meter {
  background: #f5f3ff !important;
  border-color: #ddd6fe !important;
}

[data-theme="light"] .mini-meter-label,
html[data-theme="light"] .mini-meter-label {
  color: #64748b !important;
}

[data-theme="light"] .mini-meter-value,
html[data-theme="light"] .mini-meter-value {
  color: #0f172a !important;
}

[data-theme="light"] .mini-meter-sub,
html[data-theme="light"] .mini-meter-sub {
  color: #475569 !important;
}

/* Circuit Controls */
[data-theme="light"] .control-row-group,
html[data-theme="light"] .control-row-group {
  border-bottom-color: #f1f5f9 !important;
}

[data-theme="light"] .label-title,
html[data-theme="light"] .label-title {
  color: #0f172a !important;
}

[data-theme="light"] .direct-input-wrap,
html[data-theme="light"] .direct-input-wrap {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .direct-input-wrap:focus-within,
html[data-theme="light"] .direct-input-wrap:focus-within {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2) !important;
}

[data-theme="light"] .numeric-input,
html[data-theme="light"] .numeric-input {
  color: #0f172a !important;
}

[data-theme="light"] .input-unit,
html[data-theme="light"] .input-unit {
  color: #64748b !important;
}

[data-theme="light"] .styled-slider,
html[data-theme="light"] .styled-slider {
  background: #e2e8f0 !important;
}

[data-theme="light"] .chip-btn,
html[data-theme="light"] .chip-btn {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

[data-theme="light"] .chip-btn:hover,
html[data-theme="light"] .chip-btn:hover {
  background: #e0f2fe !important;
  color: #0284c7 !important;
  border-color: #38bdf8 !important;
}

[data-theme="light"] .chip-btn.active,
html[data-theme="light"] .chip-btn.active {
  background: #e0f2fe !important;
  color: #0284c7 !important;
  border-color: #0284c7 !important;
}

/* Prediction & Observation Table */
[data-theme="light"] .task-box,
html[data-theme="light"] .task-box {
  background: #fffbeb !important;
  border-color: #fde68a !important;
}

[data-theme="light"] .task-text,
html[data-theme="light"] .task-text {
  color: #92400e !important;
}

[data-theme="light"] .prediction-input-row label,
html[data-theme="light"] .prediction-input-row label {
  color: #334155 !important;
}

[data-theme="light"] .pred-input,
html[data-theme="light"] .pred-input {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .pred-result-card,
html[data-theme="light"] .pred-result-card {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .result-row,
html[data-theme="light"] .result-row {
  color: #475569 !important;
}

[data-theme="light"] .lab-obs-table th,
html[data-theme="light"] .lab-obs-table th {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-bottom-color: #cbd5e1 !important;
}

[data-theme="light"] .lab-obs-table td,
html[data-theme="light"] .lab-obs-table td {
  border-bottom-color: #f1f5f9 !important;
  color: #1e293b !important;
}

[data-theme="light"] .lab-obs-table tr:hover td,
html[data-theme="light"] .lab-obs-table tr:hover td {
  background: #f8fafc !important;
}

/* Theory Section & Footer */
[data-theme="light"] .theory-container,
html[data-theme="light"] .theory-container {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .theory-section-title,
html[data-theme="light"] .theory-section-title {
  color: #0f172a !important;
}

[data-theme="light"] .theory-module,
html[data-theme="light"] .theory-module {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .theory-title,
html[data-theme="light"] .theory-title {
  color: #0f172a !important;
}

[data-theme="light"] .theory-text,
html[data-theme="light"] .theory-text {
  color: #475569 !important;
}

[data-theme="light"] .theory-list,
html[data-theme="light"] .theory-list {
  color: #475569 !important;
}

[data-theme="light"] .theory-equation,
html[data-theme="light"] .theory-equation {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0284c7 !important;
}

[data-theme="light"] .lab-footer,
html[data-theme="light"] .lab-footer,
html:not(.dark):not([data-theme="dark"]) .lab-footer {
  background: #f8fafc !important;
  border-top-color: #e2e8f0 !important;
}

[data-theme="light"] .footer-logo,
html[data-theme="light"] .footer-logo {
  color: #0f172a !important;
}

[data-theme="light"] .footer-copy,
html[data-theme="light"] .footer-copy {
  color: #64748b !important;
}

