/**
 * AI 聊天样式 & Markdown 渲染
 * 用于后台 AI 助手对话界面和设置页面
 */

/* ============ AI 聊天模态框 ============ */
#chat-box {
    border: 1px solid #e3e6f0;
    border-radius: 8px;
    background: #f8f9fc;
    scroll-behavior: smooth;
}

#chat-box .ai-chat-message {
    margin: 8px 0;
}

#chat-box .ai-answer-wrap {
    background: #fff;
    border-left: 3px solid #4e73df;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    margin: 5px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#chat-box .ai-answer-content {
    font-size: 14px;
    line-height: 1.7;
    color: #333;
}

/* 思考过程折叠区 */
#chat-box .ai-thought-wrap {
    margin: 5px 0;
}

#chat-box .ai-thought-content {
    background: #eff6ff;
    border: 1px dashed #93c5fd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: #6b7280;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 欢迎引导区 */
#empty-chat-guide {
    line-height: 1.8;
}

#empty-chat-guide .chat-example-suggest {
    transition: all 0.2s;
    padding: 6px 10px;
    border-radius: 6px;
}

#empty-chat-guide .chat-example-suggest:hover {
    background: #e8f0fe;
    color: #4e73df;
}

/* 输入框区域 */
#chat-input {
    resize: none;
    overflow: hidden;
    min-height: 40px;
    max-height: 200px;
    font-size: 14px;
}

#send-btn {
    min-width: 60px;
    transition: all 0.2s;
}

/* 工具调用卡片 */
.ai-chat-message .card {
    border-radius: 8px;
    font-size: 13px;
}

.ai-chat-message .card .status-badge {
    font-size: 12px;
}

.ai-chat-message .table-responsive {
    max-height: 300px;
    overflow-y: auto;
}

.ai-chat-message .table td,
.ai-chat-message .table th {
    font-size: 12px;
    padding: 4px 8px;
    white-space: nowrap;
}

/* ============ Markdown 渲染样式 ============ */
.markdown {
    overflow-wrap: break-word;
    text-align: justify;
}

.markdown h1 {
    font-size: 1.5rem !important;
    margin-top: 0.8em;
    margin-bottom: 12px;
    font-weight: bold;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
    line-height: 1.4;
}

.markdown h2 {
    font-size: 1.3rem !important;
    margin-top: 0.8em;
    margin-bottom: 12px;
    font-weight: bold;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
    line-height: 1.4;
}

.markdown h3 {
    font-size: 1.15rem !important;
    margin-top: 0.6em;
    margin-bottom: 10px;
    font-weight: bold;
    line-height: 1.4;
}

.markdown h4, .markdown h5, .markdown h6 {
    font-size: 1rem !important;
    font-weight: bold;
    margin-top: 0.5em;
    margin-bottom: 8px;
}

.markdown p {
    margin-bottom: 8px;
}

.markdown strong {
    font-weight: bold;
}

.markdown del {
    text-decoration: line-through;
}

.markdown a {
    text-decoration: underline;
    color: #4e73df;
}

.markdown blockquote {
    color: #666;
    border-left: 4px solid #ddd;
    padding-left: 16px;
    font-size: 14px;
    font-style: italic;
    margin: 8px 0;
}

.markdown ul, .markdown ol {
    padding-left: 2em;
    margin-bottom: 12px;
}

.markdown li {
    font-size: 14px !important;
    line-height: 1.8;
}

.markdown hr {
    height: 1px;
    border: none;
    border-top: 1px solid #e3e6f0;
    margin: 12px 0;
}

.markdown pre {
    padding: 12px;
    border: 1px solid #e3e6f0;
    background: #f6f8fa;
    border-radius: 6px;
    overflow: auto;
    font-size: 13px;
    line-height: 1.5;
    margin: 10px 0;
}

.markdown code {
    background: #f0f0f0;
    border-radius: 3px;
    font-size: 13px;
    padding: 2px 5px;
    color: #e83e8c;
    font-family: 'Courier New', Courier, monospace;
}

.markdown pre code {
    background: none;
    padding: 0;
    color: #333;
}

.markdown table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 13px;
}

.markdown thead tr {
    background-color: #f6f8fa;
}

.markdown td, .markdown th {
    padding: 6px 12px;
    border: 1px solid #e3e6f0;
    text-align: left;
}

.markdown table tr:nth-child(even) {
    background: #fafbfc;
}

.markdown img {
    max-width: 100%;
    display: block;
    margin: 8px auto;
    border-radius: 4px;
}

/* ============ 模型卡片 ============ */
.model-card {
    transition: all 0.2s;
    border-radius: 10px;
}

.model-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* ============ 图片生成结果 ============ */
#image-result img {
    max-width: 100%;
    border-radius: 8px;
}
