/* Shared cards, form fields, toggles (form page + result re-run) */

.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.sec { border-bottom: 1px solid var(--border); }
.sec:last-child { border-bottom: none; }

.sec-hdr {
  padding: 0.9rem 1.25rem 0.75rem;
  display: flex; align-items: center; gap: 9px;
}

.sec-icon {
  width: 22px; height: 22px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; flex-shrink: 0; font-weight: 700;
}

.si-green  { background: var(--green-dim); color: var(--green); }
.si-blue   { background: var(--blue-dim);  color: var(--blue);  }
.si-cyan   { background: var(--cyan-dim);  color: var(--cyan);  }
.si-orange { background: rgba(245,158,11,.14); color: var(--orange); }

.sec-title {
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text2);
}

.sec-body { padding: 0 1.25rem 1rem; }

.irow { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0.6rem; }
.irow:last-child { margin-bottom: 0; }
.irow.full { grid-template-columns: 1fr; }

.ig { display: flex; flex-direction: column; gap: 3px; }

.ilabel {
  font-size: 0.68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--text2);
}

.iwrap { position: relative; display: flex; align-items: center; }

.iunit {
  position: absolute; right: 10px;
  font-size: 0.67rem; font-family: 'JetBrains Mono', monospace;
  color: var(--muted); pointer-events: none;
}

input[type="number"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.865rem;
  padding: 8px 34px 8px 10px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { opacity: 0; }

input[type="number"]:hover { border-color: rgba(15, 23, 42, 0.16); }

input[type="number"]:focus {
  border-color: var(--border-hi);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
  background: #fff;
}

input[type="number"].err {
  border-color: rgba(239,68,68,0.55);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.09);
}

.err-msg { font-size: 0.68rem; color: var(--red); margin-top: 2px; }

.form-errs {
  margin: 0 1.25rem 0.25rem;
  padding: 0.65rem 0.9rem;
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: var(--r-sm);
}

.form-errs p { font-size: 0.78rem; color: #b91c1c; line-height: 1.5; }

.trow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.45rem 0;
}

.tlabel { font-size: 0.82rem; font-weight: 500; color: var(--text); }
.tsub   { font-size: 0.68rem; color: var(--muted); margin-top: 1px; }

.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.tslider {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid var(--border);
  border-radius: 99px; cursor: pointer;
  transition: background var(--t), border-color var(--t);
}

.tslider::before {
  content: ''; position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: var(--muted); border-radius: 50%;
  transition: transform var(--t), background var(--t);
}

.toggle input:checked + .tslider {
  background: var(--cyan-dim); border-color: var(--cyan);
}

.toggle input:checked + .tslider::before {
  transform: translateX(18px);
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.45);
}

.vg-wrap {
  overflow: hidden; max-height: 0;
  transition: max-height 0.32s ease, opacity 0.28s ease;
  opacity: 0;
}

.vg-wrap.open { max-height: 110px; opacity: 1; }

.ss-wrap {
  overflow: hidden; max-height: 0;
  transition: max-height 0.38s ease, opacity 0.3s ease;
  opacity: 0;
}

.ss-wrap.open { max-height: 540px; opacity: 1; }

.pp-min-wrap,
.cp-min-wrap {
  overflow: hidden; max-height: 0;
  transition: max-height 0.32s ease, opacity 0.28s ease;
  opacity: 0;
}

.pp-min-wrap.open,
.cp-min-wrap.open { max-height: 110px; opacity: 1; }

/* ── Advanced options disclosure ── */
.adv-select {
  position: relative;
  margin-top: 0.85rem;
}

.adv-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.adv-trigger:hover {
  border-color: rgba(14, 165, 233, 0.45);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.adv-select.is-open .adv-trigger {
  border-color: rgba(14, 165, 233, 0.55);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.12);
}

.adv-trigger-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

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

.adv-trigger-desc {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
}

.adv-badge {
  flex: 0 0 auto;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0369a1;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.28);
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
  white-space: nowrap;
}

.adv-chevron {
  flex: 0 0 auto;
  display: flex;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.adv-select.is-open .adv-chevron {
  transform: rotate(180deg);
  color: #0369a1;
}

.adv-panel {
  margin-top: 0.45rem;
  padding: 0.35rem 0.55rem 0.15rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(248, 250, 252, 0.9);
  animation: advPanelIn 0.18s ease;
}

.adv-panel .trow:first-child {
  margin-top: 0;
}

@keyframes advPanelIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Side strip demo panel ── */
.ss-demo {
  margin: 0.5rem 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.5);
  overflow: hidden;
}

.ss-demo-hint {
  padding: 0.28rem 0.75rem;
  font-size: 0.62rem;
  color: var(--muted);
  font-style: italic;
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

#ssDemoSvg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 60px;
}

/* Shared PCB and panel visuals — mirrors result.css .pv-* for the form page */
.sd-panel-rect {
  fill: #ffffff;
  stroke: #cbd5e1;
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}

.sd-pcb {
  fill: #f0fdf4;
  stroke: #86efac;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

/* Ghost strip — dashed, low opacity */
.sd-strip-ghost {
  fill: rgba(217,119,6,0.07);
  stroke: #d97706;
  stroke-width: 1;
  stroke-dasharray: 4 3;
  opacity: 0.55;
  vector-effect: non-scaling-stroke;
  transition: opacity 0.14s ease, fill 0.14s ease;
}

.sd-strip-ghost:hover {
  opacity: 0.82;
  fill: rgba(217,119,6,0.16);
}

/* Solid strip — selected axis */
.sd-strip-solid {
  fill: rgba(217,119,6,0.17);
  stroke: #b45309;
  stroke-width: 1.25;
  opacity: 0.95;
  vector-effect: non-scaling-stroke;
  transition: opacity 0.14s ease, fill 0.14s ease;
}

.sd-strip-solid:hover {
  fill: rgba(217,119,6,0.26);
}

/* Drag-handle tick marks inside solid strips */
.sd-drag-tick {
  stroke: rgba(180,83,9,0.55);
  stroke-width: 1.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* Result page: action row + outline button */
.actions {
  padding: 1rem 1.25rem;
  display: flex; gap: 0.75rem; justify-content: flex-end;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: var(--r-sm);
  font: 600 0.85rem 'Inter', sans-serif;
  letter-spacing: 0.02em; cursor: pointer;
  text-decoration: none;
  transition: all var(--t);
}

.btn:hover {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.14);
  transform: translateY(-1px);
}

.btn.btn-run {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(37, 99, 235, 0.18));
  border: 1px solid rgba(14, 165, 233, 0.35);
  color: #0369a1;
  letter-spacing: 0.04em;
  padding: 0.75rem 1.4rem;
}

.btn.btn-run:hover {
  border-color: var(--cyan);
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.2), 0 2px 8px rgba(15, 23, 42, 0.08);
}
