* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --bg-dark: #ffffff;
    --bg-card: #f8fafc;
    --bg-input: #ffffff;
    --bg-sidebar: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --thinking-bg: #f1f5f9;
    --user-bg: #2563eb;
    --assistant-bg: #f8fafc;
    --hover-bg: #e2e8f0;
    --accent-blue: #3b82f6;
    --accent-yellow: #f59e0b;
    --metal-silver: #94a3b8;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;  /* 动态视口高度，移动端更准确 */
    display: flex;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
}

.new-chat-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    border-radius: 8px;
    color: white;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.new-chat-btn::before {
    content: '➕';
}

.sidebar-search {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.conv-item {
    position: relative;
}

.conv-delete-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.conv-item:hover .conv-delete-btn {
    opacity: 1;
}

.conv-delete-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.conv-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.conv-pagination button {
    padding: 4px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.conv-pagination button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.conv-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sidebar-footer {
    padding: 15px 20px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-color);
    background: #ffffff;
}

.clear-history-btn {
    width: 100%;
    background: transparent;
    border: 1px solid #ef4444;
    border-radius: 8px;
    color: #ef4444;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    background: #ef4444;
    color: white;
}

.conv-item {
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 5px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.conv-item:hover {
    background: var(--hover-bg);
}

.conv-item.active {
    background: var(--hover-bg);
    border-left: 3px solid var(--primary-color);
}

.conv-item .conv-title {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-item .conv-delete {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    font-size: 14px;
    filter: grayscale(100%);
    transition: filter 0.2s;
}

.conv-item:hover .conv-delete {
    opacity: 1;
}

.conv-item .conv-delete:hover {
    filter: grayscale(0%);
}

.conv-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-width: 0;
}

/* 头部 */
.header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.2);
    overflow: hidden;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.model-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.model-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 聊天区域 */
.chat-container {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px;
    width: calc(100% - 100px);
    margin: 0 50px;
    min-height: 0;
    background: #ffffff;
}

.welcome {
    text-align: center;
    padding: 60px 20px;
}

.welcome-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
}

.welcome-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.welcome h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.welcome p {
    color: var(--text-secondary);
    font-size: 16px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.suggestion-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.suggestion-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.suggestion-card .icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.suggestion-card .text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 消息 */
.message {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

/* 用户消息样式 */
.message-content.user {
    font-weight: 500;
    color: #1e40af;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    padding: 12px 16px;
    padding-left: 16px;
    border-radius: 12px;
    border-left: 4px solid #3b82f6;
    margin-top: 8px;
    margin-bottom: 8px;
}

/* 移动端消息动画 */
@media (max-width: 768px) {
    .message.animate-in {
        animation: fadeIn 0.3s ease;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.avatar.user {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.avatar.assistant {
    background: transparent;
    box-shadow: none;
}

.message-role {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.message-content {
    padding-left: 46px;
    line-height: 1.8;
    color: var(--text-primary);
}

/* 思考过程 */
.thinking-block {
    background: #fefce8;
    border-left: 3px solid #f59e0b;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.thinking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b45309;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.thinking-content {
    color: #78716c;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* 知识库来源提示 */
.knowledge-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
    border: 1px solid #93c5fd;
}

.knowledge-badge::before {
    content: '📚';
}

/* 知识库图片 */
.knowledge-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
    justify-content: center;
}
.knowledge-image-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    align-items: center;
    margin: 16px 0;
    clear: both;
}
.knowledge-image {
    max-width: 400px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    display: block;
}
.knowledge-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.knowledge-image-description {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    padding: 4px 8px;
    background: #f5f5f5;
    border-radius: 4px;
    word-break: break-word;
    text-align: center;
}

/* 内联图片样式 */
.inline-image-container {
    margin: 16px 0;
    text-align: center;
    display: block;
    width: 100%;
    clear: both;
}
.inline-image {
    max-width: 400px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    display: block;
    margin: 0 auto;
}
.inline-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.inline-image-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    padding: 4px 12px;
    background: var(--bg-card);
    border-radius: 4px;
    display: inline-block;
    text-align: center;
}

/* 图片网格布局 - 一排三个自适应 */
.images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.images-grid .inline-image-container {
    margin: 0;
    width: 100%;
}

.images-grid .inline-image {
    max-width: 100%;
    width: 100%;
    height: 180px;
    object-fit: cover;
}

/* 响应式：小屏幕一排两个 */
@media (max-width: 600px) {
    .images-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .images-grid .inline-image {
        height: 150px;
    }
}

/* 单张图片居中显示 */
.images-grid.single-image {
    display: flex;
    justify-content: center;
}

.images-grid.single-image .inline-image-container {
    max-width: 400px;
}

.images-grid.single-image .inline-image {
    width: auto;
    max-width: 400px;
    height: auto;
    max-height: 300px;
    object-fit: contain;
}

/* 两张图片 */
.images-grid.two-images {
    grid-template-columns: repeat(2, 1fr);
}

.reference-links {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.reference-links h3 {
    margin-bottom: 12px;
    font-size: 16px;
}

.reference-item {
    margin-bottom: 14px;
}

.reference-name {
    font-weight: 600;
    line-height: 1.6;
    word-break: break-word;
}

.reference-url {
    margin-top: 4px;
    line-height: 1.6;
    word-break: break-all;
}

.reference-url a {
    color: var(--primary-color);
    text-decoration: underline;
}

/* 图片预览模态框 */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.image-modal.show {
    display: flex;
}
.image-modal img.modal-image-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    transition: transform 0.2s ease;
    cursor: move;
}
.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    z-index: 2001;
    transition: transform 0.2s;
}
.image-modal-close:hover {
    transform: scale(1.2);
}

/* 图片模态框工具栏 */
.image-modal-toolbar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 12px;
    z-index: 2001;
}

.image-modal-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.image-modal-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.image-modal-btn:active {
    transform: scale(0.95);
}

.image-modal-scale-text {
    color: white;
    font-size: 14px;
    font-weight: 500;
    min-width: 50px;
    text-align: center;
}

/* 知识库内容区块 */
.knowledge-content {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

.knowledge-content::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #3b82f6 0%, #06b6d4 100%);
    border-radius: 12px 0 0 12px;
}

.knowledge-source {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
}

.knowledge-source::before {
    content: '📍';
}

/* Markdown 样式 */
.markdown-content h1, .markdown-content h2, .markdown-content h3,
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    margin: 24px 0 12px 0;
    color: #1e293b;
    font-weight: 700;
    line-height: 1.3;
}

.markdown-content h1 {
    font-size: 26px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    margin-top: 0;
}
.markdown-content h2 {
    font-size: 22px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}
.markdown-content h3 { font-size: 18px; color: #334155; }
.markdown-content h4 { font-size: 16px; color: #475569; }
.markdown-content h5, .markdown-content h6 { font-size: 14px; color: #64748b; }

.markdown-content p {
    margin-bottom: 14px;
    line-height: 1.8;
    color: #334155;
}

/* 无序列表样式 */
.markdown-content ul {
    margin: 14px 0;
    padding-left: 0;
    list-style: none;
}
.markdown-content ul > li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 10px;
    line-height: 1.7;
    color: #334155;
}
.markdown-content ul > li::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 10px;
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border-radius: 50%;
}
.markdown-content ul > li > ul {
    margin: 8px 0;
    padding-left: 20px;
}
.markdown-content ul > li > ul > li {
    padding-left: 20px;
}
.markdown-content ul > li > ul > li::before {
    background: transparent;
    border: 2px solid #3b82f6;
    width: 4px;
    height: 4px;
    left: 4px;
    top: 10px;
}

/* 有序列表样式 */
.markdown-content ol {
    margin: 14px 0;
    padding-left: 28px;
    list-style: decimal;
}
.markdown-content ol > li {
    padding-left: 4px;
    margin-bottom: 10px;
    line-height: 1.7;
    color: #334155;
}

/* 流式输出闪烁光标 */
.typing-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: #3b82f6;
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.markdown-content li {
    margin-bottom: 8px;
}

/* 行内代码 */
.markdown-content code {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: #be185d;
    border: 1px solid #e2e8f0;
}

/* 代码块 */
.markdown-content pre {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-radius: 12px;
    padding: 18px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid #334155;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    color: #e2e8f0;
    border: none;
    font-size: 14px;
    line-height: 1.6;
}

/* 引用块 */
.markdown-content blockquote {
    border-left: 4px solid #3b82f6;
    margin: 16px 0;
    padding: 14px 18px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-radius: 0 10px 10px 0;
    color: #1e40af;
    font-style: italic;
}
.markdown-content blockquote p {
    margin: 0;
    color: #1e40af;
}

/* 表格 */
.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}
.markdown-content th {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
}
.markdown-content td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}
.markdown-content tr:nth-child(even) {
    background: #f8fafc;
}
.markdown-content tr:hover {
    background: #f1f5f9;
}

/* 分割线 */
.markdown-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #cbd5e1, transparent);
    margin: 24px 0;
}

/* ========== 警告/提示框样式 ========== */
/* 注意提示框 */
.markdown-content blockquote:has(strong:only-child),
.markdown-content .admonition {
    padding: 16px 20px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.7;
}

/* 注意 - 黄色 */
.markdown-content blockquote:has(> p > strong:first-child:contains("注意")),
.markdown-content .admonition.warning,
.markdown-content .warning-box {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

/* 警告 - 红色 */
.markdown-content blockquote:has(> p > strong:first-child:contains("警告")),
.markdown-content .admonition.danger,
.markdown-content .danger-box {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

/* 提示 - 蓝色 */
.markdown-content blockquote:has(> p > strong:first-child:contains("提示")),
.markdown-content .admonition.tip,
.markdown-content .tip-box {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

/* 信息 - 绿色 */
.markdown-content blockquote:has(> p > strong:first-child:contains("信息")),
.markdown-content .admonition.info,
.markdown-content .info-box {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left: 4px solid #22c55e;
    color: #166534;
}

/* 警告框内的文本样式 */
.markdown-content .admonition p,
.markdown-content .warning-box p,
.markdown-content .danger-box p,
.markdown-content .tip-box p,
.markdown-content .info-box p {
    margin: 0;
    color: inherit;
}

.markdown-content .admonition strong,
.markdown-content .warning-box strong,
.markdown-content .danger-box strong {
    color: inherit;
}

/* 链接 */
.markdown-content a {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px dashed #3b82f6;
    transition: all 0.2s;
}
.markdown-content a:hover {
    color: #1d4ed8;
    border-bottom-style: solid;
}

/* 强调文字 */
.markdown-content strong {
    color: #1e293b;
    font-weight: 700;
}
.markdown-content em {
    color: #475569;
    font-style: italic;
}

/* 删除线 */
.markdown-content del {
    color: #94a3b8;
    text-decoration: line-through;
}

/* 图片 */
.markdown-content img {
    max-width: 400px;
    max-height: 300px;
    border-radius: 8px;
    margin: 16px auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
    cursor: pointer;
    object-fit: contain;
}

/* 输入区域 */
.input-container {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}


@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.input-wrapper {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-box {
    flex: 1;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 10px 14px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-box textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    max-height: 150px;
    line-height: 1.5;
}

.input-box textarea:focus {
    outline: none;
}

.input-box textarea::placeholder {
    color: var(--text-secondary);
}

/* 图片上传按钮 */
.image-upload-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.image-upload-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.image-upload-btn input {
    display: none;
}

/* 图片预览区域 */
.image-preview-container {
    position: relative;
    margin-right: 10px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.image-preview {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.image-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.image-preview-remove:hover {
    background: #dc2626;
}

.send-btn {
    width: 55px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}

.typing-indicator .thinking-text {
    color: var(--text-secondary);
    font-size: 14px;
    animation: pulse 1.5s infinite;
}

.typing-indicator .dots {
    display: flex;
    gap: 4px;
}

.typing-indicator .dots span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator .dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 代码复制按钮 */
.code-wrapper {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.code-wrapper:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* 对话列表项 */
.conv-item {
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 5px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.conv-item:hover {
    background: var(--hover-bg);
}

.conv-item.active {
    background: #dbeafe;
    border-left: 3px solid var(--primary-color);
}

.conv-item .conv-title {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.conv-item .conv-delete {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    font-size: 14px;
    filter: grayscale(100%);
    transition: filter 0.2s;
}

.conv-item:hover .conv-delete {
    opacity: 1;
}

.conv-item .conv-delete:hover {
    filter: grayscale(0%);
}

.conv-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.thinking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fbbf24;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.thinking-content {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Markdown 样式 */
.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    margin: 20px 0 10px 0;
    color: var(--text-primary);
}

.markdown-content h1 { font-size: 24px; }
.markdown-content h2 { font-size: 20px; }
.markdown-content h3 { font-size: 18px; }

.markdown-content p {
    margin-bottom: 12px;
}

.markdown-content ul, .markdown-content ol {
    margin: 12px 0;
    padding-left: 25px;
}

.markdown-content li {
    margin-bottom: 6px;
}

.markdown-content code {
    background: #2d2d44;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 14px;
}

.markdown-content pre {
    background: #0d1117;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid var(--border-color);
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 12px 0;
    padding: 10px 15px;
    background: var(--thinking-bg);
    color: var(--text-secondary);
}

/* 输入区域 */
.input-container {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.input-wrapper {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-box {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 10px 14px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    transition: border-color 0.2s;
}

.input-box:focus-within {
    border-color: var(--primary-color);
}

.input-box textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    max-height: 150px;
    line-height: 1.5;
}

.input-box textarea:focus {
    outline: none;
}

.input-box textarea::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    width: 55px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-color), #764ba2);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 暂停按钮样式 */
.send-btn.stopping {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.send-btn.stopping:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}

.typing-indicator .thinking-text {
    color: var(--text-secondary);
    font-size: 14px;
    animation: pulse 1.5s infinite;
}

.typing-indicator .dots {
    display: flex;
    gap: 4px;
}

.typing-indicator .dots span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator .dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 代码复制按钮 */
.code-wrapper {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.code-wrapper:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* 语音播报按钮样式 */
.tts-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}

.tts-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.tts-btn.playing {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.tts-btn.playing:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.tts-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tts-btn.loading {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    cursor: wait;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* 交互选项按钮样式 */
.interactive-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}

.option-btn {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #bae6fd;
    color: #0369a1;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: block;
    text-align: left;
    width: 100%;
}

.option-btn:hover {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    border-color: #38bdf8;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.option-btn:active {
    transform: translateX(2px);
}

.option-btn.selected {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: var(--primary-color);
    color: white;
}

.option-btn .option-icon {
    font-size: 16px;
}

/* 引导提示样式 */
.guide-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 10px 14px;
    background: #fef3c7;
    border-radius: 8px;
    color: #92400e;
    font-size: 13px;
}

.guide-hint .hint-icon {
    font-size: 16px;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        z-index: 1000;
        transition: left 0.3s;
        height: 100vh;
        height: 100dvh;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .mobile-menu-btn {
        display: block;
    }

    /* 移动端输入区域优化 */
    .input-container {
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        position: relative;
        z-index: 10;
    }

    .input-wrapper {
        gap: 8px;
    }

    .input-box {
        padding: 10px 12px;
    }

    /* 移动端发送按钮优化 - 增大触摸区域 */
    .send-btn {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px;
        flex-shrink: 0;
    }

    /* 确保按钮可点击 */
    .send-btn:active {
        transform: scale(0.95);
    }

    /* 移动端聊天区域全宽 */
    .chat-container {
        width: 100%;
        margin: 0;
        padding: 15px;
    }

    /* 移动端头部优化 */
    .header {
        padding: 12px 15px;
    }

    .header-title {
        font-size: 18px;
    }

    .header-subtitle {
        display: none;
    }

    /* 移动端欢迎页面优化 */
    .welcome {
        padding: 40px 15px;
    }

    .welcome h1 {
        font-size: 22px;
    }

    .welcome p {
        font-size: 14px;
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn, .sidebar-overlay {
        display: none;
    }
}

.mobile-menu-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
}
