/* PRISME 2D CAD — 지시선·치수 보강·문자 도구 (cad2d_leaders.js).
   Dialogs of the leader, dimension and text tools (cadc-): the multileader style manager
   and editor, the QLEADER settings and the FIND dialog. Colours come from the core
   --cad-* tokens; inputs and buttons use the shell's control classes. */

/* ------------------------------------------- multileader style manager */

.cadc-mls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cadc-mls-current {
  color: var(--cad-text-muted);
}

.cadc-mls-body {
  display: grid;
  grid-template-columns: minmax(140px, 170px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.cadc-mls-list {
  min-height: 190px;
}

.cadc-mls-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cadc-mls-caption {
  color: var(--cad-text-muted);
}

.cadc-mls-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 132px;
}

.cadc-mls-buttons .cads-btn {
  width: 100%;
  white-space: nowrap;
}

.cadc-mls-preview {
  border: 1px solid var(--cad-border-soft);
  background: var(--cad-model-bg);
  color: var(--cad-canvas-fg, #ffffff);
  line-height: 0;
}

.cadc-mls-preview svg {
  display: block;
  width: 100%;
  height: auto;
}

.cadc-mls-preview .cadc-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}

.cadc-mls-preview .cadc-fill {
  fill: currentColor;
  stroke: none;
}

.cadc-mls-preview .cadc-text {
  fill: currentColor;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
}

[data-theme="light"] .cadc-mls-preview {
  color: #000000;
}

/* ---------------------------------------------- multileader style editor */

.cadc-mls-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
  align-items: start;
}

.cadc-mls-tabs-body {
  min-height: 300px;
}

.cadc-mls-tab {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cadc-mls-tab[hidden],
.cadc-mls-section[hidden] {
  display: none;
}

.cadc-mls-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 6px 8px 8px;
  border: 1px solid var(--cad-border-soft);
}

.cadc-mls-section legend {
  padding: 0 4px;
  color: var(--cad-text-muted);
}

.cadc-mls-field .cads-select,
.cadc-mls-field .cads-input {
  flex: 0 0 150px;
  width: 150px;
  min-width: 0;
}

.cadc-mls-field .cads-input-num {
  flex-basis: 88px;
  width: 88px;
}

.cadc-mls-pair {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.cadc-mls-pair .cads-select {
  min-width: 88px;
}

.cadc-mls-color {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 150px;
  width: 150px;
  justify-content: flex-start;
}

.cadc-mls-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid var(--cad-border);
}

.cadc-mls-swatch[data-empty="true"] {
  background-image: linear-gradient(135deg, transparent 45%, var(--cad-text-muted) 45%, var(--cad-text-muted) 55%, transparent 55%);
}

.cadc-mls-new {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cadc-mls-new .cads-input,
.cadc-mls-new .cads-select {
  flex: 0 0 190px;
  width: 190px;
}

.cadc-mls-message {
  min-height: 1.3em;
  margin: 0;
  color: var(--cad-danger, #e5484d);
  font-size: 11px;
}

@media (max-width: 640px) {
  .cadc-mls-body,
  .cadc-mls-edit { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------- QLEADER settings */

.cadc-qleader {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* -------------------------------------------------------------------- FIND */

.cadc-find {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cadc-find-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 6px 12px;
  align-items: end;
}

.cadc-find-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cadc-find-row .cads-input,
.cadc-find-row .cads-select {
  width: 100%;
}

.cadc-find-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.cadc-find-status {
  min-height: 1.3em;
  color: var(--cad-text-muted);
}

.cadc-find-results {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--cad-border-soft);
  background: var(--cad-bg-input);
}

.cadc-find-results table {
  width: 100%;
  border-collapse: collapse;
}

.cadc-find-results th {
  position: sticky;
  top: 0;
  padding: 3px 8px;
  border-bottom: 1px solid var(--cad-border-soft);
  background: var(--cad-bg-panel, var(--cad-bg-dialog));
  color: var(--cad-text-muted);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.cadc-find-results td {
  padding: 2px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--cad-border-soft) 50%, transparent);
  overflow-wrap: anywhere;
}

.cadc-find-results tr[aria-selected="true"] td {
  background: var(--cad-accent);
  color: var(--cad-accent-text);
}

.cadc-find-results tbody tr {
  cursor: default;
}

.cadc-find-results mark {
  background: color-mix(in srgb, var(--cad-warning) 55%, transparent);
  color: inherit;
}

.cadc-find-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
