/* Tiptap 에디터 스타일링 */
.ProseMirror {
  outline: none;
  /* line-height: 1.6; */
}

.ProseMirror p {
  margin: 0.5rem 0;
  font-weight: 400;
}

.ProseMirror strong,
.ProseMirror b {
  font-weight: 700;
}

.ProseMirror em,
.ProseMirror i {
  font-style: italic;
}

.ProseMirror u {
  text-decoration: underline;
}

.ProseMirror s {
  text-decoration: line-through;
}

.ProseMirror h1 {
  font-size: 32px;
  font-weight: bold;
  line-height: 1.2;
  margin-bottom: 16px;
}

.ProseMirror h2 {
  font-size: 28px;
  font-weight: bold;
  line-height: 1.3;
  margin-bottom: 16px;
}

.ProseMirror h3 {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 16px;
}

.ProseMirror ul,
.ProseMirror ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.ProseMirror ul {
  margin-left: 1rem;
}

.ProseMirror li {
  margin: 0.2rem 0;
}

/* 커스텀 정렬 클래스 */
.ProseMirror p.text-align-left,
.ProseMirror h1.text-align-left,
.ProseMirror h2.text-align-left,
.ProseMirror h3.text-align-left {
  text-align: left;
}

.ProseMirror p.text-align-center,
.ProseMirror h1.text-align-center,
.ProseMirror h2.text-align-center,
.ProseMirror h3.text-align-center {
  text-align: center;
}

.ProseMirror p.text-align-right,
.ProseMirror h1.text-align-right,
.ProseMirror h2.text-align-right,
.ProseMirror h3.text-align-right {
  text-align: right;
}

.ProseMirror p.text-align-justify,
.ProseMirror h1.text-align-justify,
.ProseMirror h2.text-align-justify,
.ProseMirror h3.text-align-justify {
  text-align: justify;
}

/* 우측 정렬된 리스트 아이템 스타일 개선 */
.ProseMirror ul li {
  position: relative;
}

.ProseMirror ul li p.text-align-right {
  position: relative;
  display: inline-block;
  width: auto;
  max-width: calc(100% - 1.5rem);
  margin-left: 1.5rem;
  margin-right: 0;
  text-align: right;
}

.ProseMirror ul li p.text-align-right::before {
  content: "•";
  color: #ef4444;
  font-weight: bold;
  position: absolute;
  left: -1.5rem;
  top: 0;
  line-height: 1.6;
  width: 1rem;
  text-align: left;
}

.ProseMirror blockquote {
  border-left: 4px solid #e5e7eb;
  padding-left: 1rem;
  margin: 1rem 0;
  font-style: italic;
  color: #6b7280;
}

.ProseMirror code {
  background-color: #f3f4f6;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-family: "Courier New", monospace;
  font-size: 0.875rem;
}

.ProseMirror pre {
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.ProseMirror pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

.ProseMirror a {
  color: #3b82f6;
  text-decoration: underline;
}

.ProseMirror a:hover {
  color: #1d4ed8;
}

.ProseMirror table {
  border-collapse: collapse;
  margin: 1rem 0;
  width: 100%;
}

.ProseMirror th,
.ProseMirror td {
  border: 1px solid #d1d5db;
  padding: 0.5rem;
  text-align: left;
}

.ProseMirror th {
  background-color: #f9fafb;
  font-weight: bold;
}

.ProseMirror img {
  max-width: 100% !important;
  height: auto;
  border-radius: 0.5rem;
  margin: 0.5rem 0;
}

/* 테이블 리사이즈 핸들 */
.ProseMirror table .selectedCell:after {
  z-index: 2;
  position: absolute;
  content: "";
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(200, 200, 255, 0.4);
  pointer-events: none;
}

.ProseMirror .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: -2px;
  width: 4px;
  background-color: #3b82f6;
  pointer-events: none;
}

/* 선택된 텍스트 스타일 */
.ProseMirror .selectedCell {
  background-color: rgba(200, 200, 255, 0.2);
}

/* 툴바 버튼 호버 효과 */
.toolbar-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 에디터 포커스 상태 */
.ProseMirror:focus {
  outline: none;
}

/* 플레이스홀더 스타일 */
.ProseMirror p.is-editor-empty:first-child::before {
  color: #9ca3af;
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
}

/* 링크 입력 모달 스타일 */
.link-input-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.link-input-modal input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  margin-bottom: 1rem;
}

.link-input-modal button {
  background-color: #3b82f6;
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  margin-right: 0.5rem;
}

.link-input-modal button:hover {
  background-color: #1d4ed8;
}

/* 들여쓰기 스타일 - 공백 방식 */
.ProseMirror p,
.ProseMirror h1,
.ProseMirror h2,
.ProseMirror h3 {
  white-space: pre-wrap;
}

/* 들여쓰기 공백 스타일링 */
.ProseMirror p span.indent,
.ProseMirror h1 span.indent,
.ProseMirror h2 span.indent,
.ProseMirror h3 span.indent {
  color: transparent;
  user-select: none;
  pointer-events: none;
  display: inline-block;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* 들여쓰기 레벨별 스타일 (백업용) */
.ProseMirror .indent-1 {
  margin-left: 1em;
}

.ProseMirror .indent-2 {
  margin-left: 2em;
}

.ProseMirror .indent-3 {
  margin-left: 3em;
}

.ProseMirror .indent-4 {
  margin-left: 4em;
}

.tiptap strong,
b,
em,
i {
  color: inherit !important;
}

.ProseMirror p:empty::before {
  content: "\00a0"; /* 빈 공백 (non-breaking space) */
  display: inline-block;
}

.ProseMirror ol {
  list-style-type: decimal; /* list-decimal */
  padding-left: 1rem; /* pl-mo-p-lg (모바일) */
  font-family: sans-serif; /* marker:font-sans */
  font-weight: 600; /* marker:font-semibold */
  font-size: 1rem; /* marker:text-mo-fs-16 */
}

.ProseMirror ol > li {
  position: relative; /* relative */
}

.ProseMirror ul {
  list-style-type: disc; /* list-disc */
  padding-left: 0.75rem; /* pl-mo-p-md (모바일 기준) */
}
.ProseMirror p:empty {
  height: 40px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .ProseMirror h1 {
    font-size: 28px;
    margin-bottom: 14px;
  }

  .ProseMirror h2 {
    font-size: 24px;
    margin-bottom: 14px;
  }

  .ProseMirror h3 {
    font-size: 20px;
    margin-bottom: 14px;
  }
  .ProseMirror ul {
    padding-left: 0.75rem; /* md:pl-mo-p-md */
  }

  .ProseMirror ol {
    padding-left: 1rem; /* md:pl-mo-p-lg */
    font-size: 1rem; /* md:marker:text-fs-16 */
  }
  .ProseMirror p {
    font-size: 14px;
  }
}

/* 

1024 테이블 때문에 추가 
*****
tiptap table docs url
https://tiptap.dev/docs/editor/extensions/functionality/table-kit#nodes
*****
*/
/* Basic editor styles */
.tiptap {
  /* Table-specific styling */
}
.tiptap :first-child {
  margin-top: 0;
}
.tiptap table {
  border-collapse: collapse;
  margin: 0;
  overflow: hidden;
  table-layout: fixed;
  width: 100%;
}
.tiptap table td,
.tiptap table th {
  border: 1px solid #e0e0e0;
  box-sizing: border-box;
  min-width: 1em;
  padding: 6px 8px;
  position: relative;
  vertical-align: top;
}
.tiptap table td > *,
.tiptap table th > * {
  margin-bottom: 0;
}
.tiptap table th {
  background-color: #f5f5f5;
  font-weight: bold;
  text-align: left;
}
.tiptap table .selectedCell:after {
  background: #e0e0e0;
  content: "";
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}
.tiptap table .column-resize-handle {
  background-color: #663399;
  bottom: -2px;
  pointer-events: none;
  position: absolute;
  right: -2px;
  top: 0;
  width: 4px;
}
.tiptap .tableWrapper {
  margin: 1.5rem 0;
  overflow-x: auto;
}
.tiptap.resize-cursor {
  cursor: ew-resize;
  cursor: col-resize;
}
