/* editor.css — 에디터 캔버스 및 레이어 공통 스타일 */

/* ── 캔버스 래퍼 ─────────────────────────────── */
#editor-canvas,
#editor-canvas-mobile {
  position: relative;
  background: #ffffff;
  box-shadow: var(--shadow-canvas);
  overflow: hidden;
  width: 708px;
  height: 1082px;
  transform-origin: 0 0;
}

#canvas-scaler {
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* ── 가이드선 ─────────────────────────────────── */
.canvas-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 30;
}

.canvas-guide--cut {
  border: 1px dashed rgba(200, 50, 50, 0.5);
}

.canvas-guide--safe {
  border: 1px solid rgba(100, 120, 255, 0.3);
}

.canvas-guide-label {
  position: absolute;
  top: -16px;
  left: 0;
  font-size: 10px;
  font-family: monospace;
  text-transform: uppercase;
  font-weight: 600;
}

.canvas-guide--cut .canvas-guide-label  { color: rgba(200, 50, 50, 0.6); }
.canvas-guide--safe .canvas-guide-label { color: rgba(100, 120, 255, 0.4); }

/* ── 블리드 마커 ─────────────────────────────── */
.canvas-bleed-mark {
  position: absolute;
  font-size: 20px;
  font-weight: 300;
  color: #bbb;
  line-height: 1;
  user-select: none;
  pointer-events: none;
  z-index: 40;
}
.canvas-bleed-mark--tl { top: 6px;  left: 6px; }
.canvas-bleed-mark--tr { top: 6px;  right: 6px; }
.canvas-bleed-mark--bl { bottom: 6px; left: 6px; }
.canvas-bleed-mark--br { bottom: 6px; right: 6px; }

/* ── IC칩 오버레이 (고정, 레이어 아님) ──────── */
.ic-chip {
  position: absolute;
  z-index: 20;
  background: linear-gradient(135deg, #c8a830, #f0d060, #b09020, #d8b840);
  border-radius: 3px;
  border: 1px solid #a07828;
  pointer-events: none;
}

.ic-chip-lines {
  width: 100%;
  height: 100%;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ic-chip-line {
  height: 1px;
  background: rgba(0, 0, 0, 0.25);
}

/* ── 레이어 공통 ─────────────────────────────── */
.layer {
  position: absolute;
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 10;
}

.layer:active {
  cursor: grabbing;
}

.layer.selected {
  outline: 2px solid #3E53FF;
  outline-offset: 1px;
}

.layer.layer-hidden {
  display: none;
}

.layer.locked {
  cursor: default;
  opacity: 0.6;
}

/* ── Transform 핸들 ──────────────────────────── */
.layer-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid #3E53FF;
  border-radius: 2px;
  touch-action: none;
  z-index: 100;
  pointer-events: all;
}

.handle-nw { top: -5px;  left: -5px;  cursor: nw-resize; }
.handle-ne { top: -5px;  right: -5px; cursor: ne-resize; }
.handle-sw { bottom: -5px; left: -5px;  cursor: sw-resize; }
.handle-se { bottom: -5px; right: -5px; cursor: se-resize; }

.handle-rotate {
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  cursor: grab;
  width: 14px;
  height: 14px;
  background: white;
  border: 2px solid #3E53FF;
  border-radius: 50%;
}
.handle-rotate:active { cursor: grabbing; }

.layer.selected::before {
  content: '';
  position: absolute;
  top: -30px;
  left: 50%;
  margin-left: -1px;
  width: 2px;
  height: 28px;
  background: #3E53FF;
  pointer-events: none;
}

/* ── 레이어 컨텐츠 ──────────────────────────── */
.layer-content {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── 텍스트 레이어 ───────────────────────────── */
.layer-text .layer-content {
  white-space: nowrap;
  outline: none;
  line-height: 1.2;
  overflow: visible;
  pointer-events: auto;
}

[contenteditable="true"]:focus { outline: none; cursor: text; }

/* ── 이미지 레이어 ───────────────────────────── */
.layer-image .layer-content {
  display: block;
  max-width: none;
  object-fit: contain;
  pointer-events: none;
}
