/* ===============================
   TipTap Toolbar (Unified)
=============================== */

.tiptap-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.tb-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* 버튼 & 셀렉트 */
.tiptap-toolbar button,
.tiptap-toolbar select {
  height: 30px;
  padding: 0 8px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
}

.tiptap-toolbar button:hover {
  background: #f3f4f6;
}

.tiptap-toolbar select {
  min-width: 90px;
}

/* 이미지 버튼 강조 */
.image-btn {
  font-weight: 600;
  background: #eef2ff;
  border-color: #c7d2fe;
}

/* ===============================
   Mobile Toolbar (2줄 정렬)
=============================== */
@media (max-width: 768px) {
  .tiptap-toolbar {
    gap: 4px;
  }

  .tiptap-toolbar button,
  .tiptap-toolbar select {
    height: 28px;
    font-size: 12px;
  }

  .tiptap-toolbar select {
    min-width: 72px;
  }
}

/* ===============================
   TipTap Editor (Unified)
   - 데스크탑/모바일 공통
   - ProseMirror 중심으로 고정
=============================== */

/* wrapper: 프로젝트마다 클래스가 다를 수 있어 넓게 커버 */
.editor-wrapper,
.tiptap-editor,
.tiptap-editor-wrapper {
  width: 100%;
}

/* 실제 입력 영역 */
.ProseMirror {
  min-height: 380px;         /* 기본: 충분한 높이 */
  padding: 16px;
  line-height: 1.7;
  font-size: 1rem;
  box-sizing: border-box;
  word-break: break-word;
}

/* 포커스 outline 제거 */
.ProseMirror:focus {
  outline: none;
}

/* ===============================
   Mobile / iOS Fix
   - “한 줄로 눌림” 방지의 핵심 구간
=============================== */
@media (max-width: 768px) {

  /* wrapper에 높이 기준을 명확히 줌 */
  .editor-wrapper,
  .tiptap-editor,
  .tiptap-editor-wrapper {
    min-height: 420px;
  }

  /* iOS에서 contenteditable 높이 리셋 방지 */
  .ProseMirror {
    min-height: 360px;
    height: 360px;          /* 모바일에서 height를 명시해야 1줄 현상 방지 */
    overflow-y: auto;       /* 내부 스크롤 허용 */
    -webkit-overflow-scrolling: touch;
    padding-bottom: 120px;  /* 키보드/툴바 여유 */
  }
}

/* iPhone SE 등 초소형 화면 */
@media (max-width: 390px) {
  .editor-wrapper,
  .tiptap-editor,
  .tiptap-editor-wrapper {
    min-height: 360px;
  }

  .ProseMirror {
    min-height: 300px;
    height: 300px;
    padding-bottom: 100px;
  }
}
/* =========================
   TipTap YouTube / iframe Fix
========================= */
.ProseMirror iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  display: block;
  margin: 12px 0;
  border-radius: 8px;
}
