/* 对话显示样式 */
.conversation-display {
    margin-top: 1rem;
}

.message-item {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.user-message {
    background-color: #e3f2fd;
    border-left-color: var(--primary-color);
}

.assistant-message {
    background-color: #f5f5f5;
    border-left-color: var(--success-color);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.message-header strong {
    color: var(--dark-text);
}

.message-status {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.message-content {
    color: var(--dark-text);
    line-height: 1.6;
}

.message-content p {
    margin: 0.5rem 0;
}

.file-attachment {
    background-color: white;
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
}

.file-attachment a {
    color: var(--primary-color);
    text-decoration: none;
}

.file-attachment a:hover {
    text-decoration: underline;
}

.conversation-stats {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
}


/* =====================================================
   Markdown 渲染样式（覆盖 Tailwind CSS Reset）
   适用于 .prose, .prose-sm 类容器
   ===================================================== */

/* 基础排版 */
.prose,
.prose-sm {
    color: #374151;
    line-height: 1.75;
    font-size: 0.9375rem;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* 段落 */
.prose p,
.prose-sm p {
    margin-top: 0.75em;
    margin-bottom: 0.75em;
}

.prose p:first-child,
.prose-sm p:first-child {
    margin-top: 0;
}

.prose p:last-child,
.prose-sm p:last-child {
    margin-bottom: 0;
}

/* 标题 */
.prose h1,
.prose-sm h1 {
    font-size: 1.5em;
    font-weight: 700;
    color: #111827;
    margin-top: 1.2em;
    margin-bottom: 0.5em;
    line-height: 1.3;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.3em;
}

.prose h2,
.prose-sm h2 {
    font-size: 1.25em;
    font-weight: 700;
    color: #1f2937;
    margin-top: 1.2em;
    margin-bottom: 0.5em;
    line-height: 1.35;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.25em;
}

.prose h3,
.prose-sm h3 {
    font-size: 1.1em;
    font-weight: 600;
    color: #374151;
    margin-top: 1em;
    margin-bottom: 0.4em;
    line-height: 1.4;
}

.prose h4,
.prose-sm h4 {
    font-size: 1em;
    font-weight: 600;
    color: #4b5563;
    margin-top: 0.8em;
    margin-bottom: 0.3em;
}

.prose h5,
.prose h6,
.prose-sm h5,
.prose-sm h6 {
    font-size: 0.95em;
    font-weight: 600;
    color: #6b7280;
    margin-top: 0.8em;
    margin-bottom: 0.3em;
}

/* 列表 */
.prose ul,
.prose-sm ul {
    list-style-type: disc;
    padding-left: 1.625em;
    margin-top: 0.5em;
    margin-bottom: 0.75em;
}

.prose ol,
.prose-sm ol {
    list-style-type: decimal;
    padding-left: 1.625em;
    margin-top: 0.5em;
    margin-bottom: 0.75em;
}

.prose li,
.prose-sm li {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
    padding-left: 0.375em;
}

.prose li > p,
.prose-sm li > p {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}

.prose ul ul,
.prose ol ul,
.prose ul ol,
.prose ol ol,
.prose-sm ul ul,
.prose-sm ol ul,
.prose-sm ul ol,
.prose-sm ol ol {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}

/* 粗体 / 斜体 */
.prose strong,
.prose-sm strong {
    font-weight: 700;
    color: #111827;
}

.prose em,
.prose-sm em {
    font-style: italic;
}

/* 行内代码 */
.prose code,
.prose-sm code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875em;
    background-color: #f3f4f6;
    color: #e11d48;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    word-break: break-all;
}

/* 代码块 */
.prose pre,
.prose-sm pre {
    background-color: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 1em 1.25em;
    overflow-x: auto;
    margin-top: 0.75em;
    margin-bottom: 0.75em;
    font-size: 0.875em;
    line-height: 1.6;
    border: 1px solid #334155;
}

.prose pre code,
.prose-sm pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: inherit;
    word-break: normal;
}

/* 引用块 */
.prose blockquote,
.prose-sm blockquote {
    border-left: 4px solid #6366f1;
    padding: 0.5em 1em;
    margin: 0.75em 0;
    background-color: #f5f3ff;
    border-radius: 0 6px 6px 0;
    color: #4b5563;
    font-style: italic;
}

.prose blockquote p,
.prose-sm blockquote p {
    margin: 0;
}

/* 水平分割线 */
.prose hr,
.prose-sm hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 1.25em 0;
}

/* 链接 */
.prose a,
.prose-sm a {
    color: #4f46e5;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}

.prose a:hover,
.prose-sm a:hover {
    color: #4338ca;
}

/* 表格 */
.prose table,
.prose-sm table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75em 0;
    font-size: 0.875em;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.prose thead,
.prose-sm thead {
    background-color: #f9fafb;
}

.prose th,
.prose-sm th {
    padding: 0.6em 0.9em;
    font-weight: 600;
    text-align: left;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
}

.prose td,
.prose-sm td {
    padding: 0.5em 0.9em;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    color: #4b5563;
}

.prose tr:last-child td,
.prose-sm tr:last-child td {
    border-bottom: none;
}

.prose th:last-child,
.prose td:last-child,
.prose-sm th:last-child,
.prose-sm td:last-child {
    border-right: none;
}

.prose tbody tr:nth-child(even),
.prose-sm tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

/* 图片 */
.prose img,
.prose-sm img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5em 0;
}

/* 任务列表（GFM checkbox） */
.prose input[type="checkbox"],
.prose-sm input[type="checkbox"] {
    margin-right: 0.4em;
    accent-color: #4f46e5;
}

/* 首个子元素去除顶部间距 */
.prose > *:first-child,
.prose-sm > *:first-child {
    margin-top: 0;
}

.prose > *:last-child,
.prose-sm > *:last-child {
    margin-bottom: 0;
}
