/* ================================================
   富文本通用样式（后台 TinyMCE 编辑器 + 前台展示共用）
   作用：让编辑器里看到的效果 = 前台最终显示效果
   ================================================ */

.rich-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
    color: #94a3b8;
    line-height: 1.8;
    font-size: 15px;
    word-wrap: break-word;
}

/* ===== 标题 ===== */
.rich-content h1,
.rich-content h2,
.rich-content h3,
.rich-content h4,
.rich-content h5,
.rich-content h6 {
    color: #e5e7eb;
    font-weight: 600;
    margin: 24px 0 12px;
    line-height: 1.4;
}
.rich-content h1 { font-size: 26px; }
.rich-content h2 { font-size: 22px; }
.rich-content h3 { font-size: 18px; }
.rich-content h4 { font-size: 16px; }
.rich-content h5 { font-size: 15px; }
.rich-content h6 { font-size: 14px; }

/* ===== 段落 ===== */
.rich-content p {
    margin: 12px 0;
}

/* ===== 加粗 / 斜体 ===== */
.rich-content strong,
.rich-content b {
    color: #e5e7eb;
    font-weight: 600;
}
.rich-content em,
.rich-content i {
    color: #b0c4de;
}

/* ===== 链接 ===== */
.rich-content a {
    color: #00e5ff;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 229, 255, 0.3);
    transition: all 0.2s;
}
.rich-content a:hover {
    border-bottom-color: #00e5ff;
}

/* ===== 列表 ===== */
.rich-content ul,
.rich-content ol {
    padding-left: 24px;
    margin: 12px 0;
}
.rich-content li {
    margin: 6px 0;
}
.rich-content ul li::marker {
    color: #00e5ff;
}
.rich-content ol li::marker {
    color: #00e5ff;
    font-weight: 600;
}

/* ===== 引用 ===== */
.rich-content blockquote {
    border-left: 3px solid #00e5ff;
    padding: 8px 16px;
    margin: 16px 0;
    background: rgba(0, 229, 255, 0.05);
    color: #94a3b8;
    font-style: italic;
    border-radius: 0 6px 6px 0;
}

/* ===== 行内代码 ===== */
.rich-content code {
    background: rgba(0, 229, 255, 0.1);
    color: #00e5ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px;
}

/* ===== 图片 ===== */
.rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
    display: block;
}

/* ===== 分隔线 ===== */
.rich-content hr {
    border: none;
    border-top: 1px solid rgba(0, 229, 255, 0.15);
    margin: 32px 0;
}


/* ================================================
   表格样式（优化版：更舒展、更接近段落排版）
   ================================================ */
.rich-content table,
body.rich-content table {
    width: 100%;
    border-collapse: collapse !important;
    margin: 24px 0 !important;
    font-size: 15px !important;
    background: transparent !important;
    border: none !important;
}

.rich-content table tr,
body.rich-content table tr {
    border-bottom: 1px solid rgba(0, 229, 255, 0.08) !important;
}
.rich-content table tr:last-child,
body.rich-content table tr:last-child {
    border-bottom: none !important;
}

.rich-content table td,
.rich-content table th,
body.rich-content table td,
body.rich-content table th {
    padding: 6px 0 !important;
    color: #94a3b8 !important;
    line-height: 1.7 !important;
    vertical-align: top !important;
    text-align: left;
    border: none !important;
}

/* 字段名：青色加粗，宽度自适应 */
.rich-content table td:first-child,
body.rich-content table td:first-child {
    width: auto;
    min-width: 0;
    padding-right: 16px;
    color: #00e5ff !important;
    font-weight: 600 !important;
    white-space: normal !important;
}

/* 值：正常颜色 */
.rich-content table td:last-child,
body.rich-content table td:last-child {
    color: #94a3b8 !important;
}

/* 表头（如果有）*/
.rich-content table th,
body.rich-content table th {
    background: transparent !important;
    color: #00e5ff !important;
    font-weight: 600 !important;
    border-bottom: 2px solid rgba(0, 229, 255, 0.2) !important;
}

/* ===== 手机端适配 ===== */
@media (max-width: 768px) {
    .rich-content {
        font-size: 14px;
    }
    .rich-content h1 { font-size: 22px; }
    .rich-content h2 { font-size: 19px; }
    .rich-content h3 { font-size: 17px; }
    .rich-content table {
        font-size: 13px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .rich-content table td:first-child {
        width: auto;
        min-width: 130px;
        white-space: normal;
    }
}

/* ================================================
   以下样式仅作用于 TinyMCE 编辑器
   （通过 body.rich-content 精确匹配编辑器 body）
   前台容器是 div.rich-content，不受影响
   ================================================ */

body.rich-content {
    background: #0a0e1a;
    color: #94a3b8;
    padding: 20px 24px;
    margin: 0;
}

body.rich-content h1,
body.rich-content h2,
body.rich-content h3,
body.rich-content h4 {
    color: #e5e7eb;
}

body.rich-content table td {
    color: #94a3b8;
    border-bottom-color: rgba(0, 229, 255, 0.15);
}

body.rich-content table td:first-child {
    color: #00e5ff;
}

body.rich-content a {
    color: #00e5ff;
}

body.rich-content code {
    background: rgba(0, 229, 255, 0.15);
    color: #00e5ff;
}

/* ===== 修复：防止内容溢出容器，强制换行 ===== */
.rich-content,
.rich-content * {
    max-width: 100%;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

/* 表格：允许单元格内容换行，不撑破容器 */
.rich-content table {
    table-layout: auto;
}
.rich-content table td,
.rich-content table th {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
}

/* 段落：允许换行 */
.rich-content p {
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
}

/* 列表：允许换行，去掉可能的溢出 */
.rich-content ul,
.rich-content ol {
    padding-left: 20px !important;
    margin: 12px 0 !important;
}
.rich-content li {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* 取消滚动条 */
.rich-content {
    overflow-x: hidden !important;
}

/* ============================================================
   无序列表圆点（强制覆盖 CSS reset）
   ============================================================ */
.rich-content ul,
body.rich-content ul {
    list-style: disc outside !important;
    list-style-type: disc !important;
    padding-left: 24px !important;
    margin: 12px 0 !important;
}

.rich-content ul li,
body.rich-content ul li {
    display: list-item !important;
    list-style: disc outside !important;
    margin: 6px 0 !important;
    color: #94a3b8 !important;
}

.rich-content ul li::marker,
body.rich-content ul li::marker {
    color: #00e5ff !important;
    font-size: 1.1em !important;
}

/* 有序列表 */
.rich-content ol,
body.rich-content ol {
    list-style: decimal outside !important;
    padding-left: 24px !important;
    margin: 12px 0 !important;
}
.rich-content ol li,
body.rich-content ol li {
    display: list-item !important;
    color: #94a3b8 !important;
}
.rich-content ol li::marker,
body.rich-content ol li::marker {
    color: #00e5ff !important;
}

/* 万能去横线（兜底） */
.rich-content table,
.rich-content table tr,
.rich-content table tbody,
.rich-content table thead,
.rich-content table td,
.rich-content table th,
body.rich-content table,
body.rich-content table tr,
body.rich-content table tbody,
body.rich-content table thead,
body.rich-content table td,
body.rich-content table th {
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
}


/* ===== 强制列宽自动（覆盖 TinyMCE 内联宽度）===== */
.rich-content table td,
.rich-content table th,
body.rich-content table td,
body.rich-content table th {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}
