/* ============================================
 * 统一富文本排版样式
 * 作用域类：.rich-text-content
 * 用于 TinyMCE 编辑器 content_css 和前端展示页面
 * ============================================ */

/* 基础排版 */
.rich-text-content {
  font-size: 14px;
  line-height: 1.8;
  color: #333;
  word-wrap: break-word;
}

/* 标题 h1-h6：层级递减，带适当间距 */
.rich-text-content h1 { font-size: 28px; font-weight: bold; margin: 20px 0 10px; }
.rich-text-content h2 { font-size: 24px; font-weight: bold; margin: 18px 0 10px; }
.rich-text-content h3 { font-size: 20px; font-weight: bold; margin: 16px 0 8px; }
.rich-text-content h4 { font-size: 18px; font-weight: bold; margin: 14px 0 8px; }
.rich-text-content h5 { font-size: 16px; font-weight: bold; margin: 12px 0 6px; }
.rich-text-content h6 { font-size: 14px; font-weight: bold; margin: 10px 0 6px; }

/* 段落与文本 */
.rich-text-content p { margin: 0 0 10px; line-height: 1.8; }

/* 列表 */
.rich-text-content ul, .rich-text-content ol { padding-left: 30px; margin: 10px 0; }
.rich-text-content ul { list-style-type: disc; }
.rich-text-content ol { list-style-type: decimal; }
.rich-text-content li { margin: 4px 0; line-height: 1.8; }

/* 引用 */
.rich-text-content blockquote { border-left: 4px solid #ddd; padding: 10px 15px; margin: 10px 0; color: #666; background: #f9f9f9; }

/* 表格：带边框和基础美化 */
.rich-text-content table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.rich-text-content table td, .rich-text-content table th { border: 1px solid #ddd; padding: 8px 12px; text-align: left; }
.rich-text-content table th { background: #f5f5f5; font-weight: bold; }
.rich-text-content table tr:nth-child(even) { background: #fafafa; }

/* 图片与媒体 */
.rich-text-content img { max-width: 100%; height: auto; }
.rich-text-content video { max-width: 100%; }

/* 分隔线 */
.rich-text-content hr { border: none; border-top: 1px solid #eee; margin: 20px 0; }

/* 链接 */
.rich-text-content a { color: #294a9f; text-decoration: none; }
.rich-text-content a:hover { text-decoration: underline; }

/* 代码 */
.rich-text-content pre { background: #f5f5f5; padding: 12px; border-radius: 4px; overflow-x: auto; margin: 10px 0; }
.rich-text-content code { background: #f5f5f5; padding: 2px 6px; border-radius: 3px; font-size: 13px; }
.rich-text-content pre code { background: none; padding: 0; }

/* 对齐辅助 */
.rich-text-content .align-left { text-align: left; }
.rich-text-content .align-center { text-align: center; }
.rich-text-content .align-right { text-align: right; }

/* ========== 移动端适配 ========== */
@media screen and (max-width: 768px) {
  /* 基础字号缩小 */
  .rich-text-content { font-size: 13px; line-height: 1.7; }

  /* 标题缩小，减少间距 */
  .rich-text-content h1 { font-size: 22px; margin: 14px 0 8px; }
  .rich-text-content h2 { font-size: 19px; margin: 12px 0 8px; }
  .rich-text-content h3 { font-size: 17px; margin: 10px 0 6px; }
  .rich-text-content h4 { font-size: 15px; margin: 10px 0 6px; }
  .rich-text-content h5 { font-size: 14px; margin: 8px 0 4px; }
  .rich-text-content h6 { font-size: 13px; margin: 8px 0 4px; }

  /* 段落间距收紧 */
  .rich-text-content p { margin: 0 0 8px; }

  /* 列表缩进减小 */
  .rich-text-content ul, .rich-text-content ol { padding-left: 20px; margin: 6px 0; }
  .rich-text-content li { margin: 2px 0; }

  /* 引用块收窄 */
  .rich-text-content blockquote { padding: 8px 10px; margin: 8px 0; }

  /* 表格单元格间距减小，防止溢出 */
  .rich-text-content table { font-size: 12px; }
  .rich-text-content table td,
  .rich-text-content table th { padding: 5px 8px; }

  /* 表格横向滚动（防止宽表格撑破页面） */
  .rich-text-content .table-responsive,
  .rich-text-content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

  /* 代码块适配 */
  .rich-text-content pre { padding: 8px; font-size: 12px; }
  .rich-text-content code { font-size: 12px; }

  /* 分隔线间距 */
  .rich-text-content hr { margin: 12px 0; }
}
