@import '../shared.css'; /* .kx-select 등 공용 프리미티브 */

.kx-editor {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* 툴바 */
.kx-editor__toolbar {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  background: var(--color-white);
  border-bottom: var(--border-card);
}
.kx-editor__toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.kx-editor__hall {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  color: var(--color-neutral-900);
}
/* 전시장(홀) 선택 — 실 운영 진입점(공용 .kx-select 위 툴바 보정) */
.kx-editor__hall-select {
  max-width: 200px;
  height: 32px;
}

/* 평면도 소스 탭 — DWG(CAD 렌더) / JPG(크롤 도면) */
.kx-drawing-tabs {
  display: flex;
  gap: var(--space-1);
  padding: 2px;
  border: var(--border-card);
  border-radius: var(--radius-md);
  background: var(--color-neutral-100);
}
.kx-drawing-tabs button {
  flex: 1;
  height: 26px;
  border: 0;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  color: var(--color-neutral-500);
  cursor: pointer;
}
.kx-drawing-tabs button.is-active {
  background: var(--color-white);
  color: var(--color-neutral-900);
  box-shadow: var(--shadow-level1, 0 1px 2px rgba(0, 0, 0, 0.08));
}
.kx-drawing-tabs button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.kx-editor__version {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}
.kx-editor__saved::before {
  content: '● ';
  color: var(--color-success);
  font-size: 8px;
}
.kx-editor__degraded {
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  color: var(--color-warning);
  background: var(--color-warning-bg);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.kx-editor__toolbar-right {
  display: flex;
  gap: var(--space-2);
}

/* 3열 워크스페이스 */
.kx-editor__workspace {
  flex: 1;
  min-height: 0;
  display: flex;
}
.kx-editor__left {
  width: var(--panel-left-w);
  flex-shrink: 0;
  background: var(--color-white);
  border-right: var(--border-card);
  overflow-y: auto;
}
.kx-editor__right {
  width: var(--panel-right-w);
  flex-shrink: 0;
  background: var(--color-white);
  border-left: var(--border-card);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 좌측 도구 */
.kx-tool-group {
  padding: var(--space-4);
  border-bottom: var(--border-card);
}
.kx-tool-group h3 {
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-neutral-500);
  margin-bottom: var(--space-3);
}
.kx-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
.kx-palette__item {
  border: var(--border-card);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  cursor: grab;
  background: var(--color-white);
  font: inherit;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.kx-palette__item:hover {
  border-color: var(--color-primary-600);
  background: var(--color-primary-050);
}
.kx-palette__item.is-active {
  border-color: var(--color-primary-600);
  background: var(--color-primary-050);
  box-shadow: 0 0 0 1px var(--color-primary-600) inset;
}
.kx-palette__item:focus-visible {
  outline: 2px solid var(--color-primary-600);
  outline-offset: 1px;
}
.kx-palette__item.is-full {
  grid-column: span 2;
}
.kx-palette__hint {
  margin: var(--space-2) 0 0;
  font-size: var(--fs-micro);
  color: var(--color-neutral-500);
  line-height: 1.5;
}
.kx-palette__swatch {
  display: block;
  min-width: 20px;
  min-height: 20px;
  border: 1px solid var(--color-primary-600);
  background: rgba(0, 102, 179, 0.15);
}
.kx-palette__item.is-full .kx-palette__swatch {
  width: 100%;
  height: 28px;
}
.kx-palette__label {
  font-size: var(--fs-micro);
  text-align: center;
  color: var(--color-neutral-700);
}
.kx-facility {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.kx-facility button {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border: var(--border-card);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  font-size: var(--fs-body);
  color: var(--color-neutral-700);
}
.kx-facility button:hover {
  background: var(--color-neutral-050);
}

/* 레이어 토글 */
.kx-layer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  font-size: var(--fs-body);
  color: var(--color-neutral-700);
}
.kx-eswitch {
  width: 34px;
  height: 18px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--color-neutral-200);
  position: relative;
  transition: background 0.15s ease;
}
.kx-eswitch.is-on {
  background: var(--color-primary-600);
}
.kx-eswitch__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-white);
  transition: left 0.15s ease;
}
.kx-eswitch.is-on .kx-eswitch__knob {
  left: 18px;
}

/* 중앙 캔버스 */
.kx-editor__canvas-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-canvas-bg);
}
.kx-editor__canvas-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  overflow: hidden;
}
.kx-editor__canvas-loading {
  width: min(900px, 90%);
}
.kx-editor__canvas-error,
.kx-editor__canvas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  color: rgba(255, 255, 255, 0.85);
}
.kx-editor__statusbar {
  height: 40px;
  flex-shrink: 0;
  background: var(--color-white);
  border-top: var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}
.kx-editor__stats {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.kx-editor__local-count {
  color: var(--color-primary-700);
  font-weight: var(--fw-semibold);
}

/* 부스 배치 모드 힌트 바 */
.kx-editor__place-hint {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--gutter);
  background: var(--color-primary-050);
  border-bottom: 1px solid var(--color-primary-600);
  color: var(--color-primary-700);
  font-size: var(--fs-caption);
}
.kx-editor__place-stop {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: var(--border-card);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-neutral-700);
  padding: 4px 8px;
  font-size: var(--fs-micro);
  cursor: pointer;
}
.kx-editor__place-stop:hover {
  border-color: var(--color-primary-600);
  color: var(--color-primary-700);
}

/* 평면도 크게 보기 팝업 — 대형 뷰어 */
.kx-editor__bigview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: min(72vh, 640px);
  padding: var(--space-5);
  background: var(--color-canvas-bg);
}

/* 배치안 이력 그리드(Nifty .kx-table) */
.kx-editor__hist-table {
  width: 100%;
}
.kx-editor__hist-actions {
  text-align: right;
  white-space: nowrap;
}
.kx-editor__hist-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
}
.kx-editor__hist-badge.is-applied {
  background: var(--color-success-bg, var(--color-success-bg));
  color: var(--color-success, #0e8a5f);
}
.kx-editor__hist-badge.is-draft {
  background: var(--color-neutral-100);
  color: var(--color-neutral-700);
}
.kx-editor__hist-badge.is-proposal {
  background: var(--color-ai-surface, #efeaff);
  color: var(--color-ai-accent, #6d4aff);
}
.kx-edot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-neutral-200);
}
.kx-editor__zoom {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.kx-editor__zoom button {
  width: 24px;
  height: 24px;
  border: var(--border-card);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-neutral-700);
}
.kx-editor__zoom span {
  width: 44px;
  text-align: center;
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-700);
}

/* 우측 탭 */
.kx-editor__tabs {
  display: flex;
  border-bottom: var(--border-card);
  flex-shrink: 0;
}
.kx-editor__tabs button {
  flex: 1;
  padding: var(--space-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-500);
}
.kx-editor__tabs button.is-active {
  color: var(--color-primary-600);
  border-bottom-color: var(--color-primary-600);
}

/* 속성 */
.kx-props {
  padding: var(--space-4);
  overflow-y: auto;
}
.kx-props__empty {
  color: var(--color-neutral-500);
  font-size: var(--fs-body);
}
.kx-props__list {
  margin: 0;
}
.kx-props__row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: var(--border-card);
}
.kx-props__row dt {
  color: var(--color-neutral-500);
  font-size: var(--fs-caption);
}
.kx-props__row dd {
  margin: 0;
  color: var(--color-neutral-900);
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
}

/* 검증 */
.kx-valid {
  padding: var(--space-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--color-neutral-050);
  flex: 1;
}
.kx-valid__summary {
  display: flex;
  gap: var(--space-2);
}
.kx-valid__chip {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
}
.kx-valid__chip--block {
  background: var(--color-error-bg);
  color: var(--color-error);
}
.kx-valid__chip--warn {
  background: var(--color-violation-warn-bg);
  color: var(--color-violation-warn-text);
}
.kx-valid__ok {
  background: var(--color-success-bg);
  color: var(--color-success);
  font-weight: var(--fw-semibold);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
}
.kx-valid__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.kx-valid__card {
  display: flex;
  gap: var(--space-3);
  background: var(--color-white);
  border: var(--border-card);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}
.kx-valid__card--block {
  border-left: 3px solid var(--color-error);
}
.kx-valid__card--warn {
  border-left: 3px solid var(--color-violation-warn);
}
.kx-valid__pin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--color-on-accent);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kx-valid__pin--block {
  background: var(--color-error);
}
.kx-valid__pin--warn {
  background: var(--color-violation-warn);
}
.kx-valid__card-body {
  flex: 1;
  min-width: 0;
}
.kx-valid__card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
}
.kx-valid__label {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-900);
}
.kx-valid__locate {
  background: none;
  border: none;
  color: var(--color-primary-600);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
}
.kx-valid__measured {
  font-size: var(--fs-caption);
  color: var(--color-neutral-700);
  margin-top: 2px;
}
.kx-valid__doc {
  display: inline-block;
  margin-top: var(--space-2);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  color: var(--color-ai-accent);
  background: var(--color-ai-surface);
  border: 1px solid var(--color-ai-accent);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}
.kx-valid__disclaimer {
  font-size: var(--fs-micro);
  line-height: 15px;
  color: var(--color-neutral-500);
}
