/* ───────────────────────────────────────────────────────────────
   iaas tiptap 에디터 테마 — 전부 #iaas-tiptap 하위로 scoped (CSS 격리)
   다른 페이지·비-tiptap 요소에 새지 않도록 최상단 id(#iaas-tiptap) 기준.
   톤: [화이트톤 기본] accent #4696d1 / navy #294e8f / border #e3e7ec (console·admin)
       [블랙톤 .tt-theme-dark] accent #90ccff / surface #2d2d2d / border #585858 (portal)
   radius: card 12px / control 7px · font: ONE Mobile 계열
   baseline: .omc/mockups/tiptap-editor-mockup.html (사용자 승인본)
   ─────────────────────────────────────────────────────────────── */
#iaas-tiptap.tt-wrap {
  --tt-accent:        #4696d1;
  --tt-accent-strong: #294e8f;
  --tt-accent-soft:   #eaf3fb;
  --tt-surface:       #ffffff;
  --tt-toolbar-bg:    #fbfcfe;
  --tt-border:        #e3e7ec;
  --tt-track:         #f5f7fa;
  --tt-text:          #2b2f33;
  --tt-text-soft:     #4a5058;
  --tt-muted:         #6b7178;
  --tt-placeholder:   #aeb4bb;
  --tt-ring:          rgba(70, 150, 209, 0.18);
  --tt-ring-strong:   rgba(70, 150, 209, 0.30);
  --tt-quote-bg:      #f5f7fa;
  --tt-code-bg:       #eef1f5;
  --tt-code-border:   #e1e1e1;
  --tt-heading:       #1f242a;

  display: block;
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(41, 78, 143, 0.04), 0 6px 18px rgba(41, 78, 143, 0.05);
  overflow: hidden;
  font-family: "ONE Mobile", "Malgun Gothic", "맑은 고딕", "AppleGothic", Helvetica, Arial, sans-serif;
  color: var(--tt-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* ── 블랙톤 토큰 재정의 (portal) — id-scoped 클래스 변형, 전역 셀렉터 아님 ── */
#iaas-tiptap.tt-wrap.tt-theme-dark {
  --tt-accent:        #90ccff;
  --tt-accent-strong: #b6dcff;
  --tt-accent-soft:   rgba(144, 204, 255, 0.16);
  --tt-surface:       #2d2d2d;
  --tt-toolbar-bg:    #333333;
  --tt-border:        #585858;
  --tt-track:         #383838;
  --tt-text:          #eef0f2;
  --tt-text-soft:     #c7ccd1;
  --tt-muted:         #9aa0a6;
  --tt-placeholder:   #777d83;
  --tt-ring:          rgba(144, 204, 255, 0.22);
  --tt-ring-strong:   rgba(144, 204, 255, 0.40);
  --tt-quote-bg:      #262626;
  --tt-code-bg:       #1f1f1f;
  --tt-code-border:   #444444;
  --tt-heading:       #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px rgba(0, 0, 0, 0.35);
}

/* focus ring — 본문 focus 시 wrap 에 accent 강조 */
#iaas-tiptap.tt-wrap.is-focus,
#iaas-tiptap.tt-wrap:focus-within {
  border-color: var(--tt-accent);
  box-shadow: 0 0 0 3px var(--tt-ring), 0 6px 18px rgba(41, 78, 143, 0.06);
}
#iaas-tiptap.tt-wrap.tt-theme-dark.is-focus,
#iaas-tiptap.tt-wrap.tt-theme-dark:focus-within {
  box-shadow: 0 0 0 3px var(--tt-ring), 0 8px 22px rgba(0, 0, 0, 0.35);
}

/* ── toolbar ── */
#iaas-tiptap .tt-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 3px;
  padding: 8px 10px;
  background: var(--tt-toolbar-bg);
  border-bottom: 1px solid var(--tt-border);
}
#iaas-tiptap .tt-toolbar .tt-sep {
  width: 1px; align-self: stretch; margin: 4px 6px; background: var(--tt-border);
}

/* blockType select */
#iaas-tiptap .tt-toolbar select[data-cmd="blockType"] {
  /* width/line-height 명시: 페이지 폼 CSS(portal customer.css `#contact ul li select{width:calc(100%-400px);line-height:42px}`) 침범 방어 */
  width: auto; line-height: 30px;
  height: 32px; min-width: 78px; padding: 0 26px 0 10px;
  border: 1px solid var(--tt-border); border-radius: 7px;
  background-color: var(--tt-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7178' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
  font-size: 13px; font-family: inherit; color: var(--tt-text); cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
/* 다크: 드롭다운 화살표 밝은색으로 교체 */
#iaas-tiptap.tt-theme-dark .tt-toolbar select[data-cmd="blockType"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0a6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
#iaas-tiptap .tt-toolbar select[data-cmd="blockType"]:hover { border-color: var(--tt-accent); }
#iaas-tiptap .tt-toolbar select[data-cmd="blockType"]:focus {
  outline: none; border-color: var(--tt-accent); box-shadow: 0 0 0 3px var(--tt-ring);
}

/* toolbar 버튼 — 32px 정사각 */
#iaas-tiptap .tt-toolbar button[data-cmd] {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: 7px; background: transparent;
  /* 버튼 글리프는 심볼 폰트 스택: ONE Mobile 웹폰트가 U+2022(•)/U+2014(—)를 빈 글리프로 보유해 안 보임 */
  color: var(--tt-text-soft); font-size: 14px; font-family: Arial, Helvetica, sans-serif; line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
#iaas-tiptap .tt-toolbar button[data-cmd] b,
#iaas-tiptap .tt-toolbar button[data-cmd] i,
#iaas-tiptap .tt-toolbar button[data-cmd] u,
#iaas-tiptap .tt-toolbar button[data-cmd] s { font-size: 14px; }
#iaas-tiptap .tt-toolbar button[data-cmd="code"] { font-size: 12px; }
#iaas-tiptap .tt-toolbar button[data-cmd="orderedList"] { font-size: 12.5px; }

/* hover */
#iaas-tiptap .tt-toolbar button[data-cmd]:hover {
  background: var(--tt-track); color: var(--tt-accent-strong);
}
/* active(토글 on) — accent 강조 */
#iaas-tiptap .tt-toolbar button[data-cmd].is-active {
  background: var(--tt-accent-soft); color: var(--tt-accent-strong);
  border-color: rgba(70, 150, 209, 0.35);
}
#iaas-tiptap.tt-theme-dark .tt-toolbar button[data-cmd].is-active {
  border-color: rgba(144, 204, 255, 0.45);
}
/* keyboard focus 접근성 */
#iaas-tiptap .tt-toolbar button[data-cmd]:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--tt-ring-strong);
}
#iaas-tiptap .tt-toolbar button[data-cmd] svg { width: 17px; height: 17px; display: block; }

/* ── editor host(본문) ── */
#iaas-tiptap .tt-editor-host {
  min-height: 220px; padding: 18px 20px; background: var(--tt-surface);
  overflow-wrap: break-word;
}
#iaas-tiptap .tt-editor-host .ProseMirror {
  /* padding 0: 번들 기본 `.ProseMirror{padding:12px}` 무효화 — 여백은 .tt-editor-host(18px 20px)가 담당(목업 baseline 기준) */
  outline: none; padding: 0; font-size: 14.5px; line-height: 1.75; color: var(--tt-text);
}
#iaas-tiptap .tt-editor-host .ProseMirror:focus { outline: none; }
#iaas-tiptap .tt-editor-host .ProseMirror > * { margin: 0 0 12px; }
#iaas-tiptap .tt-editor-host .ProseMirror > *:last-child { margin-bottom: 0; }
/* p box model 명시: admin 모달 basic_con.css(.iteasy_modal .modal-body div.detail ul li p)의
   flex/float/width/padding/min-height/색·크기 침범 방어 */
#iaas-tiptap .tt-editor-host .ProseMirror p {
  display: block; float: none; width: auto; padding: 0; min-height: 0;
  font-size: inherit; line-height: inherit; color: inherit;
}
/* 제목: padding/text-align 명시 — 페이지 제목 CSS(가운데정렬·여백) 침범 방어. 정렬 기능은 inline style 이라 영향 없음 */
#iaas-tiptap .tt-editor-host .ProseMirror h1 { font-size: 22px; font-weight: 700; line-height: 1.4; color: var(--tt-heading); padding: 0; text-align: inherit; }
#iaas-tiptap .tt-editor-host .ProseMirror h2 { font-size: 18px; font-weight: 700; line-height: 1.4; color: var(--tt-heading); padding: 0; text-align: inherit; }
#iaas-tiptap .tt-editor-host .ProseMirror h3 { font-size: 16px; font-weight: 700; line-height: 1.45; color: var(--tt-heading); padding: 0; text-align: inherit; }
#iaas-tiptap .tt-editor-host .ProseMirror a { color: var(--tt-accent); text-decoration: underline; text-underline-offset: 2px; }
#iaas-tiptap .tt-editor-host .ProseMirror ul,
#iaas-tiptap .tt-editor-host .ProseMirror ol { padding-left: 22px; }
#iaas-tiptap .tt-editor-host .ProseMirror ul { list-style: disc; }
#iaas-tiptap .tt-editor-host .ProseMirror ol { list-style: decimal; }
/* li box model 명시: 에디터가 폼 ul li 내부에 놓일 때 외부 li 규칙(padding/border/font-size/list-style) 침범 방어.
   :first-child/:last-child 페이지 규칙((1,1,2))도 .tt-editor-host 포함 specificity((1,2,1))로 제압 */
#iaas-tiptap .tt-editor-host .ProseMirror li {
  margin: 4px 0; padding: 0; border: 0; font-size: inherit; list-style: inherit;
  min-height: 0; /* admin mail 모달 #mail-form ul li { min-height:35px } 침범 방어 */
}
#iaas-tiptap .tt-editor-host .ProseMirror li p { margin: 0; }
#iaas-tiptap .tt-editor-host .ProseMirror blockquote {
  margin: 0 0 12px; padding: 4px 16px;
  border-left: 3px solid var(--tt-accent); background: var(--tt-quote-bg);
  border-radius: 0 7px 7px 0; color: var(--tt-text-soft);
}
#iaas-tiptap .tt-editor-host .ProseMirror hr { border: none; border-top: 1px solid var(--tt-border); margin: 18px 0; }
#iaas-tiptap .tt-editor-host .ProseMirror code {
  background: var(--tt-code-bg); border: 1px solid var(--tt-code-border);
  border-radius: 4px; padding: 1px 5px; font-size: 12.5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: var(--tt-accent-strong);
}
/* taskList(체크박스 목록) */
#iaas-tiptap .tt-editor-host .ProseMirror ul[data-type="taskList"] { list-style: none; padding-left: 4px; }
#iaas-tiptap .tt-editor-host .ProseMirror ul[data-type="taskList"] li { display: flex; align-items: flex-start; gap: 8px; }
/* label width 명시: 외부 폼 label 규칙(width/margin) 침범 방어 */
#iaas-tiptap .tt-editor-host .ProseMirror ul[data-type="taskList"] li > label { margin: 3px 0 0; width: auto; }
#iaas-tiptap .tt-editor-host .ProseMirror ul[data-type="taskList"] input[type="checkbox"] { accent-color: var(--tt-accent); }
/* placeholder (tiptap: 빈 첫 노드에 data-placeholder) */
#iaas-tiptap .tt-editor-host .ProseMirror p.is-empty::before {
  content: attr(data-placeholder); color: var(--tt-placeholder);
  float: left; height: 0; pointer-events: none;
}

/* ── readonly 변형(메일/공지 보기용) — toolbar 없음, 본문만 ── */
#iaas-tiptap.tt-wrap.tt-readonly { box-shadow: none; }
#iaas-tiptap.tt-wrap.tt-readonly:focus-within { border-color: var(--tt-border); box-shadow: none; }
#iaas-tiptap.tt-wrap.tt-readonly .tt-editor-host { min-height: 0; padding: 20px 22px; }
#iaas-tiptap.tt-wrap.tt-readonly .ProseMirror { cursor: default; }

/* 반응형: 좁은 폭에서 toolbar 줄바꿈 + host 패딩 축소 */
@media (max-width: 560px) {
  #iaas-tiptap .tt-editor-host { padding: 14px 14px; }
  #iaas-tiptap .tt-toolbar { padding: 7px 8px; }
}
