/* static/css/english_formatting.css */

/*
   English Formatting Stylesheet - Dify Compatibility Fix
   This file ensures that the output format is consistent with Dify's rendering,
   primarily by preserving whitespace and line breaks.
*/

.main-answer-content {
    /* 使用 pre-wrap保留换行符和空格，同时允许文本自动换行 */
    white-space: pre-wrap;
    /* 设置一个基础的行高和字体大小 */
    line-height: 1.6;
    font-size: 15px;
    color: #202124;
    /* 确保单词在必要时可以被断开 */
    word-wrap: break-word;
}

/* 覆盖可能影响消息内容 white-space 的其他规则 */
.message.assistant .message-content {
    white-space: normal; /* 允许子元素控制自己的 white-space */
}

/* 确保 pre 和 code 标签的样式正确 */
.main-answer-content pre,
.main-answer-content code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    white-space: pre-wrap; /* 允许代码块内的长行自动换行 */
    word-wrap: break-word;
}

.main-answer-content pre {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid #e8f0fe;
}

.main-answer-content code {
    background: #f8f9fa;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #1a73e8;
    border: 1px solid #e8f0fe;
}

.main-answer-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: inherit;
    font-size: inherit;
}

/* 为标题、列表等元素提供一些基本的边距，以改善可读性 */
.main-answer-content h1,
.main-answer-content h2,
.main-answer-content h3,
.main-answer-content h4,
.main-answer-content h5,
.main-answer-content h6 {
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    font-weight: 600;
    line-height: 1.3;
}

.main-answer-content ul,
.main-answer-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.main-answer-content li {
    margin-bottom: 0.5em;
}

.main-answer-content p {
    margin: 1em 0;
}

.main-answer-content hr {
    border: 0;
    border-top: 1px solid #e8f0fe;
    margin: 1.5em 0;
}
