/* ========== 核心：和预览的.tox-dialog__body样式完全对齐 ========== */
.rich-text-content {
  color: #222f3e !important; /* 预览的文字颜色 */
  font-size: 16px !important; /* 预览的字体大小 */
  font-style: normal !important;
  font-weight: 400 !important; /* 预览的字体粗细 */
  line-height: 1.3 !important; /* 预览的行高 */
  text-align: left !important;
  text-transform: none !important;
  /* 保留隔离和基础排版 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  padding: 8px 0;
  isolation: isolate;
  min-width: 0; /* 对齐预览的min-width */
}

/* ========== 重置容器内元素 避免主页面样式干扰 ========== */
.rich-text-content * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ========== TinyMCE元素样式（基于16px基准适配） ========== */
/* 段落：基于16px基准，保持和预览一致的间距 */
.rich-text-content p {
  margin: 1em 0 !important;
  text-align: left !important;
}

/* 标题：按预览16px基准等比适配 */
.rich-text-content h1 {
  font-size: 2em !important; /* 32px，和预览16px基准等比 */
  font-weight: bold !important;
  margin: 0.67em 0 !important;
  color: #222f3e !important;
}
.rich-text-content h2 {
  font-size: 1.5em !important; /* 24px */
  font-weight: bold !important;
  margin: 0.83em 0 !important;
  color: #222f3e !important;
}
.rich-text-content h3 {
  font-size: 1.17em !important; /* 18.72px */
  font-weight: bold !important;
  margin: 1em 0 !important;
  color: #222f3e !important;
}
.rich-text-content h4 {
  font-size: 1em !important; /* 16px */
  font-weight: bold !important;
  margin: 1.33em 0 !important;
  color: #222f3e !important;
}
.rich-text-content h5 {
  font-size: 0.83em !important; /* 13.28px */
  font-weight: bold !important;
  margin: 1.67em 0 !important;
  color: #222f3e !important;
}
.rich-text-content h6 {
  font-size: 0.67em !important; /* 10.72px */
  font-weight: bold !important;
  margin: 2.33em 0 !important;
  color: #222f3e !important;
}

/* 列表：基于16px基准适配 */
.rich-text-content ul {
  list-style-type: disc;
  margin: 1em 0 1em 20px !important;
  padding-left: 40px !important;
}
.rich-text-content ol {
  list-style-type: decimal;
  margin: 1em 0 1em 20px !important;
  padding-left: 40px !important;
}
.rich-text-content li {
  margin: 0.5em 0 !important;
}

/* 图片：适配预览基准 */
.rich-text-content img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  margin: 5px 0 !important;
  border: none;
  &.mce-align-left {
    float: left;
    margin-right: 10px !important;
  }
  &.mce-align-right {
    float: right;
    margin-left: 10px !important;
  }
  &.mce-align-center {
    display: block;
    margin: 5px auto !important;
  }
}

/* 链接：适配预览文字颜色 */
.rich-text-content a {
  color: #0066cc !important;
  text-decoration: underline !important;
  cursor: pointer;
}
.rich-text-content a:hover {
  color: #004799 !important;
  text-decoration: none !important;
}

/* 表格：适配预览基准 */
.rich-text-content table {
  border-collapse: collapse;
  border-spacing: 0;
  margin: 1em 0 !important;
  width: auto !important;
}
.rich-text-content td, .rich-text-content th {
  border: 1px solid #ccc !important;
  padding: 6px 10px !important;
  text-align: left !important;
}
.rich-text-content th {
  background-color: #f2f2f2 !important;
  font-weight: bold !important;
}

/* 引用：适配预览文字颜色 */
.rich-text-content blockquote {
  border-left: 3px solid #ccc !important;
  margin: 1em 0 !important;
  padding: 0.5em 10px !important;
  color: #222f3e !important; /* 对齐预览文字颜色 */
  font-style: italic !important;
}

/* 代码块：适配16px基准 */
.rich-text-content pre {
  background-color: #f5f5f5 !important;
  border: 1px solid #ccc !important;
  border-radius: 3px !important;
  padding: 10px !important;
  margin: 1em 0 !important;
  font-family: Consolas, Monaco, "Courier New", monospace !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
  overflow-x: auto !important;
  white-space: pre !important;
}
.rich-text-content code {
  background-color: #f5f5f5 !important;
  padding: 2px 4px !important;
  border-radius: 3px !important;
  font-family: Consolas, Monaco, "Courier New", monospace !important;
  font-size: 13px !important;
  color: #d14 !important;
}
/* 移动端适配 TinyMCE 富文本 */
@media (max-width: 768px) {
  .rich-text-content {
    font-size: 13px;
  }
  .rich-text-content ul, .rich-text-content ol {
    padding-left: 20px;
    margin-left: 10px;
  }
  .rich-text-content table {
    width: 100%; /* 移动端表格自适应 */
  }
}
