/* Purchase configurator. Split view: 3D stage left, step panel right. */

#configurator {
  display: grid;
  grid-template-columns: 1fr 440px;
  min-height: calc(100vh - 64px);
}
@media (max-width: 900px) {
  #configurator { grid-template-columns: 1fr; }
}

/* ── 3D stage ── */
.cfg-stage {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  background: radial-gradient(circle at 50% 35%, #fbfbfb 0%, #e9e9e9 100%);
  overflow: hidden;
}
@media (max-width: 900px) {
  .cfg-stage { position: sticky; height: 46vh; min-height: 320px; border-bottom: 1px solid var(--line); }
}
.cfg-stage canvas { display: block; width: 100%; height: 100%; }

.cfg-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(10,10,10,0.9);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.35;
  max-width: 240px;
  transform: translate(12px, 12px);
  display: none;
  z-index: 6;
}
.cfg-tooltip strong { display: block; margin-bottom: 2px; }
.cfg-tooltip span { color: #bbb; font-size: 0.8rem; }

.cfg-hint {
  position: absolute;
  bottom: 14px; left: 14px;
  background: rgba(255,255,255,0.85);
  color: var(--ink-muted);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  pointer-events: none;
}
.cfg-loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--ink-faint);
  font-size: 0.9rem;
  background: inherit;
}

/* Coverage map (cloud step) — overlays the 3D stage */
.cfg-map {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 3;
}
.cfg-map > .leaflet-container {
  position: absolute;
  inset: 0;
  background: #e6e6e6;
}
.cfg-legend {
  position: absolute;
  bottom: 14px; right: 14px;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.78rem;
  z-index: 1200;
  box-shadow: 0 4px 16px -8px rgba(0,0,0,0.25);
}
.cfg-legend__title {
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.cfg-legend__row { display: flex; align-items: center; gap: 8px; margin: 3px 0; color: var(--ink-soft); }
.cfg-legend__sw { width: 14px; height: 14px; border-radius: 3px; flex: 0 0 auto; }

/* Stage overlay controls (e.g. "open it up" on the compute step) */
.cfg-stage-controls {
  position: absolute;
  top: 14px; left: 14px;
  display: flex;
  gap: 8px;
  z-index: 5;
}
.cfg-stage-controls button {
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.cfg-stage-controls button:hover { background: #fff; }
.cfg-stage-controls button[aria-pressed="true"] {
  background: var(--ink); color: #fff; border-color: var(--ink);
}

/* ── Panel ── */
.cfg-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface);
}
@media (max-width: 900px) { .cfg-panel { border-left: 0; } }

.cfg-progress {
  display: flex;
  gap: 6px;
  padding: var(--gap-l) var(--gap-l) 0;
}
.cfg-progress span {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
}
.cfg-progress span.is-done { background: var(--brand-grey); }
.cfg-progress span.is-active { background: var(--ink); }

.cfg-step {
  flex: 1;
  padding: var(--gap-l);
  overflow-y: auto;
}
.cfg-step__eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--brand-grey);
  margin-bottom: var(--gap-s);
}
.cfg-step h2 { font-size: 1.6rem; margin-bottom: var(--gap-s); }
.cfg-step__lead { color: var(--ink-muted); margin-bottom: var(--gap-l); }

/* Component list (compute / apparatus steps) */
.cfg-parts { display: flex; flex-direction: column; gap: 8px; }
.cfg-part {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: var(--gap-m);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.cfg-part__body { flex: 1; }
.cfg-part__name { font-weight: 600; font-size: 0.95rem; }
.cfg-part__hover { color: var(--ink-muted); font-size: 0.85rem; margin-top: 2px; }
.cfg-part__price { font-weight: 600; font-family: ui-monospace, Menlo, monospace; white-space: nowrap; }
.cfg-part__price.is-off { color: var(--ink-faint); text-decoration: line-through; }
.cfg-part--removable { border-style: dashed; }

/* Toggle switch */
.cfg-switch {
  flex: 0 0 auto;
  width: 40px; height: 24px;
  border-radius: 999px;
  background: var(--line-strong);
  border: 0;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.cfg-switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.cfg-switch[aria-pressed="true"] { background: var(--ink); }
.cfg-switch[aria-pressed="true"]::after { transform: translateX(16px); }

/* Path-pick cards */
.cfg-pathpick { padding: var(--gap-l); }
.cfg-path-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--gap-l);
  margin-bottom: var(--gap-m);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  text-align: left;
  width: 100%;
  background: var(--surface);
  display: block;
}
.cfg-path-card:hover { border-color: var(--ink); }
.cfg-path-card__name { font-size: 1.4rem; font-weight: 700; }
.cfg-path-card__tag { color: var(--ink-muted); font-size: 0.9rem; margin: 4px 0 var(--gap-m); }
.cfg-path-card__price { font-weight: 600; }
.cfg-path-card__price strong { font-size: 1.5rem; }
.cfg-path-card__price span { color: var(--ink-muted); font-weight: 400; }
.cfg-path-card__from { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--brand-grey); font-weight: 600; }

/* Connectivity route UI */
.cfg-route__add { display: flex; gap: 8px; margin-bottom: var(--gap-m); }
.cfg-route__add input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}
.cfg-route__add button {
  padding: 10px 16px; border-radius: 6px;
  background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; border: 0;
}
.cfg-spot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px var(--gap-m);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 8px;
}
.cfg-spot__name { font-weight: 500; }
.cfg-signal { display: flex; align-items: center; gap: 8px; }
.cfg-signal__bars { display: flex; align-items: flex-end; gap: 2px; height: 18px; }
.cfg-signal__bars i { width: 4px; background: var(--line-strong); border-radius: 1px; }
.cfg-signal__bars i:nth-child(1){height:33%} .cfg-signal__bars i:nth-child(2){height:66%} .cfg-signal__bars i:nth-child(3){height:100%}
.cfg-signal--strong .cfg-signal__bars i { background: var(--good); }
.cfg-signal--medium .cfg-signal__bars i:nth-child(-n+2) { background: var(--warn); }
.cfg-signal--weak .cfg-signal__bars i:nth-child(1) { background: var(--bad); }
.cfg-signal__label { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.cfg-route__note { color: var(--ink-faint); font-size: 0.82rem; margin-top: var(--gap-s); }

/* Coverage search + verdict */
.cfg-search { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--gap-m); }
.cfg-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

/* Typeahead dropdown attached to each search input */
.cfg-typeahead { position: relative; }
.cfg-typeahead__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  z-index: 10;
  max-height: 260px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 10px 28px -14px rgba(0,0,0,0.22);
}
.cfg-typeahead__list.is-open { display: block; }
.cfg-typeahead__item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.3;
  border-top: 1px solid var(--line);
}
.cfg-typeahead__item:first-child { border-top: 0; }
.cfg-typeahead__item:hover,
.cfg-typeahead__item.is-active { background: var(--bg-alt); }
.cfg-typeahead__item strong { display: block; color: var(--ink); font-weight: 600; }
.cfg-typeahead__item small { display: block; color: var(--ink-faint); font-size: 0.8rem; margin-top: 1px; }
.cfg-typeahead__empty { padding: 10px 12px; color: var(--ink-faint); font-size: 0.85rem; }
.cfg-search__row { display: flex; gap: 8px; }
.cfg-search__row input { flex: 1; }
.cfg-search button {
  padding: 10px 16px; border: 0; border-radius: 6px;
  background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.cfg-search button:disabled { opacity: 0.5; cursor: default; }
.cfg-search__add {
  align-self: flex-start; background: none; border: 0; padding: 0;
  color: var(--ink-muted); font-size: 0.85rem; cursor: pointer; text-decoration: underline;
}
.cfg-verdict {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: var(--gap-m);
  margin: var(--gap-m) 0;
}
.cfg-verdict--good { border-left-color: #1f9d55; }
.cfg-verdict--caution { border-left-color: #f0a020; }
.cfg-verdict--warn { border-left-color: #d14; }
.cfg-verdict__head { font-weight: 700; font-size: 1.1rem; margin: 8px 0 4px; }
.cfg-verdict p { color: var(--ink-muted); font-size: 0.92rem; margin-bottom: var(--gap-m); }
.cfg-verdict__cta {
  display: inline-block; padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 0.9rem;
  border: 0; cursor: pointer; text-decoration: none;
}
.cfg-verdict__cta:hover { opacity: 0.85; }
.cfg-verdict__loading, .cfg-verdict__err { color: var(--ink-faint); font-size: 0.9rem; }
.cfg-verdict__err { color: var(--bad); }

/* Addons */
.cfg-addon {
  display: flex; align-items: flex-start; gap: 12px;
  padding: var(--gap-m);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-alt);
  margin-top: var(--gap-m);
}
.cfg-addon__body { flex: 1; }
.cfg-addon__name { font-weight: 600; font-size: 0.95rem; }
.cfg-addon__hover { color: var(--ink-muted); font-size: 0.85rem; margin-top: 2px; }
.cfg-addon__price { font-weight: 600; font-family: ui-monospace, Menlo, monospace; white-space: nowrap; }

/* Total step itemization */
.cfg-total__lines { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--gap-l); }
.cfg-total__line { display: flex; justify-content: space-between; padding: 10px var(--gap-m); border-top: 1px solid var(--line); font-size: 0.92rem; }
.cfg-total__line:first-child { border-top: 0; }
.cfg-total__line span:last-child { font-family: ui-monospace, Menlo, monospace; font-weight: 600; }
.cfg-total__line--sub { color: var(--ink-muted); }
.cfg-total__grand { background: var(--ink); color: #fff; }
.cfg-total__grand span:last-child { font-size: 1.2rem; }

/* Price bar (sticky footer of the panel) */
.cfg-pricebar {
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--line-strong);
  background: var(--surface);
  padding: var(--gap-m) var(--gap-l);
  display: flex;
  align-items: center;
  gap: var(--gap-m);
}
.cfg-pricebar__price { flex: 1; }
.cfg-pricebar__upfront { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.cfg-pricebar__monthly { color: var(--ink-muted); font-size: 0.9rem; }
.cfg-pricebar__nav { display: flex; gap: 8px; }
.cfg-btn {
  padding: 12px 22px; border-radius: 999px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: #fff; font-size: 0.95rem;
}
.cfg-btn:hover { opacity: 0.85; }
.cfg-btn--ghost { background: transparent; color: var(--ink); }
.cfg-btn--ghost:hover { background: var(--bg-alt); opacity: 1; }
.cfg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
