/* ============================================================
   UNI-T Authentic Digital Storage Oscilloscope (DSO) Styling
   Model Reference: UNI-T UTD2102CEX+ / UPO2000 Series
   ============================================================ */

#oscilloscope-modal {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 940px;
  height: 600px;
  background: #1b2028;
  border: 3px solid #2d3846;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.1);
  z-index: 5000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  font-family: var(--font-ui);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#oscilloscope-modal.minimized {
  height: 40px;
  overflow: hidden;
  transform: translateX(-50%) translateY(520px);
}

#oscilloscope-modal.closed {
  display: none;
}

/* DSO Outer Casing Bezel Header */
.dso-casing-header {
  height: 38px;
  background: linear-gradient(180deg, #323b49 0%, #222934 100%);
  border-bottom: 2px solid #141920;
  display: flex;
  align-items: center;
  padding: 0 16px;
  cursor: move;
  gap: 16px;
}

.dso-brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dso-brand-logo {
  background: #d32f2f;
  color: #ffffff;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 1.5px;
  padding: 2px 8px;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.dso-model-name {
  font-size: 12px;
  font-weight: 700;
  color: #cfd8dc;
  letter-spacing: 1px;
}
.dso-sub-spec {
  font-size: 10px;
  color: #78909c;
  font-family: var(--font-mono);
}

.dso-window-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.dso-win-btn {
  background: #2a3340;
  border: 1px solid #3e4a5d;
  color: #b0bec5;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s;
}
.dso-win-btn:hover {
  background: #37474f;
  color: #ffffff;
}
.dso-win-btn.close:hover {
  background: #c62828;
}

/* DSO Main Body (Split into LCD Screen + Physical Front Panel Controls) */
.dso-main-body {
  flex: 1;
  display: flex;
  background: #181d24;
  padding: 12px;
  gap: 12px;
  overflow: hidden;
}

/* ------------------------------------------------------------
   UNI-T LCD Display Screen
   ------------------------------------------------------------ */
.dso-screen-chassis {
  flex: 1;
  background: #000408;
  border: 4px solid #10151c;
  border-radius: 8px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9), 0 2px 6px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Top LCD Info Strip */
.dso-screen-topbar {
  height: 26px;
  background: rgba(10, 16, 24, 0.95);
  border-bottom: 1px solid #1a2330;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  gap: 14px;
  z-index: 10;
}

.dso-status-badge {
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.5px;
}
.dso-status-badge.trig {
  background: #2e7d32;
  color: #a5d6a7;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.4);
}
.dso-status-badge.auto {
  background: #1565c0;
  color: #90caf9;
}
.dso-status-badge.stop {
  background: #c62828;
  color: #ffcdd2;
  box-shadow: 0 0 6px rgba(244, 67, 54, 0.4);
}

.dso-channel-readout {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}
.dso-channel-readout.ch1 { color: #ffe600; }
.dso-channel-readout.ch2 { color: #00f0ff; }
.dso-channel-readout.math { color: #ff00ea; }

.dso-tb-readout {
  color: #eceff1;
  font-weight: 600;
  margin-left: auto;
}
.dso-trig-readout {
  color: #ff9800;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Central Oscilloscope Waveform Canvas */
.dso-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#dso-waveform-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Graticule Zero-Level Ground Pointers on screen edge */
.dso-pointer-arrow {
  position: absolute;
  font-size: 11px;
  font-weight: 900;
  pointer-events: none;
  z-index: 5;
  transition: top 0.05s linear;
}
.dso-pointer-ch1 {
  left: 2px;
  color: #ffe600;
  text-shadow: 0 0 4px #ffe600;
}
.dso-pointer-ch2 {
  left: 2px;
  color: #00f0ff;
  text-shadow: 0 0 4px #00f0ff;
}
.dso-pointer-trig {
  right: 2px;
  color: #ff9800;
  text-shadow: 0 0 4px #ff9800;
}

/* Bottom LCD Measurement Strip */
.dso-screen-bottom-measure {
  height: 38px;
  background: rgba(6, 12, 18, 0.95);
  border-top: 1px solid #1a2330;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  z-index: 10;
}

.dso-measure-cell {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  padding: 2px 6px;
  display: flex;
  flex-direction: column;
  min-width: 82px;
}
.dso-measure-param {
  font-size: 8px;
  color: #90a4ae;
  text-transform: uppercase;
}
.dso-measure-value {
  font-size: 11px;
  font-weight: 700;
}
.dso-measure-cell.ch1 .dso-measure-value { color: #ffe600; }
.dso-measure-cell.ch2 .dso-measure-value { color: #00f0ff; }
.dso-measure-cell.math .dso-measure-value { color: #ff00ea; }

/* ------------------------------------------------------------
   UNI-T Physical Front Control Panel
   ------------------------------------------------------------ */
.dso-control-panel {
  width: 330px;
  background: linear-gradient(180deg, #242c38 0%, #1a212b 100%);
  border: 2px solid #2e3948;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.dso-panel-section {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dso-section-title {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #90a4ae;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Master Autoset & Run/Stop Strip */
.dso-action-bar {
  display: flex;
  gap: 8px;
}

.dso-btn-push {
  flex: 1;
  height: 32px;
  background: #37474f;
  border: 1px solid #546e7a;
  border-radius: 4px;
  color: #eceff1;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #263238;
  transition: all 0.1s;
}
.dso-btn-push:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #263238;
}

.dso-btn-push.autoset {
  background: #0288d1;
  border-color: #29b6f6;
  box-shadow: 0 3px 0 #01579b;
}
.dso-btn-push.autoset:hover { background: #039be5; }

.dso-btn-push.run-stop.running {
  background: #2e7d32;
  border-color: #4caf50;
  box-shadow: 0 3px 0 #1b5e20;
}
.dso-btn-push.run-stop.stopped {
  background: #c62828;
  border-color: #e53935;
  box-shadow: 0 3px 0 #b71c1c;
}

/* Rotary Knobs */
.dso-knob-cluster {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
}

.dso-knob-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dso-knob-label {
  font-size: 9px;
  font-weight: 700;
  color: #b0bec5;
  text-transform: uppercase;
}

.dso-knob-dial {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #4f5b66 0%, #263238 80%);
  border: 2px solid #607d8b;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6), inset 0 2px 2px rgba(255, 255, 255, 0.2);
  position: relative;
  cursor: pointer;
  transition: transform 0.05s linear;
}
.dso-knob-dial.large {
  width: 54px;
  height: 54px;
}
.dso-knob-dial::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 10px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 3px #ffffff;
}

.dso-knob-dial.ch1-dial { border-color: #ffe600; }
.dso-knob-dial.ch2-dial { border-color: #00f0ff; }
.dso-knob-dial.trig-dial { border-color: #ff9800; }

.dso-knob-val-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #cfd8dc;
  background: rgba(0,0,0,0.4);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Channel Toggle Push Buttons */
.dso-ch-toggle-btn {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.dso-ch-toggle-btn.ch1 {
  background: rgba(255, 230, 0, 0.15);
  color: #ffe600;
  border-color: #ffe600;
}
.dso-ch-toggle-btn.ch1.active {
  background: #ffe600;
  color: #1a1a00;
  box-shadow: 0 0 8px rgba(255, 230, 0, 0.6);
}

.dso-ch-toggle-btn.ch2 {
  background: rgba(0, 240, 255, 0.15);
  color: #00f0ff;
  border-color: #00f0ff;
}
.dso-ch-toggle-btn.ch2.active {
  background: #00f0ff;
  color: #001a1a;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.dso-ch-toggle-btn.math {
  background: rgba(255, 0, 234, 0.15);
  color: #ff00ea;
  border-color: #ff00ea;
}
.dso-ch-toggle-btn.math.active {
  background: #ff00ea;
  color: #1a0018;
  box-shadow: 0 0 8px rgba(255, 0, 234, 0.6);
}

/* Bottom BNC Terminals & Probe Attachers */
.dso-bnc-cluster {
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 6px;
}

.dso-bnc-terminal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.bnc-ring {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #37474f;
  border: 3px solid #78909c;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.bnc-ring:hover {
  transform: scale(1.1);
  box-shadow: 0 0 8px #ffffff;
}
.bnc-pin {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffb74d;
}
.bnc-ring.ch1 { border-color: #ffe600; }
.bnc-ring.ch2 { border-color: #00f0ff; }
.bnc-ring.ext { border-color: #b0bec5; }
.bnc-label {
  font-size: 8px;
  font-weight: 800;
  color: #b0bec5;
}
