/* ============================================================
   简法文书 v2.0 — 编辑器样式 (editor.css)
   EasyMDE主题覆盖、A4预览容器样式
   ============================================================ */

/* ---------- EasyMDE Overrides ---------- */
.EasyMDEContainer {
  height: 100%;
  border: none !important;
  border-radius: 0;
}

.EasyMDEContainer .CodeMirror {
  height: 100%;
  min-height: 100%;
  font-family: var(--jw-font-mono);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--jw-text);
  background: var(--jw-bg);
  border: none;
  border-radius: 0;
  padding: 12px;
}

.EasyMDEContainer .CodeMirror-cursor {
  border-left-color: var(--jw-primary);
}

.EasyMDEContainer .CodeMirror-selected {
  background: rgba(26, 115, 232, 0.15) !important;
}

/* EasyMDE toolbar overrides */
.editor-toolbar {
  border: none !important;
  border-bottom: 1px solid var(--jw-border) !important;
  background: var(--jw-gray-50) !important;
  padding: 4px 6px !important;
  border-radius: 0 !important;
  opacity: 1 !important;
}

.editor-toolbar button {
  color: var(--jw-text-secondary) !important;
  border-radius: var(--jw-radius-sm) !important;
  transition: all var(--jw-transition);
}

.editor-toolbar button:hover {
  background: var(--jw-gray-200) !important;
  color: var(--jw-text) !important;
}

.editor-toolbar button.active {
  background: var(--jw-primary-light) !important;
  color: var(--jw-primary) !important;
}

.editor-toolbar i.separator {
  border-left: 1px solid var(--jw-gray-300) !important;
  margin: 0 4px !important;
}

/* EasyMDE status bar */
.editor-statusbar {
  border-top: 1px solid var(--jw-border) !important;
  background: var(--jw-gray-50) !important;
  color: var(--jw-text-muted) !important;
  font-size: 0.75rem !important;
  padding: 4px 12px !important;
}

/* Preview mode */
.editor-preview {
  background: var(--jw-bg) !important;
  padding: 20px !important;
}

.editor-preview h1, .editor-preview h2, .editor-preview h3 {
  color: var(--jw-text);
  border-bottom: none;
}

.editor-preview h1 { font-size: 1.6rem; text-align: center; }
.editor-preview h2 { font-size: 1.3rem; }
.editor-preview h3 { font-size: 1.1rem; }

.editor-preview p {
  margin: 0.8em 0;
  text-indent: 2em;
}

.editor-preview strong {
  font-weight: 600;
}

/* ---------- A4 Preview Container ---------- */
.jw-a4-preview {
  width: 210mm;
  min-height: 297mm;
  margin: 20px auto;
  padding: 25mm 20mm 20mm 20mm;
  background: var(--jw-bg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
  font-family: "SimSun", "宋体", "KaiTi", "楷体", "FangSong", "仿宋", serif;
  font-size: 14px;
  line-height: 2;
  color: var(--jw-text);
}

.jw-a4-preview h1 {
  text-align: center;
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 24px;
}

.jw-a4-preview h2 {
  font-size: 16px;
  font-weight: bold;
  margin: 16px 0 8px;
}

.jw-a4-preview h3 {
  font-size: 15px;
  font-weight: bold;
  margin: 12px 0 6px;
}

.jw-a4-preview p {
  text-indent: 2em;
  margin: 0.5em 0;
}

.jw-a4-preview strong {
  font-weight: bold;
}

/* ---------- Floating Toolbar Styling ---------- */
.jw-float-toolbar {
  background: var(--jw-bg);
  border: 1px solid var(--jw-border);
  border-radius: var(--jw-radius);
  box-shadow: var(--jw-shadow-lg);
  padding: 4px;
  display: none;
  gap: 2px;
  position: absolute;
  z-index: 1000;
}

.jw-float-toolbar--visible {
  display: flex;
}

.jw-float-toolbar .jw-btn {
  font-size: 0.75rem;
  padding: 5px 10px;
  white-space: nowrap;
}

/* ---------- Editor Empty State ---------- */
.jw-editor-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--jw-text-muted);
  text-align: center;
  padding: 40px;
}

.jw-editor-empty i {
  font-size: 4rem;
  opacity: 0.2;
  margin-bottom: 16px;
}

.jw-editor-empty__title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--jw-text-secondary);
  margin-bottom: 8px;
}

.jw-editor-empty__desc {
  font-size: 0.85rem;
  max-width: 320px;
  line-height: 1.5;
}

/* ---------- Generate Progress Bar ---------- */
.jw-generate-progress {
  padding: 16px 20px;
  text-align: center;
}

.jw-generate-progress__label {
  font-size: 0.85rem;
  color: var(--jw-text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ---------- Responsive: A4 预览移动端 ---------- */
@media (max-width: 767px) {
  .jw-a4-preview {
    width: 100%;
    min-height: auto;
    margin: 10px 0;
    padding: 15mm 10mm 10mm 10mm;
    box-shadow: none;
    font-size: 11pt;
  }
}
