/* System Builder layout. The stage, the panels and the view presets come from
   viewer.css and render.css; what is here is what this tool has and they
   have not: the tower list and the part list. */

/* The part list is a table of five columns, which wants more width than a
   panel of controls does. */
.builder-page .panel-right { width: 380px; }
.builder-page .panel-toggle-right[aria-expanded="true"] { right: 404px; }
.builder-page .view-presets { right: 404px; max-width: calc(100% - 760px); }
.builder-page .view-presets.panel-hidden { right: 12px; max-width: calc(100% - 24px); }
.builder-page .stage-status { max-width: min(44ch, calc(100% - 760px)); }

/* The quantity beside the button that adds it, on one line. */
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.add-row .btn { padding: 8px 18px; }

/* The tower, a row per component: name and size, how many, and out. */
.tower-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tower-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  padding: 7px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
}
.tower-name { display: grid; min-width: 0; }
.tower-name strong { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tower-name small {
  font-size: 0.72rem; color: var(--text-muted); font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.stepper { display: inline-flex; align-items: stretch; }
.stepper button,
.tower-remove {
  font: inherit;
  font-size: 0.9rem;
  line-height: 1;
  width: 24px;
  padding: 5px 0;
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
}
.stepper button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.stepper button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.stepper input[type="number"] {
  width: 32px;
  padding: 4px 2px;
  border: 1px solid var(--border-strong);
  border-width: 1px 0;
  border-radius: 0;
  text-align: center;
  font: inherit;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  background: var(--surface-1);
  color: var(--text-primary);
  -moz-appearance: textfield;
}
.stepper input::-webkit-inner-spin-button,
.stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper button:disabled,
.stepper input:disabled { color: var(--text-muted); cursor: not-allowed; }
.stepper button:not(:disabled):hover,
.tower-remove:hover { border-color: var(--accent); color: var(--accent); }
.tower-remove { border-radius: var(--radius-sm); }
.tower-remove:hover { border-color: var(--critical); color: var(--critical); }

/* The handle a row is dragged by; the toolBOX's is drawn but cannot be taken. */
.tower-handle {
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  width: 20px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: grab;
  text-align: center;
}
.tower-handle.fixed { cursor: not-allowed; opacity: 0.35; }
.tower-handle:not(.fixed):hover { color: var(--accent); }
.tower-row.dragging { opacity: 0.45; }
.tower-row.drop-target { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Four figures in two rows rather than one cramped one. */
.builder-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
.builder-stats .stat dd { font-size: 1.05rem; }

.parts-table { font-size: 0.8rem; }
.parts-table th, .parts-table td { padding: 6px 6px; }
.parts-table td:nth-child(3) { white-space: normal; }
/* The last column is a weight, not the action column the finder's tables pin. */
.parts-table th:last-child, .parts-table td:last-child {
  position: static; box-shadow: none; background: transparent;
}


@media (max-width: 1100px) {
  .builder-page .view-presets, .builder-page .view-presets.panel-hidden {
    right: 12px; max-width: calc(100% - 24px);
  }
}
@media (max-width: 760px) {
  .builder-page .panel-right { width: auto; }
  .builder-page .view-presets { right: auto; max-width: none; }
}
