/* 3D CAD (/3dcad) — what the feature, construction and inspection dialogs add to the command dialog
   (specs/038-3d-cad/contracts/client-ui.md §4): ordered lists (loft sections, pattern features), the 「세트 추가」
   button, the 모양 library and colour, the 물리적 재료 table, inspection results and the measure label over the canvas.
   Colours are the shell's :root variables (cad3d.css). No inline styles: positions are set through the CSSOM. */

/* ---------------------------------------------------------------- lists */
.c3-feat-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 132px;
  overflow: auto;
  border: 1px solid var(--c3-border-soft, #e2e4e7);
  border-radius: var(--c3-radius, 3px);
  background: var(--c3-surface, #fff);
}

.c3-feat-list-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 4px;
}

.c3-feat-list-row + .c3-feat-list-row {
  border-top: 1px solid var(--c3-border-soft, #e2e4e7);
}

.c3-feat-list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.c3-feat-list-btn {
  width: 20px;
  height: 18px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--c3-radius, 3px);
  background: transparent;
  color: var(--c3-text-muted, #666a70);
  font-size: 10px;
  line-height: 16px;
  cursor: pointer;
}

.c3-feat-list-btn:hover:not(:disabled) {
  border-color: var(--c3-hover-border, #b5d3f1);
  background: var(--c3-hover, #e3eefa);
}

.c3-feat-list-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.c3-feat-empty,
.c3-inspect-note {
  color: var(--c3-text-muted, #666a70);
  font-size: 11px;
  line-height: 1.4;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.c3-feat-add-set {
  width: 100%;
}

/* ---------------------------------------------------------------- appearance */
.c3-appearance-library {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 210px;
  overflow: auto;
}

.c3-appearance-group {
  margin-top: 2px;
  color: var(--c3-text-muted, #666a70);
  font-size: 11px;
}

.c3-appearance-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.c3-swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--c3-border, #c3c6cb);
  border-radius: 50%;
  background: var(--c3-surface-alt, #f6f6f6);
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.14), inset 0 4px 8px rgba(255, 255, 255, 0.45);
  cursor: pointer;
}

.c3-swatch.is-default {
  background: linear-gradient(135deg, var(--c3-surface, #fff) 0 46%, var(--c3-error, #d6302d) 46% 54%, var(--c3-surface, #fff) 54% 100%);
}

.c3-swatch.is-clear {
  opacity: 0.72;
}

.c3-swatch:hover {
  border-color: var(--c3-accent, #0696d7);
}

.c3-swatch.is-on {
  outline: 2px solid var(--c3-accent, #0696d7);
  outline-offset: 1px;
}

.c3-color {
  width: 48px;
  height: 24px;
  padding: 0 2px;
  border: 1px solid var(--c3-border, #c3c6cb);
  border-radius: var(--c3-radius, 3px);
  background: var(--c3-surface, #fff);
  cursor: pointer;
}

/* ---------------------------------------------------------------- materials */
.c3-material-list {
  display: flex;
  flex-direction: column;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--c3-border-soft, #e2e4e7);
  border-radius: var(--c3-radius, 3px);
  background: var(--c3-surface, #fff);
}

.c3-material-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 6px;
  border: 0;
  background: transparent;
  color: var(--c3-text, #232323);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.c3-material-row:hover {
  background: var(--c3-hover, #e3eefa);
}

.c3-material-row.is-on {
  background: var(--c3-active, #cfe4f8);
}

.c3-material-name {
  flex: 1;
}

.c3-material-density {
  color: var(--c3-text-muted, #666a70);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- inspection */
.c3-inspect-results {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.c3-inspect-results th,
.c3-inspect-results td {
  padding: 2px 0;
  vertical-align: top;
  font-weight: normal;
}

.c3-inspect-results th {
  padding-right: 8px;
  color: var(--c3-text-muted, #666a70);
  text-align: left;
  white-space: nowrap;
}

.c3-inspect-results td {
  text-align: right;
  /* A value never breaks inside a number (「10.0 / 0 mm」, R-UX-15); a long row scrolls instead. */
  white-space: nowrap;
}

/* The results of 측정·간섭·무게 중심 take the dialog's whole width (no empty label column). */
.c3-cmd-row:has(.c3-inspect-results),
.c3-cmd-row:has(.c3-inspect-note) {
  grid-template-columns: minmax(0, 1fr);
}

.c3-cmd-row:has(.c3-inspect-results) > .c3-cmd-label,
.c3-cmd-row:has(.c3-inspect-note) > .c3-cmd-label {
  display: none;
}

.c3-custom:has(> .c3-inspect-results) {
  overflow-x: auto;
}

.c3-inspect-compute {
  width: 100%;
}

.c3-measure-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--c3-accent, #0696d7);
  color: var(--c3-accent-text, #fff);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  pointer-events: none;
  will-change: transform;
}

/* ------------------------------------------------- pattern instance suppression */
.c3-instance-grid {
  display: grid;
  gap: 3px;
  max-width: 100%;
  overflow-x: auto;
}

.c3-instance {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--c3-line-strong, #9aa0a6);
  border-radius: 2px;
  background: var(--c3-tint, #e8f2fb);
  color: var(--c3-error-ink, #b3261e);
  font-size: 13px;
  line-height: 20px;
  cursor: pointer;
}

.c3-instance.is-original {
  background: var(--c3-accent, #0696d7);
  border-color: var(--c3-accent, #0696d7);
  cursor: default;
}

.c3-instance.is-suppressed {
  background: var(--c3-surface);
  border-style: dashed;
}

/* The same toggles on the canvas, one at every instance (T135): a check box (R7-UX-11, as Fusion) — ticked = in, empty =
   left out; the original cannot go and shows only a faint dot. */
.c3-instance-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.c3-instance-mark {
  position: absolute;
  left: -8px;
  top: -8px;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 2px solid var(--c3-accent, #0696d7);
  border-radius: 3px;
  background: var(--c3-accent, #0696d7);
  box-shadow: 0 0 0 1px var(--c3-surface, #fbfbfc);
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
}

/* The tick of a kept instance. */
.c3-instance-mark::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 4px;
  height: 8px;
  border: solid var(--c3-accent-text, #ffffff);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.c3-instance-mark[hidden] {
  display: none;
}

.c3-instance-mark.is-suppressed {
  background: var(--c3-surface, #fbfbfc);
}

.c3-instance-mark.is-suppressed::after,
.c3-instance-mark.is-original::after {
  content: none;
}

.c3-instance-mark.is-original {
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: var(--c3-line-strong, #9aa0a6);
  box-shadow: none;
  opacity: 0.6;
  cursor: default;
}

.c3-instance-mark:hover:not(:disabled) {
  box-shadow: 0 0 0 3px var(--c3-hover, #e3eefb);
}

.c3-instance-mark:focus-visible {
  outline: 2px solid var(--c3-accent-fg, var(--c3-accent, #0696d7));
  outline-offset: 2px;
}
