/* 1. UEditor 内容隔离容器：重置默认样式 + 继承 UEditor 原生样式 */
.ueditor-content {
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif; /* 与 UEditor 后台字体一致 */
    line-height: 1.8; /* UEditor 默认行高 */
    color: #333; /* UEditor 默认文字颜色 */
    font-size: 16px; /* 与后台编辑时一致，可根据需求调整 */
    padding: 15px 0;
}

/* 2. 重置容器内所有标签的默认样式（清除前台全局样式影响） */
.ueditor-content * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* 关键：取消继承前台的 text-align、line-height 等样式 */
    text-align: inherit;
    line-height: inherit;
    font-size: inherit;
    color: inherit;
}

/* 3. 还原 UEditor 核心标签样式（与后台编辑时一致） */ /* UEditor 默认段落间距 */
.ueditor-content p {
    margin: 0 0 0em 0;
}

.ueditor-content h1 {
    font-size: 2em;
    margin: 0.67em 0;
    font-weight: bold;
}

.ueditor-content h2 {
    font-size: 1.5em;
    margin: 0.83em 0;
    font-weight: bold;
}

.ueditor-content h3 {
    font-size: 1.17em;
    margin: 1em 0;
    font-weight: bold;
}

.ueditor-content h4, .ueditor-content h5, .ueditor-content h6 {
    font-size: 1em;
    margin: 1.33em 0;
    font-weight: bold;
}

.ueditor-content strong, .ueditor-content b {
    font-weight: bold;
}

.ueditor-content em, .ueditor-content i {
    font-style: italic;
}

.ueditor-content u {
    text-decoration: underline;
}

.ueditor-content strike {
    text-decoration: line-through;
}

/* 4. 列表样式还原 */
.ueditor-content ul, .ueditor-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.ueditor-content ul {
    list-style-type: disc;
}

.ueditor-content ol {
    list-style-type: decimal;
}

.ueditor-content li {
    margin: 0.5em 0;
}

/* 5. 图片样式：自适应 + 保留后台设置的尺寸/对齐方式 */
.ueditor-content img {
    max-width: 100% !important; /* 关键：图片自适应容器宽度，避免溢出 */
    height: auto !important; /* 保持宽高比 */
    vertical-align: middle;
    /* 保留 UEditor 后台设置的对齐方式（left/center/right） */
    display: inline-block;
    margin: 0px auto;
}

/* 处理 UEditor 图片对齐的 inline-block 问题 */
.ueditor-content .aligncenter {
    display: block;
    margin: 0 auto;
}

.ueditor-content .alignleft {
    float: left;
    margin-right: 15px;
}

.ueditor-content .alignright {
    float: right;
    margin-left: 15px;
}

/* 6. 表格样式还原 */
.ueditor-content table {
    border-collapse: collapse;
    border-spacing: 0;
    /* margin: 1em 0; */
    /*width: auto;*/ /* 取消前台可能的 100% 宽度强制 */
}

.ueditor-content table td, .ueditor-content table th {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.ueditor-content table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

/* 7. 代码块样式 */
.ueditor-content pre {
    background-color: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 1em;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9em;
    line-height: 1.5;
}

/* 8. 链接样式 */
.ueditor-content a {
    color: #0066cc;
    text-decoration: underline;
}

.ueditor-content a:hover {
    color: #004499;
    text-decoration: none;
}

/* 9. 清除浮动（处理对齐图片/元素后的布局问题） */
.ueditor-content::after {
    content: "";
    display: table;
    clear: both;
}
