/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* 설계기준 본문 줄바꿈 보존 */
.codedocs-content {
  white-space: pre-line;
}

/* 설계기준 HTML 표 스타일 (AI 파싱 결과) */
.codedocs-content table.codedocs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.codedocs-content table.codedocs-table th,
.codedocs-content table.codedocs-table td {
  border: 1px solid #e2e8f0;
  padding: 0.5rem 0.75rem;
  text-align: center;
  vertical-align: middle;
}

.codedocs-content table.codedocs-table thead th {
  background-color: #f1f5f9;
  font-weight: 600;
  color: #334155;
}

.codedocs-content table.codedocs-table tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

.codedocs-content table.codedocs-table tbody tr:hover {
  background-color: #f1f5f9;
}

/* 미리보기 패널의 HTML 표 (에디터) */
table.codedocs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  line-height: 1.5;
}

table.codedocs-table th,
table.codedocs-table td {
  border: 1px solid #e2e8f0;
  padding: 0.375rem 0.625rem;
  text-align: center;
  vertical-align: middle;
}

table.codedocs-table thead th {
  background-color: #f1f5f9;
  font-weight: 600;
  color: #334155;
}

/* 테이블 그리드 에디터 — 셀 선택 */
td.selected, th.selected {
  outline: 2px solid #0d9488 !important;
  outline-offset: -2px;
  background-color: #ccfbf1 !important;
}

/* ═══ 비주얼 편집 모드 ═══ */
.codedocs-visual-editor .visual-article {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e40af;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #dbeafe;
  outline: none;
  cursor: text;
}

.codedocs-visual-editor .visual-paragraph {
  padding-left: 0.75rem;
  border-left: 2px solid #7dd3fc;
  margin: 0.25rem 0;
  font-size: 0.875rem;
  color: #374151;
  outline: none;
  cursor: text;
}

.codedocs-visual-editor .visual-item {
  padding-left: 2rem;
  font-size: 0.875rem;
  color: #4b5563;
  margin: 0.125rem 0;
  outline: none;
  cursor: text;
}

.codedocs-visual-editor .visual-subitem {
  padding-left: 3.5rem;
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 0.125rem 0;
  outline: none;
  cursor: text;
}

.codedocs-visual-editor .visual-text {
  font-size: 0.875rem;
  color: #4b5563;
  margin: 0.125rem 0;
  outline: none;
  cursor: text;
}

.codedocs-visual-editor .visual-blank {
  height: 0.5rem;
}

.codedocs-visual-editor [contenteditable]:focus {
  background-color: #eff6ff;
  border-radius: 0.25rem;
}

.codedocs-visual-editor .visual-table-wrapper {
  margin: 0.75rem 0;
  overflow-x: auto;
}

.codedocs-visual-editor .visual-editable-table td:focus,
.codedocs-visual-editor .visual-editable-table th:focus {
  background-color: #f0fdfa;
  outline: 2px solid #14b8a6;
  outline-offset: -2px;
}

/* ═══ Tiptap 에디터 ═══ */
.tiptap-editor {
  min-height: 400px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  outline: none;
}

.tiptap-editor:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.3);
}

.tiptap-editor table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  table-layout: fixed;
}

.tiptap-editor th,
.tiptap-editor td {
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  min-width: 80px;
  text-align: center;
  vertical-align: middle;
  position: relative;
  box-sizing: border-box;
}

.tiptap-editor th p,
.tiptap-editor td p {
  text-align: inherit;
}

.tiptap-editor th {
  background: #f8fafc;
  font-weight: 600;
}

.tiptap-editor .selectedCell {
  background: #dbeafe;
}

.tiptap-editor .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #93c5fd;
  cursor: col-resize;
  pointer-events: none;
}

.tiptap-editor p { margin: 0.25rem 0; }
.tiptap-editor h1, .tiptap-editor h2, .tiptap-editor h3 {
  font-weight: 600;
  margin: 0.75rem 0 0.25rem;
}
.tiptap-editor ul, .tiptap-editor ol {
  padding-left: 1.5rem;
  margin: 0.25rem 0;
}

.tableWrapper {
  overflow-x: auto;
}

/* ─── Tiptap 법령 문서 커스텀 노드 ─── */
.tiptap-editor .legal-article {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e40af;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #dbeafe;
  outline: none;
  cursor: text;
}

.tiptap-editor .legal-paragraph {
  padding-left: 0.75rem;
  border-left: 2px solid #7dd3fc;
  margin: 0.5rem 0;
  font-size: 0.875rem;
  color: #374151;
  outline: none;
  cursor: text;
}

.tiptap-editor .legal-item {
  padding-left: 2rem;
  font-size: 0.875rem;
  color: #4b5563;
  margin: 0.25rem 0;
  outline: none;
  cursor: text;
}

.tiptap-editor .legal-subitem {
  padding-left: 3.5rem;
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 0.25rem 0;
  outline: none;
  cursor: text;
}

.tiptap-editor .legal-article:focus,
.tiptap-editor .legal-paragraph:focus,
.tiptap-editor .legal-item:focus,
.tiptap-editor .legal-subitem:focus {
  background-color: #eff6ff;
  border-radius: 0.25rem;
}
