/* ============================================================
   편집기 — 문서(genffice-docs) · 슬라이드(genffice-slide)
   ============================================================ */

/* ------------------------------------------------------------
   문서 편집바 — genffice-docs 의 #editBar 구조를 따른다.

   genffice-docs 와 같이 **미리보기 상단**(캔버스 머리글 바로 아래)에 붙는
   인-플로우 도구모음이다. 떠 있지 않으므로 본문을 가리지 않고,
   좁아지면 다음 줄로 넘어간다.
   ------------------------------------------------------------ */
.edit-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-2);
  background: var(--bg-sidebar);
}
.edit-bar[hidden] { display: none; }
.edit-bar .eb-g { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.edit-bar .eb-sep { width: 1px; height: 18px; flex-shrink: 0; background: var(--border-2); margin: 0 3px; }

.eb-b {
  display: grid; place-items: center;
  width: 27px; height: 27px; flex-shrink: 0;
  border: 0; border-radius: var(--r-6);
  background: transparent; color: var(--text-2);
  font: inherit; font-size: var(--fs-13); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.eb-b:hover { background: var(--bg-hover); color: var(--text-1); }
.eb-b.on { background: var(--accent-subtle); color: var(--accent-text); }
.eb-b svg { width: 15px; height: 15px; }
.eb-b.bold { font-weight: 800; }
.eb-b.ital { font-style: italic; font-family: Georgia, serif; }
.eb-b.unde { text-decoration: underline; }
.eb-b.strk { text-decoration: line-through; }

.eb-s {
  height: 27px; padding: 0 6px;
  border: 1px solid var(--border-2); border-radius: var(--r-6);
  background: var(--bg-panel); color: var(--text-1);
  font: inherit; font-size: var(--fs-12); cursor: pointer;
}
.eb-s:focus-visible { outline: none; box-shadow: var(--ring); }

.eb-c {
  position: relative; display: grid; place-items: center;
  width: 27px; height: 27px; flex-shrink: 0;
  border-radius: var(--r-6); cursor: pointer;
  font-size: var(--fs-13); font-weight: 700;
}
.eb-c:hover { background: var(--bg-hover); }
.eb-c.hl span { background: #fef08a; border-radius: 2px; padding: 0 2px; }
.eb-c input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* 오른쪽 끝으로 밀어 붙인다 — 줄바꿈이 일어나면 그 줄의 오른쪽 끝이 된다 */
.edit-bar .eb-rt { display: flex; align-items: center; gap: 7px; flex-shrink: 0; margin-left: auto; padding-left: 8px; }
.eb-pill {
  font-size: var(--fs-11); font-weight: 600; white-space: nowrap;
  padding: 3px 8px; border-radius: 20px;
  background: var(--bg-subtle); color: var(--text-3);
}
.eb-pill[data-s="dirty"] { background: var(--warning-subtle); color: var(--warning); }
.eb-pill[data-s="saving"] { background: var(--accent-subtle); color: var(--accent-text); }
.eb-pill[data-s="saved"] { background: var(--success-subtle); color: var(--success); }

/* ------------------------------------------------------------
   편집 중인 본문
   ------------------------------------------------------------ */
.doc-body[contenteditable="true"] {
  outline: none;
  border-radius: var(--r-8);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}
.doc-body[contenteditable="true"] .doc-sec { position: relative; }
.doc-body[contenteditable="true"] .doc-sec::before {
  content: attr(data-sec) "장";
  position: absolute; top: 2px; left: -46px;
  font-size: var(--fs-10); font-weight: 600; color: var(--text-3);
}
.doc-body[contenteditable="true"] .doc-sec.edited::before { color: var(--accent); }
.doc-body[contenteditable="true"] :is(h1, h2, p, li):hover { background: rgba(22, 104, 179, .04); }
.doc-body[contenteditable="true"] :focus { outline: none; }

/* ------------------------------------------------------------
   슬라이드 편집 — genffice-slide 의 모드 세그먼트 + data-field 편집
   ------------------------------------------------------------ */
.stage-single { max-width: 1000px; margin: 0 auto; }

.edit-seg { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-6); background: var(--bg-subtle); }
.seg-b {
  border: 0; border-radius: var(--r-4); background: transparent;
  padding: 4px 11px; font: inherit; font-size: var(--fs-11); font-weight: 600;
  color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.seg-b:hover { color: var(--text-1); }
.seg-b.on { background: var(--bg-panel); color: var(--accent-text); box-shadow: var(--sh-1); }
.seg-hint { font-size: var(--fs-11); color: var(--text-3); }

.slide-stage { border-radius: var(--r-4); overflow: hidden; background: #fff; box-shadow: 0 4px 20px rgba(20, 20, 35, .13); }

/* 편집·요청 모드에서 편집 가능한 지점을 눈에 보이게 한다 */
.slide-stage.editing [data-field] {
  cursor: text;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(22, 104, 179, .28);
  transition: box-shadow .12s ease, background .12s ease;
}
.slide-stage.editing [data-field]:hover {
  background: rgba(22, 104, 179, .07);
  box-shadow: inset 0 0 0 1px rgba(22, 104, 179, .6);
}
.slide-stage.editing [data-field][contenteditable="true"]:focus {
  outline: none;
  background: rgba(22, 104, 179, .07);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.slide-stage.editing [data-field].edited { box-shadow: inset 0 0 0 1px var(--success); }
.slide-stage.asking [data-field]:hover { background: rgba(154, 87, 0, .1); box-shadow: inset 0 0 0 1px var(--warning); }

.stage-nav { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.stage-nav .sn { font-size: var(--fs-11); color: var(--text-3); }

.notes-card { margin-top: 14px; }
.notes-in {
  width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--border-2); border-radius: var(--r-6);
  background: var(--bg-panel); color: var(--text-1);
  font: inherit; font-size: var(--fs-12); line-height: 1.8; resize: vertical;
}
.notes-in:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
