/* 랜딩페이지 편집모달 — 편집탭 T자형 그리드 (2026-08-22 A-4 개편, lp-editor-layout 컨트롤러와 짝)
 *
 * 구조: .lpe-panel(flex col · height 100% — 탭 패널 자체) >
 *   [편집기 헤더(.lp-editor-header, 잠금 통과)] [.lpe-top 공통사항·블록옵션] [.lpe-mswitch 모바일 전환 바]
 *   [.lpe-bottom = grid: var(--left) | 스플리터 | minmax(0,1fr)]
 * 폭 제한 없음 — 편집탭은 본문 전폭 사용(사용자 확정). 각 영역 독립 스크롤.
 *
 * ⚠컬럼 트랙은 minmax(0,1fr) 필수 — auto 트랙이면 블록옵션 nowrap 줄의 min-content 가
 *   트랙을 밀어내 전 행이 모달보다 넓어진다(샘플 단계 모바일 잘림 실증).
 * 모바일 = 컨테이너 쿼리(≤768px) — 뷰포트가 아닌 모달 폭 기준(rmm 리사이즈 대응).
 * 잠금(.lp-edit-locked)은 패널 직속 자식 규칙 그대로: .lpe-top/.lpe-bottom 통째 비활성(현행 동일),
 *   헤더만 lp-unlock-always 로 통과.
 */

.lpe-panel { container-type: inline-size; color: #374151; }
.lpe-panel.rmm-tab-panel.rmm-tab-panel-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* ── 편집기 헤더 (turbo replace 대상 파셜 — 구 인라인 <style> 에서 이관) ── */
.lp-editor-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 0;
  background: #f3f7fb;
}
.lp-editor-header-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lp-editor-header-actions { display: flex; align-items: center; gap: 8px; }
.lpe-title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
  padding-left: 10px;
  border-left: 4px solid #3e6187;
  letter-spacing: -0.2px;
  word-break: break-all;
}

/* ── 상단 공통영역 (T 의 가로획) ── */
.lpe-top {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  min-width: 0;
  padding: 10px 16px 12px;
  background: linear-gradient(180deg, #f3f7fb, #fbfdfe);
  border-bottom: 1px solid #dbe6f0;
}
.lpe-locked-banner {
  flex-basis: 100%;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  font-size: 12px;
  line-height: 1.5;
}

.lpe-card {
  border: 1px solid #dbe6f0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.lpe-card-hd {
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #3e6187;
  background: #f3f7fb;
  padding: 5px 12px;
  border-bottom: 1px solid #e4edf5;
}
.lpe-card-bd { padding: 8px 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.lpe-grow { flex: 1; min-width: 340px; }
.lpe-bgimg { padding: 0 12px; }
.lpe-bgimg:has(.bg-img-preview) { padding-bottom: 10px; }

.lpe-fld { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: #6b7280; white-space: nowrap; }
.lpe-fld select { padding: 4px 7px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 11.5px; background: #fff; color: #111827; }
.lpe-fld input[type="color"] { width: 30px; height: 24px; border: 1px solid #cbd5e1; border-radius: 5px; cursor: pointer; background: #fff; padding: 1px; }
.lpe-pick {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  color: #374151;
  cursor: pointer;
}
.lpe-pick:hover { background: #f8fafc; }
.lpe-blk-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: #fff;
  border: 1px solid #c9d8e6;
  border-radius: 14px;
  font-size: 11px;
  color: #3e6187;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.lpe-blk-btn:hover { background: #f3f7fb; border-color: #3e6187; }
.lpe-blk-btn::before { content: "+"; font-weight: 800; color: #94a3b8; }

/* 상단 접기 버튼 — 편집기 헤더 우측(모바일 전용, PC 숨김).
 * 라벨은 패널 .lpe-folded 클래스로 CSS 전환 — 버튼이 turbo replace 되는 헤더 파셜 안이라
 * JS 로 textContent 를 바꾸면 헤더 재렌더 시 접힘 상태와 라벨이 어긋난다. */
.lpe-fold {
  display: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #64748b;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.lpe-fold-closed { display: none; }
.lpe-panel.lpe-folded .lpe-fold-open { display: none; }
.lpe-panel.lpe-folded .lpe-fold-closed { display: inline; }

/* ── 모바일 편집↔미리보기 전환 바 (PC 숨김) ── */
.lpe-mswitch { display: none; min-width: 0; }

/* ── 하단: 블록편집 | 스플리터 | 미리보기 ── */
.lpe-bottom {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: grid;
  /* --left 클램프는 CSS 가 담당 — JS connect 시점엔 패널이 display:none(비활성 탭)이라
     rect 폭이 0 이어서 JS 클램프가 저장값을 최소폭으로 뭉개는 실사고(복원 안 됨). 347 = 우측 최소 340 + 스플리터 7 */
  grid-template-columns: clamp(280px, var(--left, 420px), calc(100% - 347px)) 7px minmax(0, 1fr);
}
.lpe-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.lpe-pane-hd {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 7px 14px;
  border-bottom: 1px solid #e4edf5;
}
.lpe-dot { width: 7px; height: 7px; border-radius: 50%; background: #3e6187; flex-shrink: 0; }
.lpe-pane-body { flex: 1; overflow-y: auto; min-height: 0; }

.lpe-edit { background: #f6f9fc; }
.lpe-edit .lpe-pane-hd { color: #3e6187; background: #eef4f9; }
.lpe-edit .lpe-pane-body { padding: 12px; }

.lpe-split { cursor: col-resize; background: #e4edf5; position: relative; touch-action: none; }
/* 드래그 중 — iframe 이 포인터 이벤트를 삼켜 pointerup 유실되는 것 차단 + 텍스트 선택 방지 */
.lpe-bottom.lpe-dragging { user-select: none; cursor: col-resize; }
.lpe-bottom.lpe-dragging .lpe-frame { pointer-events: none; }
.lpe-split:hover, .lpe-split.on { background: #3e6187; }
.lpe-split::after {
  content: "⋮";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #94a3b8;
  font-size: 13px;
}
.lpe-split:hover::after, .lpe-split.on::after { color: #fff; }

.lpe-prev { background: #eef2f6; }
.lpe-prev .lpe-pane-hd { color: #475569; background: #e8edf2; }
.lpe-prev .lpe-pane-hd .lpe-dot { background: #94a3b8; }
.lpe-devs { margin-left: auto; display: flex; gap: 3px; padding: 3px; background: #dde4ea; border-radius: 8px; }
.lpe-dev {
  padding: 3px 10px;
  border: none;
  border-radius: 6px;
  font-size: 10.5px;
  cursor: pointer;
  background: transparent;
  color: #6b7280;
  font-weight: 600;
}
.lpe-dev.on { background: #fff; color: #3e6187; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* 미리보기 iframe — 폭은 디바이스 전환이 인라인 width 로 제어, 세로는 pane 을 가득 채움 */
.lpe-prev-body { display: flex; flex-direction: column; overflow: hidden; }
.lpe-frame-wrap {
  flex: 1;
  min-height: 0;
  padding: 10px;
  display: flex;
  justify-content: center;
  overflow: hidden;
}
.lpe-frame {
  width: 100%;
  height: 100%;
  min-height: 420px; /* 모달 높이가 확정되지 않는 예외 상황 폴백 */
  border: none;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  transition: width 0.25s ease;
}

/* ============================================================
   블록 카드 — A-4 액센트형 (2026-08-22 개편, landing_page_editor_controller
   renderEditor 와 클래스명 계약. 골격 + 본문 공통 문법)
   본문 문법 4종: 구역(.lpe-bsec) / 라벨:컨트롤 행(.lpe-brow>.lpe-bfld) /
   세그먼트(.lpe-seg — 배타 2~7개) / 토글 칩(.lpe-chip — 숨김 checkbox 내장)
   ============================================================ */
.lpe-blk { border: 1px solid #dbe6f0; border-radius: 10px; background: #fff; margin-bottom: 10px; overflow: hidden; transition: border-color 0.15s; }
.lpe-blk:hover { border-color: #c4d3e2; }
.lpe-blk-ghost { opacity: 0.4; border: 1.5px dashed #3e6187; }

.lpe-blk-hd { display: flex; align-items: center; gap: 7px; padding: 7px 10px; background: linear-gradient(180deg, #f3f7fb, #fbfdfe); border-bottom: 1px solid #e4edf5; min-width: 0; }
.lpe-blk-folded .lpe-blk-hd { border-bottom: none; }
.lpe-blk-grip { color: #b6c6d5; cursor: grab; font-size: 14px; padding: 2px 3px; margin: -2px 0; border-radius: 5px; flex-shrink: 0; touch-action: none; user-select: none; }
.lpe-blk-grip:hover { color: #3e6187; background: #e8f0f7; }
.lpe-blk-grip:active { cursor: grabbing; }
.lpe-blk-ic { width: 15px; height: 15px; flex-shrink: 0; color: #3e6187; }
.lpe-blk-ty { font-size: 12px; font-weight: 700; color: #1e293b; flex-shrink: 0; letter-spacing: -0.2px; }
.lpe-blk-tag { font-size: 10px; font-weight: 700; color: #3e6187; background: #eef4f9; border: 1px solid #dbe6f0; padding: 1px 7px; border-radius: 8px; flex-shrink: 0; white-space: nowrap; }
.lpe-blk-tag.warn { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.lpe-blk-sum { display: none; font-size: 11px; color: #94a3b8; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lpe-blk-folded .lpe-blk-sum { display: block; }

.lpe-blk-acts { margin-left: auto; display: flex; gap: 3px; flex-shrink: 0; }
.lpe-blk-acts button { width: 24px; height: 24px; border: 1px solid #dbe6f0; background: #fff; border-radius: 6px; color: #64748b; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.lpe-blk-acts button:hover { border-color: #3e6187; color: #3e6187; background: #f3f7fb; }
.lpe-blk-acts button.del { color: #dc2626; border-color: #fecaca; }
.lpe-blk-acts button.del:hover { background: #fef2f2; border-color: #dc2626; }
.lpe-blk-acts button:disabled { opacity: 0.35; cursor: default; border-color: #e4edf5; color: #94a3b8; background: #fff; }
.lpe-blk-fold svg { transition: transform 0.15s; }
.lpe-blk:not(.lpe-blk-folded) .lpe-blk-fold svg { transform: rotate(180deg); }

.lpe-blk-bd { padding: 4px 14px 12px; font-size: 12px; color: #475569; }
.lpe-blk-folded .lpe-blk-bd { display: none; }

/* 상단 pane 헤더 [모두 접기] (PC 전용 — 모바일은 pane-hd 자체가 숨김) */
.lpe-fold-all { margin-left: auto; border: 1px solid #cbd5e1; background: #fff; color: #64748b; font-size: 10.5px; font-weight: 400; letter-spacing: 0; padding: 3px 9px; border-radius: 6px; cursor: pointer; }
.lpe-fold-all:hover { border-color: #3e6187; color: #3e6187; }

/* ── 본문 공통 문법 ── */
.lpe-bsec { padding: 10px 0 4px; }
.lpe-bsec + .lpe-bsec { border-top: 1px dashed #e8eff5; margin-top: 6px; }
.lpe-bsec-t { font-size: 10.5px; font-weight: 700; color: #8aa2b8; letter-spacing: 0.4px; margin-bottom: 8px; }
.lpe-brow { display: flex; align-items: center; gap: 12px; row-gap: 8px; flex-wrap: wrap; min-width: 0; }
.lpe-brow + .lpe-brow { margin-top: 9px; }
.lpe-bfld { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #6b7280; white-space: nowrap; }
.lpe-bfld select { padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 7px; font-size: 12px; background: #fff; color: #111827; }
.lpe-bfld input[type="text"], .lpe-bfld input[type="url"] { padding: 6px 9px; border: 1px solid #cbd5e1; border-radius: 7px; font-size: 12px; background: #fff; color: #111827; }
.lpe-bfld input[type="color"] { width: 30px; height: 26px; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; background: #fff; padding: 1px; }
.lpe-bfld.grow { flex: 1; min-width: 0; white-space: nowrap; }
.lpe-bfld.grow input { flex: 1; min-width: 120px; }
textarea.lpe-bta { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; font-family: inherit; resize: vertical; color: #111827; background: #fff; }
textarea.lpe-bta.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; }
textarea.lpe-bta:focus, .lpe-bfld select:focus, .lpe-bfld input:focus { outline: none; border-color: #3e6187; box-shadow: 0 0 0 3px #3e618722; }

.lpe-seg { display: inline-flex; padding: 2px; background: #eef2f6; border-radius: 8px; gap: 2px; flex-shrink: 0; }
.lpe-seg button { border: none; background: transparent; padding: 4px 11px; border-radius: 6px; font-size: 11.5px; color: #64748b; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.lpe-seg button.on { background: #fff; color: #3e6187; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1); }
.lpe-seg .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; pointer-events: none; }

.lpe-chip { display: inline-flex; align-items: center; border: 1px solid #cbd5e1; background: #fff; color: #64748b; font-size: 11.5px; padding: 4px 11px; border-radius: 9px; cursor: pointer; font-weight: 600; user-select: none; }
.lpe-chip input { display: none; }
.lpe-chip:has(input:checked) { border-color: #3e6187; background: #eef4f9; color: #3e6187; }
.lpe-chip.is-dis { opacity: 0.55; cursor: not-allowed; }

.lpe-pickbtn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; font-size: 12px; color: #374151; cursor: pointer; font-weight: 600; }
.lpe-pickbtn:hover { border-color: #3e6187; color: #3e6187; background: #f8fbfd; }
.lpe-pickbtn.primary { background: #3e6187; border-color: #3e6187; color: #fff; }
.lpe-pickbtn.primary:hover { background: #355475; color: #fff; }
.lpe-pickbtn.danger { color: #dc2626; border-color: #fecaca; }
.lpe-pickbtn.danger:hover { background: #fef2f2; border-color: #dc2626; }

.lpe-note-info { font-size: 11px; color: #0369a1; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 7px; padding: 7px 10px; line-height: 1.6; }
.lpe-note-warn { font-size: 11px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 7px; padding: 7px 10px; line-height: 1.6; }
.lpe-note-muted { font-size: 11px; color: #94a3b8; line-height: 1.5; }

details.lpe-badv { border: 1px solid #e4edf5; border-radius: 8px; background: #fbfdfe; }
details.lpe-badv > summary { cursor: pointer; font-size: 11px; font-weight: 700; color: #3e6187; padding: 8px 12px; user-select: none; }
details.lpe-badv[open] > summary { border-bottom: 1px dashed #e4edf5; }
details.lpe-badv > .lpe-badv-in { padding: 10px 12px; }

/* 이미지 정렬 드래그 (SortableJS ghost — 구 인라인 <style> 에서 이관, JS 클래스명 계약) */
.lp-img-sortable-ghost { opacity: 0.3; border-color: #2563eb !important; }
.lp-img-sortable-chosen { border-color: #2563eb !important; transform: scale(1.05); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3); }
.lp-img-sortable-drag { opacity: 0.9; }

/* ============================================================
   모바일 (컨테이너 쿼리 — 모달 폭 768px 이하)
   · 상단: 카드 세로 스택 + 컨트롤 가로 스크롤 1줄 + [접기]
   · 하단: [블록 편집 | 미리보기] 전면 전환 (스플리터·pane 헤더 숨김)
   · 터치 타깃 확대 · 디바이스 전환 숨김(화면 폭 = 모바일 미리보기)
   ============================================================ */
@container (max-width: 768px) {
  .lp-editor-header { padding: 10px 12px 0; }
  .lpe-top { padding: 8px 10px; gap: 8px; flex-direction: column; }
  .lpe-card, .lpe-grow { min-width: 0; width: 100%; }
  .lpe-card-bd {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 9px 12px;
    gap: 8px;
  }
  .lpe-fld { font-size: 12.5px; }
  .lpe-fld select { padding: 7px 9px; font-size: 12.5px; }
  .lpe-fld input[type="color"] { width: 36px; height: 30px; }
  .lpe-pick { padding: 7px 11px; font-size: 12px; }
  .lpe-blk-btn { padding: 7px 12px; font-size: 12px; border-radius: 17px; }
  .lpe-fold { display: inline-flex; }
  /* 접기 = 공통사항·블록옵션 영역 통째 숨김(하단 공간 최대 활용).
     모바일 한정 규칙 — PC 로 넓히면 .lpe-folded 가 남아 있어도 상단은 항상 보인다(버튼도 PC 숨김). */
  .lpe-panel.lpe-folded .lpe-top { display: none; }
  /* 헤더는 하단 패딩 0(아래 .lpe-top 이 여백 담당) — 접히면 전환 바와 딱 붙으므로 보충 */
  .lpe-panel.lpe-folded .lp-editor-header { padding-bottom: 10px; }

  .lpe-mswitch {
    display: flex;
    gap: 4px;
    padding: 5px;
    background: #e4ebf2;
    border-bottom: 1px solid #dbe6f0;
    flex-shrink: 0;
  }
  .lpe-mswitch button {
    flex: 1;
    padding: 9px 0;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    background: transparent;
    color: #64748b;
    cursor: pointer;
  }
  .lpe-mswitch button.on { background: #fff; color: #3e6187; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1); }

  .lpe-bottom { display: flex; flex-direction: column; }
  .lpe-split { display: none; }
  .lpe-pane-hd { display: none; }             /* 전환 바가 헤더 역할 */
  .lpe-pane { flex: 1; min-height: 0; }
  .lpe-bottom[data-mv="edit"] .lpe-prev { display: none; }
  .lpe-bottom[data-mv="prev"] .lpe-edit { display: none; }

  .lpe-edit .lpe-pane-body { padding: 10px 10px 24px; }
  .lpe-frame-wrap { padding: 6px; }
  .lpe-frame { width: 100% !important; min-height: 320px; border-radius: 4px; }
  .lpe-devs { display: none; }

  /* 블록 카드 — 터치 타깃 확대 */
  .lpe-blk-hd { padding: 9px 10px; gap: 8px; }
  .lpe-blk-grip { font-size: 17px; padding: 4px 5px; }
  .lpe-blk-acts { gap: 5px; }
  .lpe-blk-acts button { width: 30px; height: 30px; border-radius: 7px; }
  .lpe-blk-bd { padding: 4px 12px 12px; }
  .lpe-blk-sum { font-size: 11.5px; }
  .lpe-bfld { font-size: 12.5px; }
  .lpe-bfld select, .lpe-bfld input[type="text"], .lpe-bfld input[type="url"] { padding: 8px 10px; font-size: 13px; }
  .lpe-bfld input[type="color"] { width: 36px; height: 32px; }
  .lpe-seg button { padding: 7px 13px; font-size: 12.5px; }
  .lpe-chip { padding: 7px 13px; font-size: 12.5px; }
  .lpe-pickbtn { padding: 9px 14px; font-size: 13px; }
}
