/* ==========================================================================
   KiCad-Style Virtual IC Workbench & EDA Schematic Lab CSS
   Replicating KiCad Eeschema UI with Symbol Chooser, Breadboard Wiring, & Real-Time Logic Simulation
   ========================================================================== */

:root {
  --kicad-canvas-bg: #faf8f5;
  --kicad-grid-dot: #ded8cb;
  --kicad-border-red: #8c1d1d;
  --kicad-ref-red: #cc0000;
  --kicad-chip-fill: #fffdf2;
  --kicad-chip-stroke: #1e293b;
  --kicad-pin-circle: #a00000;
  --kicad-pin-num: #718096;
  --kicad-pin-label: #1a202c;
  --kicad-wire-low: #0a8c2f;
  --kicad-wire-high: #00e650;
  --kicad-wire-high-glow: rgba(0, 230, 80, 0.45);
  --kicad-wire-selected: #f59e0b;
  --kicad-footprint-pad: #c2410c;
  --kicad-footprint-body: #1e293b;
  --navy-dark: #0f172a;
  --panel-bg: #ffffff;
  --border-color: #cbd5e1;
}

/* Page Layout */
.workbench-body {
  margin: 0;
  padding: 0;
  background: #f1f5f9;
  font-family: "Manrope", sans-serif;
  color: #1e293b;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Header */
.wb-header {
  background: #14233b;
  border-bottom: 1px solid #1e3a5f;
  color: #ffffff;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 50;
}

.wb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #ffffff;
}

.wb-brand-badge {
  background: #e9bd4f;
  color: #14233b;
  font-weight: 800;
  font-size: 13px;
  padding: 4px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.wb-brand-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}

.wb-brand-subtitle {
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.8px;
  font-family: "DM Mono", monospace;
}

.wb-nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wb-nav-link {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.wb-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.wb-nav-link.active {
  color: #ffffff;
  background: #2c6ee8;
}

/* KiCad Workbench Main Toolbar */
.wb-toolbar {
  background: #ffffff;
  border-bottom: 1px solid #dce1e6;
  padding: 6px 16px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.wb-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wb-toolbar-divider {
  width: 1px;
  height: 28px;
  background: #e2e8f0;
  margin: 0 4px;
}

/* Tool Buttons */
.wb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: "DM Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  height: 36px;
}

.wb-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.wb-btn:active {
  transform: scale(0.98);
}

.wb-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #94a3b8;
}

.wb-btn.active {
  background: #2c6ee8;
  border-color: #2563eb;
  color: #ffffff;
}

.wb-btn-primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}

.wb-btn-primary:hover {
  background: #1d4ed8;
  color: #ffffff;
}

.wb-btn-accent {
  background: #e9bd4f;
  border-color: #d4a532;
  color: #14233b;
  font-weight: 700;
}

.wb-btn-accent:hover {
  background: #dfb23e;
}

.wb-btn-danger:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
}

.wb-btn-success {
  background: #10b981;
  border-color: #059669;
  color: #ffffff;
}

.wb-btn-success:hover {
  background: #059669;
  color: #ffffff;
}

.wb-btn-blank:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.wb-btn-save {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
  font-weight: 700;
}

.wb-btn-save:hover {
  background: #dcfce7;
  border-color: #22c55e;
  color: #15803d;
}

.wb-btn-library {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.wb-btn-library:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

/* Preset Dropdown */
.wb-select {
  padding: 6px 12px;
  font-family: "DM Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  height: 36px;
  cursor: pointer;
}

.wb-select:focus {
  outline: none;
  border-color: #2c6ee8;
}

/* Status Indicator */
.wb-sim-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  padding: 4px 10px;
  background: #f1f5f9;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.wb-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
  animation: pulse-dot 2s infinite;
}

.wb-status-dot.paused {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
  animation: none;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Main Workspace Area */
.wb-main-container {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Sidebar Quick Palette with Smooth Slide Drawer Animation */
.wb-palette-sidebar {
  width: 250px;
  background: #ffffff;
  border-right: 1px solid #dce1e6;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.wb-palette-sidebar.collapsed {
  margin-left: -250px;
}

.wb-palette-collapse-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #64748b;
  transition: all 0.15s ease;
}

.wb-palette-collapse-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* Edge Slider Tab Handle (Click or Press P to Toggle) */
.wb-palette-slider-tab {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 250px;
  width: 22px;
  height: 56px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: none;
  border-radius: 0 8px 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.08);
  color: #475569;
  font-size: 11px;
  font-weight: bold;
  transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s ease, color 0.15s ease;
  padding: 0;
}

.wb-palette-slider-tab.collapsed {
  left: 0;
}

.wb-palette-slider-tab:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.wb-palette-header {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.wb-palette-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wb-palette-category-title {
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.wb-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  cursor: grab;
  user-select: none;
  transition: all 0.15s ease;
}

.wb-palette-item:hover {
  border-color: #2c6ee8;
  background: #f0f5fe;
  transform: translateX(2px);
}

.wb-palette-item-info {
  display: flex;
  flex-direction: column;
}

.wb-palette-item-name {
  font-family: "DM Mono", monospace;
  font-weight: 700;
  font-size: 12px;
  color: #0f172a;
}

.wb-palette-item-desc {
  font-size: 11px;
  color: #64748b;
}

.wb-palette-tag {
  font-family: "DM Mono", monospace;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #475569;
}

.wb-palette-tag.tag-ic { background: #dbeafe; color: #1e40af; }
.wb-palette-tag.tag-io { background: #dcfce7; color: #166534; }
.wb-palette-tag.tag-gate { background: #fef3c7; color: #92400e; }

/* Canvas Container */
.wb-canvas-wrap {
  flex: 1;
  position: relative;
  background-color: var(--kicad-canvas-bg);
  background-image: radial-gradient(var(--kicad-grid-dot) 1.2px, transparent 1.2px);
  background-size: 20px 20px;
  background-position: 0 0;
  overflow: hidden;
  cursor: default;
}

.wb-canvas-wrap.tool-wire {
  cursor: crosshair;
}

.wb-canvas-wrap.tool-select {
  cursor: default;
}

.wb-canvas-wrap.is-panning {
  cursor: grabbing !important;
}

#workbench-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* KiCad Title Block in Bottom Right */
.kicad-title-block {
  pointer-events: none;
  user-select: none;
}

/* Tool Overlay / Hint Banner */
.wb-hint-bar {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
  color: #f8fafc;
  padding: 6px 14px;
  border-radius: 6px;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wb-hint-badge {
  background: #e9bd4f;
  color: #14233b;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Pin Hover & Wire Interactive Styles */
.pin-terminal-group {
  cursor: crosshair;
}

.pin-terminal-visual {
  transition: r 0.15s ease, stroke 0.15s ease, stroke-width 0.15s ease, fill 0.15s ease;
  pointer-events: none; /* Let hit circle capture all events */
}

.pin-terminal-hit {
  fill: transparent;
  stroke: transparent;
  cursor: crosshair;
  pointer-events: all;
}

/* In Wire Mode, highlight all terminals so user sees where to wire */
.wb-canvas-wrap.tool-wire .pin-terminal-visual {
  r: 5.5px !important;
  stroke: #2563eb !important;
  stroke-width: 2px !important;
  fill: #eff6ff !important;
}

.pin-terminal-group:hover .pin-terminal-visual {
  r: 7px !important;
  stroke: #ff0055 !important;
  stroke-width: 2.5px !important;
  fill: #fee2e2 !important;
}

.pin-terminal-group.active-start .pin-terminal-visual {
  r: 8px !important;
  stroke: #f59e0b !important;
  stroke-width: 3.5px !important;
  fill: #fef3c7 !important;
  animation: pulse-terminal 0.6s infinite alternate;
}

.pin-terminal-group.connect-target .pin-terminal-visual {
  r: 7.5px !important;
  stroke: #00e650 !important;
  stroke-width: 3px !important;
  fill: #dcfce7 !important;
  animation: pulse-terminal 0.8s infinite alternate;
}

.pin-terminal-group.snap-hover .pin-terminal-visual {
  r: 9px !important;
  stroke: #00ff55 !important;
  stroke-width: 4px !important;
  fill: #86efac !important;
  filter: drop-shadow(0 0 6px rgba(0, 255, 85, 0.8));
}

@keyframes pulse-terminal {
  from { stroke-width: 2px; }
  to { stroke-width: 4px; }
}

.component-node {
  cursor: grab;
  user-select: none;
}

.component-node:active {
  cursor: grabbing;
}

.comp-grab-area {
  fill: transparent;
  pointer-events: all;
  cursor: grab;
}

.component-node:active .comp-grab-area {
  cursor: grabbing;
}

.wire-waypoint-dot {
  fill: #00ff55;
  stroke: #064e3b;
  stroke-width: 1.5px;
  pointer-events: none;
  animation: pulse-dot 1s infinite alternate;
}

.active-wire-fixed {
  stroke: #00e650;
  stroke-width: 2.5px;
  fill: none;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(0, 230, 80, 0.4));
}

.active-wire-preview {
  stroke: #2563eb;
  stroke-width: 2.5px;
  stroke-dasharray: 6 3;
  fill: none;
  pointer-events: none;
}

.active-wire-preview.snapped {
  stroke: #00ff55;
  stroke-width: 3px;
  filter: drop-shadow(0 0 5px rgba(0, 255, 85, 0.8));
}

.wire-group {
  cursor: pointer;
}

.wire-hit-area {
  stroke: transparent;
  stroke-width: 16px;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  cursor: pointer;
  pointer-events: stroke;
}

.schematic-wire {
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none; /* Let wire-hit-area handle clicking */
  transition: stroke 0.15s ease, stroke-width 0.15s ease;
}

.wire-group:hover .schematic-wire {
  stroke-width: 4px !important;
  filter: drop-shadow(0 0 4px #00e650);
}

.wire-group.selected .schematic-wire {
  stroke: var(--kicad-wire-selected) !important;
  stroke-width: 4px !important;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.7));
}

/* Active High Glowing Wire */
.schematic-wire.state-high {
  stroke: var(--kicad-wire-high) !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 4px var(--kicad-wire-high-glow)) drop-shadow(0 0 8px rgba(0, 230, 80, 0.3));
}

.schematic-wire.state-low {
  stroke: var(--kicad-wire-low) !important;
  stroke-width: 2.5px !important;
}

/* Junction Dots */
.junction-dot {
  fill: var(--kicad-wire-low);
  transition: fill 0.15s ease;
  pointer-events: none;
}

.junction-dot.state-high {
  fill: var(--kicad-wire-high);
  filter: drop-shadow(0 0 4px var(--kicad-wire-high-glow));
}

/* Toggle Switch Node */
.switch-control {
  cursor: pointer;
}

.switch-control:hover rect {
  filter: brightness(1.1);
}

/* LED Node */
.led-glow {
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* ==========================================================================
   KiCad "Choose Symbol" Modal (Replicating KiCad from Vid.mp4)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.kicad-modal-window {
  width: 900px;
  max-width: 95vw;
  height: 640px;
  max-height: 92vh;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header-bar {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  font-family: "Manrope", sans-serif;
}

.modal-badge {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: #64748b;
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 6px;
}

.modal-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* Modal Search Bar */
.modal-search-row {
  padding: 10px 16px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-search-icon {
  font-family: "DM Mono", monospace;
  font-weight: 700;
  color: #64748b;
}

.modal-search-input {
  flex: 1;
  padding: 8px 12px;
  font-family: "DM Mono", monospace;
  font-size: 13px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
}

.modal-search-input:focus {
  outline: none;
  border-color: #2c6ee8;
  box-shadow: 0 0 0 3px rgba(44, 110, 232, 0.15);
}

/* Modal Main Split: Tree (Left) vs Previews (Right) */
.modal-split-body {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  overflow: hidden;
  background: #ffffff;
}

/* Left: Component List / Tree */
.modal-component-list {
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  background: #ffffff;
}

.tree-category {
  border-bottom: 1px solid #f1f5f9;
}

.tree-category-name {
  padding: 8px 14px;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.tree-item {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid #f8fafc;
  transition: all 0.1s ease;
}

.tree-item:hover {
  background: #f1f5f9;
}

.tree-item.selected {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
}

.tree-item-name {
  font-family: "DM Mono", monospace;
  font-weight: 700;
  font-size: 12px;
  color: #0f172a;
}

.tree-item-desc {
  font-size: 11px;
  color: #64748b;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right: Double Preview Panel (Symbol Top + Footprint Bottom) */
.modal-preview-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #faf8f5;
}

.preview-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #e2e8f0;
  overflow: hidden;
  position: relative;
}

.preview-box:last-child {
  border-bottom: none;
  background: #111827; /* Dark KiCad footprint PCB preview */
}

.preview-label-tag {
  position: absolute;
  top: 8px;
  left: 10px;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 5;
}

.preview-box:first-child .preview-label-tag {
  background: #e2e8f0;
  color: #334155;
}

.preview-box:last-child .preview-label-tag {
  background: #374151;
  color: #f97316; /* Copper / KiCad PCB style */
}

.preview-svg-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.preview-svg-container svg {
  max-width: 100%;
  max-height: 100%;
}

/* Modal Bottom Action Bar */
.modal-footer-bar {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-desc-text {
  font-size: 12px;
  color: #475569;
  max-width: 550px;
  line-height: 1.4;
}

.modal-desc-text strong {
  color: #0f172a;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .wb-palette-sidebar {
    display: none;
  }
  .modal-split-body {
    grid-template-columns: 1fr;
  }
  .modal-preview-panel {
    display: none;
  }
}

/* =========================================================================
   Experiment Metadata Banner (Canvas Header Strip)
   ========================================================================= */
.wb-experiment-banner {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid #dce1e6;
  border-radius: 8px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 12;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.wb-exp-badge {
  background: #e0e7ff;
  color: #3730a3;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  user-select: none;
}

.wb-exp-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.wb-exp-title-input {
  font-family: "DM Mono", monospace;
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 8px;
  outline: none;
  transition: all 0.15s ease;
  width: 320px;
  max-width: 45%;
}

.wb-exp-title-input:hover,
.wb-exp-title-input:focus {
  border-color: #94a3b8;
  background: #ffffff;
}

.wb-exp-divider {
  color: #94a3b8;
  font-size: 14px;
  flex-shrink: 0;
  user-select: none;
}

.wb-exp-obj-input {
  font-size: 12px;
  color: #475569;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 8px;
  outline: none;
  transition: all 0.15s ease;
  flex: 1;
  min-width: 150px;
}

.wb-exp-obj-input:hover,
.wb-exp-obj-input:focus {
  border-color: #94a3b8;
  background: #ffffff;
  color: #0f172a;
}

.wb-exp-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.wb-exp-quick-save-btn {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wb-exp-quick-save-btn:hover {
  background: #22c55e;
  color: #ffffff;
  border-color: #16a34a;
}

/* =========================================================================
   Save Experiment Modal
   ========================================================================= */
.save-modal-window {
  background: #ffffff;
  border-radius: 10px;
  width: 540px;
  max-width: 95vw;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  border: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.15s ease-out;
}

.save-modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #ffffff;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.form-label .required {
  color: #dc2626;
}

.form-control {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: #ffffff;
}

.form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 75px;
  line-height: 1.45;
}

.save-exp-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.stat-pill {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 3px 9px;
  border-radius: 12px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.save-status-msg {
  font-size: 12px;
  color: #166534;
  font-weight: 600;
  font-family: "DM Mono", monospace;
}

/* =========================================================================
   My Saved Experiments Library Modal
   ========================================================================= */
.library-modal-window {
  background: #ffffff;
  border-radius: 10px;
  width: 820px;
  max-width: 95vw;
  height: 620px;
  max-height: 90vh;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  border: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.15s ease-out;
}

.library-toolbar {
  padding: 12px 18px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
}

.library-cards-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #faf8f5;
}

.saved-exp-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.saved-exp-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.saved-exp-card.active-exp {
  border-left: 4px solid #2563eb;
  background: #fcfdfe;
}

.saved-exp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.saved-exp-title {
  font-family: "DM Mono", monospace;
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}

.saved-exp-date {
  font-size: 11px;
  color: #64748b;
  font-family: "DM Mono", monospace;
  white-space: nowrap;
}

.saved-exp-obj {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}

.saved-exp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed #f1f5f9;
}

.saved-exp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.saved-exp-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.library-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: #64748b;
  margin: auto;
}

.library-empty-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.library-empty-title {
  font-weight: 700;
  font-size: 15px;
  color: #334155;
  margin-bottom: 6px;
}

.library-empty-desc {
  font-size: 12px;
  max-width: 380px;
  line-height: 1.5;
}
