/* Symbols and on-canvas component chrome */

/* Base schematic stroke */
.sym {
  fill: none;
  stroke: var(--sym);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sym .fill { fill: var(--sym); stroke: none; }

/* IC / package body: slight fill so pin text reads clearly on dark grid */
.sym .sym-body {
  fill: rgba(22, 30, 40, 0.72);
  stroke: var(--sym);
  stroke-width: 1.8;
}
.sym .sym-notch {
  fill: none;
  stroke: var(--sym);
  stroke-width: 1.8;
}

/* Text inside symbols (pin names, IC title, subtitles) */
.sym text,
.sym .sym-pin,
.sym .sym-title,
.sym .sym-sub {
  stroke: none;
  fill: #e6edf5;
  font-family: "Lato", "Segoe UI", system-ui, sans-serif;
  paint-order: normal;
  dominant-baseline: auto;
}
.sym .sym-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  fill: #f2f6fb;
}
.sym .sym-sub {
  font-size: 8px;
  font-weight: 500;
  fill: #9aa8b8;
  letter-spacing: 0.01em;
}
.sym .sym-pin {
  font-size: 8.5px;
  font-weight: 500;
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  fill: #c5d0de;
  letter-spacing: -0.01em;
}

.component { cursor: move; }
.comp-hit { fill: transparent; }
.comp-sel {
  fill: rgba(56, 182, 198, .05);
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-dasharray: 5 3;
  opacity: 0;
  pointer-events: none;
}
.component.selected .comp-sel { opacity: 1; }
.component:hover:not(.selected) .comp-sel { opacity: .35; }
.component[data-id] .comp-body .sym { pointer-events: none; }

/* Designator (U1, R1…) above the symbol */
.comp-label {
  font: 600 12.5px "Lato", "Segoe UI", system-ui, sans-serif;
  fill: #e8eef6;
  pointer-events: none;
  letter-spacing: 0.02em;
}
html[dir="rtl"] .comp-label {
  font-family: var(--font-fa);
  font-weight: 600;
}

/* Value / secondary line under the symbol */
.comp-value {
  font: 500 11px var(--mono);
  fill: #8b97a8;
  pointer-events: none;
}

.pin { cursor: crosshair; }
.pin-hit { fill: transparent; }
.pin-dot {
  fill: var(--bg-app);
  stroke: var(--pin);
  stroke-width: 1.6;
  pointer-events: none;
  transition: r .08s;
}
.pin.connected .pin-dot { fill: var(--wire); stroke: var(--wire); }
.pin:hover .pin-dot,
.pin.pin-source .pin-dot { stroke: var(--accent); fill: var(--accent); r: 5; }
.pin.pin-ok .pin-dot { stroke: var(--ok); fill: var(--ok); r: 5.5; }
.pin.pin-bad .pin-dot { stroke: var(--danger); fill: var(--danger); r: 5.5; }

/* Context menu + modal */
.ctx-menu {
  position: fixed; z-index: 70; min-width: 190px;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 6px;
  padding: 4px; box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
}
.menu-item {
  display: flex; justify-content: space-between; gap: 18px; width: 100%;
  background: none; border: 0; text-align: left; padding: 6px 10px; border-radius: 4px;
}
.menu-item:hover:not(:disabled),
.menu-item:focus-visible { background: var(--accent-soft); outline: none; }
.menu-item:disabled { color: #566170; }
kbd { font: 11px var(--mono); color: var(--muted); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(5, 8, 11, .62);
  display: grid; place-items: center; z-index: 80;
}
.modal {
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 18px 20px; width: 380px; max-width: calc(100vw - 32px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
.modal.wide { width: 520px; }
.modal h2 { font-size: 15px; margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.project-list {
  list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.project-list li {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--bg-raised); border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.project-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.project-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Phase 3 v4: live LED visualization */
.led-bulb { transition: fill .12s ease, filter .12s ease; }
.component.sim-led-on .led-bulb {
  filter: drop-shadow(0 0 5px currentColor) drop-shadow(0 0 12px currentColor);
  animation: ledPulse 1s ease-in-out infinite alternate;
}
.component.sim-led-burned .led-bulb { filter: none; }
@keyframes ledPulse { from { opacity: .82; } to { opacity: 1; } }

/* Lamp glow when current flows */
.lamp-bulb { transition: fill .15s ease, filter .15s ease; }
.component.sim-lamp-on .lamp-bulb,
.lamp-lit {
  filter: drop-shadow(0 0 6px #ffb84a) drop-shadow(0 0 14px #ff9800);
  animation: lampPulse 1.2s ease-in-out infinite alternate;
}
@keyframes lampPulse { from { opacity: .88; } to { opacity: 1; } }
