* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

.app-container {
    display: flex;
    height: 100vh;
    background: var(--white);
}

/* ===== 侧边栏样式 ===== */
.sidebar {
    width: 280px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-header i {
    font-size: 1.75rem;
    color: var(--primary-color);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
}

.sidebar-section {
    padding: 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.section-title i {
    font-size: 1rem;
    color: var(--gray-500);
}

/* 模板列表 */
.template-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.template-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 1px solid transparent;
}

.template-item:hover {
    background: var(--gray-50);
    border-color: var(--gray-200);
}

.template-item.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.template-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.template-info {
    flex: 1;
    min-width: 0;
}

.template-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-item.active .template-name {
    color: var(--white);
}

.template-desc {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-item.active .template-desc {
    color: rgba(255, 255, 255, 0.9);
}

.template-actions {
    display: none;
    position: absolute;
    right: 0.5rem;
    background: inherit;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}

.template-item:hover .template-actions {
    display: flex;
    gap: 0.25rem;
}

.template-actions button {
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    transition: all 0.2s;
}

.template-actions button:hover {
    background: var(--gray-100);
    color: var(--gray-800);
    border-color: var(--gray-300);
}

/* 会话列表 */
.session-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.session-item {
    padding: 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.session-item:hover {
    background: var(--gray-50);
    border-color: var(--gray-200);
}

.session-item.active {
    background: var(--primary-color);
    color: var(--white);
}

.session-icon {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.session-item.active .session-icon {
    color: var(--white);
}

/* 按钮样式 */
.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    font-size: 0.813rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-text:hover {
    color: var(--gray-800);
    background: var(--gray-100);
}

/* 系统状态 */
.system-status {
    padding: 1.25rem;
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
    background: var(--gray-50);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.status-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.online {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.offline {
    background: #fee2e2;
    color: #991b1b;
}

/* ===== 主聊天区 ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--white);
}

.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header-info i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.chat-header-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.session-id {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
}

/* 消息列表 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--gray-50);
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

.message.user {
    margin-left: auto;
    flex-direction: row;
}

.message-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
}

.message-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 消息气泡核心样式 */
.message-bubble {
    max-width: 100vh !important;
    max-width: 85%;
    padding: 16px 20px;
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
    line-height: 1.6;
    font-size: 1rem;
    word-break: break-word;
    position: relative;
    background-color: white;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    width: auto;
    min-width: 200px;
    flex-basis: 60%;
    transition: all 0.2s ease;
    margin-bottom: 30px;
    min-width: clamp(200px, 60%, 85%);
}

/* 用户消息气泡样式 */
.message.user .message-bubble {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* 气泡悬停效果 */
.message-bubble:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

/* 消息内容包装器 */
.message-content-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message-bubble-content {
    width: 100%;
    margin-bottom: 8px;
}

/* 内容文本样式 */
.message-bubble-content p {
    margin: 0.4rem 0;
    color: inherit;
}

.message-bubble-content p:first-child {
    margin-top: 0;
}

.message-bubble-content p:last-child {
    margin-bottom: 0;
}

/* 操作按钮区域 */
.message-actions {
    position: absolute;
    bottom: -26px;
    right: 0;
    display: flex;
    justify-content: flex-end;
    margin-top: 0;
    margin-bottom: 0;
    width: 100%;
}

/* 复制按钮样式 */
.message-actions .copy-text-btn {
    position: static;
    opacity: 0.9;
    background: var(--gray-100);
    color: var(--gray-700);
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.message-actions .copy-text-btn:hover {
    opacity: 1;
    background: var(--gray-200);
    color: var(--gray-900);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.message-actions .copy-text-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* 用户消息的复制按钮样式 */
.message.user .message-actions .copy-text-btn {
    background: rgba(255, 255, 255, 0.2);
    color: rgb(226, 110, 110);
}

.message.user .message-actions .copy-text-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 消息时间 */
.message-time {
    font-size: 0.688rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    margin-left: 0.5rem;
}

/* 消息来源 */
.message-sources {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--white);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.message-sources i {
    margin-right: 0.25rem;
    color: var(--primary-color);
}

/* 输入区 */
.chat-input-area {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

.template-selector {
    margin-bottom: 0.75rem;
}

.template-dropdown {
    width: 100%;
    padding: 0.625rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    color: var(--gray-700);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.template-dropdown:hover {
    border-color: var(--gray-400);
}

.template-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    transition: all 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--gray-700);
    font-size: 0.875rem;
    resize: none;
    max-height: 100px;
    padding: 0.5rem 0;
    font-family: inherit;
}

#messageInput:focus {
    outline: none;
}

#messageInput::placeholder {
    color: var(--gray-400);
}

.input-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
}

.input-hint {
    font-size: 0.688rem;
    color: var(--gray-400);
}

.btn-send {
    background: var(--primary-color);
    border: none;
    color: var(--white);
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.btn-send:active:not(:disabled) {
    transform: scale(1);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 1rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 弹窗样式 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
}

.close-btn {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    line-height: 1;
    transition: all 0.2s;
}

.close-btn:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    background: var(--gray-50);
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    color: var(--gray-700);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
    border-color: var(--gray-400);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.required {
    color: var(--danger-color);
    margin-left: 0.125rem;
}

/* API测试结果 */
.api-test-result {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.api-test-result.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.api-test-result.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
    transition: all 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* 工具类 */
.text-muted {
    color: var(--gray-500);
    font-size: 0.75rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-header-info h3 {
        font-size: 0.875rem;
    }
}

/* ========== 代码块样式 ========== */
pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0.5rem 0;
    border: 1px solid #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    position: relative;
}

/* 代码块复制按钮 */
.code-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.copy-code-btn {
    background: #2d2d2d;
    color: #fff;
    border: 1px solid #666;
    border-radius: 4px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
}

.copy-code-btn:hover {
    background: #404040;
    border-color: #888;
}

.copy-code-btn.copied {
    background: #10b981;
    border-color: #10b981;
}

code {
    font-family: inherit;
}

/* 行内代码 */
:not(pre) > code {
    background: #f0f0f0;
    color: #e83e8c;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid #ddd;
}

/* 深色主题的代码块（适配助手消息） */
.message.assistant pre {
    background: #0d1117;
    border: 1px solid #30363d;
}

.message.assistant code {
    color: #ff7b72;
}

.message.assistant .copy-code-btn {
    background: #0d1117;
    border-color: #30363d;
    color: #8b949e;
}

.message.assistant .copy-code-btn:hover {
    background: #161b22;
    color: #c9d1d9;
}

/* 用户消息中的代码块 */
.message.user pre {
    background: #2d1a24;
    border: 1px solid #ff99bb;
}

.message.user code {
    color: #ffb6cf;
}

.message.user .copy-code-btn {
    background: #2d1a24;
    border-color: #ff99bb;
    color: #ffb6cf;
}

.message.user .copy-code-btn:hover {
    background: #3d2a34;
}

/* 代码块滚动条 */
pre::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

pre::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 3px;
}

pre::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 3px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* ========== Markdown 样式 ========== */
.markdown-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    word-wrap: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-body h1 { font-size: 2em; border-bottom: 1px solid #eaecef; padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.5em; border-bottom: 1px solid #eaecef; padding-bottom: 0.3em; }
.markdown-body h3 { font-size: 1.25em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.875em; }
.markdown-body h6 { font-size: 0.85em; color: #6a737d; }

.markdown-body p {
    margin-top: 0;
    /* margin-bottom: 1rem; */
}

.markdown-body blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
    margin: 0 0 1rem 0;
}

.markdown-body ul,
.markdown-body ol {
    margin-top: 0;
    margin-bottom: 1rem;
    padding-left: 2em;
}

.markdown-body ul ul,
.markdown-body ol ul,
.markdown-body ul ol,
.markdown-body ol ol {
    margin-bottom: 0;
}

.markdown-body li {
    margin: 0.25rem 0;
}

.markdown-body li > p {
    margin-top: 0.5rem;
}

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
    display: block;
    overflow-x: auto;
}

.markdown-body table th,
.markdown-body table td {
    padding: 0.5rem 1rem;
    border: 1px solid #e1e4e8;
}

.markdown-body table th {
    font-weight: 600;
    background: #f6f8fa;
}

.markdown-body img {
    max-width: 100%;
    box-sizing: content-box;
    background-color: #fff;
}

.markdown-body hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: #e1e4e8;
    border: 0;
}

.markdown-body a {
    color: #0366d6;
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background: rgba(27, 31, 35, 0.05);
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
}

.markdown-body pre {
    margin: 0.5rem 0;
    padding: 1rem;
    overflow: auto;
    line-height: 1.45;
    background: #0d1117;
    border-radius: 6px;
}

.markdown-body pre code {
    padding: 0;
    margin: 0;
    font-size: 100%;
    word-break: normal;
    white-space: pre;
    background: transparent;
    border: 0;
}

/* 暗色主题适配 */
.message.assistant .markdown-body {
    color: #24292e;
}

.message.assistant .markdown-body pre {
    background: #0d1117;
}

.message.assistant .markdown-body code {
    background: rgba(27, 31, 35, 0.05);
}

.message.user .markdown-body {
    color: white;
}

.message.user .markdown-body h1,
.message.user .markdown-body h2 {
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.message.user .markdown-body a {
    color: #ffd700;
}

.message.user .markdown-body blockquote {
    color: rgba(255, 255, 255, 0.8);
    border-left-color: rgba(255, 255, 255, 0.3);
}

.message.user .markdown-body table th,
.message.user .markdown-body table td {
    border-color: rgba(255, 255, 255, 0.2);
}

.message.user .markdown-body table th {
    background: rgba(255, 255, 255, 0.1);
}

.message.user .markdown-body code {
    background: rgba(255, 255, 255, 0.1);
    color: #ffb6cf;
}

.message.user .markdown-body pre {
    background: #2d1a24;
}

.message.user .markdown-body hr {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 代码高亮样式 */
.hljs {
    display: block;
    overflow-x: auto;
    padding: 0.5em;
    color: #c9d1d9;
    background: #0d1117;
}

.hljs-comment,
.hljs-quote {
    color: #8b949e;
    font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
    color: #ff7b72;
}

.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
    color: #79c0ff;
}

.hljs-string,
.hljs-doctag {
    color: #a5d6ff;
}

.hljs-title,
.hljs-section,
.hljs-selector-id {
    color: #d2a8ff;
}

.hljs-subst {
    font-weight: normal;
}

.hljs-type,
.hljs-class .hljs-title {
    color: #ffa657;
}

.hljs-tag,
.hljs-name,
.hljs-attribute {
    color: #7ee787;
}

.hljs-regexp,
.hljs-link {
    color: #db6d28;
}

.hljs-symbol,
.hljs-bullet {
    color: #f2cc60;
}

.hljs-built_in,
.hljs-builtin-name {
    color: #ffa657;
}

.hljs-meta {
    color: #8b949e;
}

.hljs-deletion {
    background: #490202;
    color: #ffa198;
}

.hljs-addition {
    background: #04260f;
    color: #7ee787;
}

.hljs-emphasis {
    font-style: italic;
}

.hljs-strong {
    font-weight: bold;
}

/* 移除旧样式兼容 */
.message-bubble .copy-text-btn:not(.message-actions .copy-text-btn) {
    display: none;
}