/**
 * 聊天对话页面样式 - 浅色主题优化版
 */

/* ===========================
   聊天页面布局覆盖
   =========================== */
.main-content {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.content-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.active {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* 移动端侧边栏遮罩不占 flex 空间 */
.chat-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chat-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ===========================
   左侧侧边栏
   =========================== */
.chat-sidebar {
    width: 280px;
    background: var(--color-bg-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* ── 顶部品牌栏 ── */
.chat-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--color-border-light);
}

.chat-sidebar-brand-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: 9px;
    color: white;
    font-size: 15px;
    flex-shrink: 0;
}

.chat-sidebar-brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: 0.2px;
}

/* ── 功能区（新建对话）── */
.chat-sidebar-actions {
    padding: 12px 12px 8px;
    border-bottom: 1px solid var(--color-border-light);
}

.chat-new-conversation-btn {
    width: 100%;
    padding: 11px 16px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-primary);
}

.chat-new-conversation-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-primary-lg);
}

.chat-new-conversation-btn:active {
    transform: translateY(0);
}

.chat-new-conversation-btn i {
    font-size: 13px;
}

/* ── 历史记录区标题 ── */
.chat-sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.chat-sidebar-section-title i {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* ── 对话列表 ── */
.chat-conversations-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 8px 12px;
}

/* ── 对话列表项 ── */
.chat-conversation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    border: 1px solid transparent;
    position: relative;
}

.chat-conversation-item:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border);
}

.chat-conversation-item.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(139, 92, 246, 0.04));
    border-color: rgba(79, 70, 229, 0.18);
}

.chat-conversation-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 0 3px 3px 0;
}

/* 模型 logo 图标区 */
.chat-conversation-item-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-elevated);
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
    transition: all 0.2s ease;
    border: 1px solid var(--color-border-light);
}

.chat-conversation-item-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.chat-conversation-item-icon i {
    font-size: 13px;
    color: var(--color-text-tertiary);
}

.chat-conversation-item.active .chat-conversation-item-icon {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.2);
}

/* 对话信息 */
.chat-conversation-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-conversation-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-conversation-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.chat-conversation-item.active .chat-conversation-item-title {
    color: var(--color-primary);
    font-weight: 600;
}

/* 模型名称标签 */
.chat-conversation-item-model {
    font-size: 10px;
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.chat-conversation-item.active .chat-conversation-item-model {
    color: var(--color-primary);
    opacity: 0.8;
}

/* 操作按钮区 */
.chat-conversation-item-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.chat-conversation-item:hover .chat-conversation-item-actions {
    opacity: 1;
}

.chat-conversation-item-action {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s ease;
}

.chat-conversation-item-action.delete:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.chat-conversation-item-action.export:hover {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

/* 空状态 */
.chat-conversations-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    text-align: center;
    color: var(--color-text-muted);
}

.chat-conversations-empty i {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.chat-conversations-empty p {
    font-size: 13px;
    line-height: 1.5;
}

/* 对话列表项 - 紧凑设计 */
.chat-conversation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    border: 1px solid transparent;
    position: relative;
}

.chat-conversation-item:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border);
}

.chat-conversation-item.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(236, 72, 153, 0.04));
    border-color: rgba(79, 70, 229, 0.15);
}

/* 活跃状态指示条 */
.chat-conversation-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 0 3px 3px 0;
}

/* 对话项内容区 */
.chat-conversation-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 对话图标 - 精简 */
.chat-conversation-item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-elevated);
    border-radius: 8px;
    color: var(--color-text-tertiary);
    font-size: 13px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.chat-conversation-item:hover .chat-conversation-item-icon {
    color: var(--color-text-secondary);
}

.chat-conversation-item.active .chat-conversation-item-icon {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
}

/* 对话信息容器 */
.chat-conversation-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* 对话标题 */
.chat-conversation-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

/* 模型标签 - 更紧凑 */
.chat-conversation-item-model {
    font-size: 10px;
    color: var(--color-text-tertiary);
    background: var(--color-bg-elevated);
    padding: 1px 6px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
    font-weight: 500;
}

.chat-conversation-item.active .chat-conversation-item-model {
    background: rgba(79, 70, 229, 0.1);
    color: var(--color-primary);
}

/* 操作按钮区 */
.chat-conversation-item-actions {
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-conversation-item:hover .chat-conversation-item-actions {
    opacity: 1;
}

/* 操作按钮 - 精简 */
.chat-conversation-item-action {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.chat-conversation-item-action:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.chat-conversation-item-action.delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.chat-conversation-item-action.export:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}


/* 空状态 */
.chat-conversations-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--color-text-tertiary);
}

.chat-conversations-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.chat-conversations-empty p {
    font-size: 14px;
}

/* ===========================
   聊天页面主内容区
   =========================== */
.chat-page-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--color-bg-page);
}

.chat-messages-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--spacing-lg);
    padding-bottom: 0;
    scroll-behavior: smooth;
}

/* 欢迎消息 */
.chat-welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    padding: 40px;
}

.chat-welcome-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: 24px;
    color: white;
    font-size: 36px;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.25);
}

.chat-welcome-text h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

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

/* ===========================
   消息气泡样式
   =========================== */

/* JS 实际渲染使用 chat-message-header / chat-message-text，与 bubble 保持一致 */
.chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-message-role {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-tertiary);
}

.chat-message-time {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* chat-message-text 等同于 chat-message-bubble */
.chat-message-text {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.7;
    word-wrap: break-word;
}

.chat-message-user .chat-message-text {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-primary);
}

.chat-message-assistant .chat-message-text {
    background: var(--color-bg-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-bottom-left-radius: 4px;
}

.chat-message-error .chat-message-text {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

.chat-message-user .chat-message-text code {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-message-text pre {
    background: #1e1e1e;
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
}

.chat-message-text pre code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e4e4e4;
}

.chat-message-text code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-primary);
}

.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    animation: messageSlideIn 0.3s ease;
}

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

.chat-message-user {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
    font-size: 18px;
}

.chat-message-user .chat-message-avatar {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
}

.chat-message-assistant .chat-message-avatar {
    background: var(--color-bg-elevated);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.chat-message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-message-user .chat-message-content {
    align-items: flex-end;
}

.chat-message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.7;
    word-wrap: break-word;
}

.chat-message-user .chat-message-bubble {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-primary);
}

.chat-message-assistant .chat-message-bubble {
    background: var(--color-bg-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-bottom-left-radius: 4px;
}

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.chat-message-user .chat-message-meta {
    justify-content: flex-end;
}

.chat-message-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chat-message:hover .chat-message-actions {
    opacity: 1;
    transform: translateY(0);
}

.chat-message-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.chat-message-action-btn:hover {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.chat-message-action-btn:active {
    transform: translateY(0) scale(0.95);
}

/* 复制按钮 */
.chat-message-action-btn[data-action="copy"]:hover,
.chat-message-action-btn[data-action="user-copy"]:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

/* 重新生成/编辑按钮 */
.chat-message-action-btn[data-action="regenerate"]:hover,
.chat-message-action-btn[data-action="user-edit"]:hover {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

/* 删除按钮 */
.chat-message-action-btn[data-action="delete"]:hover,
.chat-message-action-btn[data-action="user-delete"]:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* 导出按钮 */
.chat-message-action-btn[data-action="export"]:hover {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

/* 成功状态 */
.chat-message-action-btn.success {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #059669 !important;
}

/* 加载状态 */
.chat-message-action-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.chat-message-action-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 导出下拉菜单 */
.chat-message-export-dropdown {
    position: relative;
}

.chat-message-export-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 10px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    min-width: 180px;
    z-index: 100;
}

.chat-message-export-menu.show {
    display: block;
    animation: fadeInUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-export-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--color-text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.chat-export-option:hover {
    background: var(--color-bg-elevated);
    transform: translateX(2px);
}

.chat-export-option i {
    width: 18px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 14px;
    transition: all 0.2s ease;
}

/* 导出选项图标颜色 */
.chat-export-option[data-export="image"]:hover i {
    color: #7c3aed;
}

.chat-export-option[data-export="word"]:hover i {
    color: #2563eb;
}

.chat-export-option[data-export="to-image-tab"]:hover i {
    color: #059669;
}

.chat-export-option[data-export="to-video-tab"]:hover i {
    color: #ea580c;
}

.chat-export-option span {
    font-weight: 500;
}

/* 错误消息 */
.chat-message-error .chat-message-bubble {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

/* ===========================
   输入区域
   =========================== */
/* ===========================
   输入区域 - 紧凑优化版
   =========================== */
.chat-input-area {
    padding: 12px 16px;
    background: var(--color-bg-surface);
    border-top: 1px solid var(--color-border);
}

.chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    background: var(--color-bg-surface);
}

.chat-file-input {
    display: none;
}

/* 上传按钮 - 紧凑 */
.chat-upload-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-upload-btn:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-secondary);
}

.chat-upload-btn.has-file {
    color: var(--color-primary);
    background: rgba(79, 70, 229, 0.1);
}

/* 输入框 - 紧凑 */
.chat-input-textarea {
    flex: 1;
    min-height: 20px;
    max-height: 160px;
    padding: 6px 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    font-family: inherit;
}

.chat-input-textarea::placeholder {
    color: var(--color-text-tertiary);
}

/* 按钮组 - 紧凑 */
.chat-input-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* 发送按钮 - 紧凑 */
.chat-send-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    box-shadow: var(--shadow-primary);
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: var(--shadow-primary-lg);
}

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

.chat-send-btn.generating {
    background: linear-gradient(135deg, var(--color-error), var(--color-error-dark));
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

.chat-send-btn.generating:hover {
    box-shadow: 0 3px 8px rgba(239, 68, 68, 0.35);
}

/* 输入提示 - 紧凑 */
.chat-input-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.chat-input-hint i {
    margin-right: 3px;
    font-size: 10px;
}

/* ===========================
   文件上传区域
   =========================== */
.chat-uploaded-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.chat-uploaded-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
}

.chat-uploaded-file i {
    color: var(--color-text-tertiary);
}

.chat-uploaded-file-name {
    color: var(--color-text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-uploaded-file-remove {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.chat-uploaded-file-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* ===========================
   消息中的文件显示
   =========================== */
.chat-message-file {
    margin-top: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
}

.chat-message-file-preview {
    max-width: 200px;
    margin-bottom: 8px;
}

.chat-message-file-preview img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

.chat-message-file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* ===========================
   代码块样式
   =========================== */
.chat-message-bubble pre {
    background: #1e1e1e;
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
}

.chat-message-bubble pre code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e4e4e4;
}

.chat-message-bubble code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-primary);
}

.chat-message-user .chat-message-bubble code {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ===========================
   代码块复制按钮样式
   =========================== */
.code-block-wrapper {
    margin: 12px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #1e1e1e;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
}

.code-language {
    font-size: 12px;
    font-weight: 500;
    color: #858585;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #404040;
    border-radius: 6px;
    color: #858585;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-copy-btn:hover {
    background: #404040;
    color: #e4e4e4;
    border-color: #505050;
}

.code-copy-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
}

.code-copy-btn i {
    font-size: 11px;
}

.code-block-wrapper pre {
    margin: 0;
    padding: 16px;
    background: #1e1e1e;
    overflow-x: auto;
}

.code-block-wrapper pre code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e4e4e4;
    background: transparent;
    padding: 0;
}

/* ===========================
   响应式适配 - 全面优化版
   =========================== */

/* 平板设备 */
@media (max-width: 1024px) {
    .chat-sidebar {
        width: 260px;
    }

    .chat-message-content {
        max-width: 75%;
    }
}

/* 移动端侧边栏触发按钮 */
.chat-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 16px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-primary);
    z-index: 998;
    transition: all var(--transition-base);
}

.chat-sidebar-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-primary-lg);
}

@media (max-width: 768px) {
    .chat-sidebar-toggle {
        display: flex;
    }

    /* 侧边栏改为抽屉式 */
    .chat-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
    }

    .chat-sidebar.open {
        transform: translateX(0);
    }

    .chat-message-content {
        max-width: 85%;
    }

    .chat-welcome-message {
        min-height: 180px;
        padding: 20px;
    }

    .chat-welcome-icon {
        width: 56px;
        height: 56px;
        font-size: 24px;
        border-radius: 16px;
    }

    .chat-welcome-text h2 {
        font-size: 18px;
    }

    .chat-welcome-text p {
        font-size: 13px;
    }

    /* 输入区更紧凑 */
    .chat-input-area {
        padding: 10px 12px;
    }

    .chat-input-wrapper {
        padding: 6px 10px;
        border-radius: 10px;
    }

    .chat-input-hint {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        font-size: 10px;
        margin-top: 6px;
    }

    .chat-input-hint-divider {
        display: none;
    }

    /* 消息气泡适配 */
    .chat-message {
        margin-bottom: 16px;
    }

    .chat-message-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
        border-radius: 8px;
    }

    .chat-message-bubble,
    .chat-message-text {
        padding: 10px 14px;
        font-size: 14px;
    }

    /* 操作按钮始终显示 */
    .chat-message-actions {
        opacity: 1;
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    .chat-sidebar {
        width: 100%;
    }

    .chat-message-content {
        max-width: 90%;
    }

    .chat-input-hint span {
        font-size: 10px;
    }

    .chat-message-bubble,
    .chat-message-text {
        padding: 8px 12px;
        font-size: 14px;
    }

    /* Token显示简化 */
    .chat-message-tokens .token-detail {
        display: none;
    }
}

/* ===========================
   Logo模型选择器样式
   =========================== */
.model-logo-selector {
    background: var(--color-bg-surface, #ffffff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.model-logo-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.model-logo-selector-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary, #111827);
}

.model-logo-selector-label i {
    color: var(--color-primary, #4f46e5);
    font-size: 16px;
}

.model-logo-selector-current {
    font-size: 13px;
    color: var(--color-text-secondary, #6b7280);
    background: var(--color-bg-elevated, #f9fafb);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.model-logo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.model-logo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: var(--color-bg-elevated, #f9fafb);
    border: 2px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
}

.model-logo-card:hover {
    background: var(--color-bg-surface, #ffffff);
    border-color: var(--color-border-hover, #d1d5db);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.model-logo-card.selected {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(236, 72, 153, 0.04));
    border-color: var(--color-primary, #4f46e5);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.2);
}

.model-logo-image-wrapper {
    position: relative;
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.model-logo-image {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.3s ease;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
}

.model-logo-card:hover .model-logo-image {
    transform: scale(1.1);
}

.model-logo-check {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--color-primary, #4f46e5), var(--color-secondary, #ec4899));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.model-logo-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.model-logo-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary, #111827);
    line-height: 1.3;
}

.model-logo-provider {
    font-size: 11px;
    color: var(--color-text-tertiary, #9ca3af);
}

/* 响应式适配 - Logo选择器 */
@media (max-width: 1200px) {
    .model-logo-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 12px;
    }

    .model-logo-image-wrapper {
        width: 56px;
        height: 56px;
    }

    .model-logo-image {
        width: 48px;
        height: 48px;
    }
}

@media (max-width: 992px) {
    .model-logo-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 576px) {
    .model-logo-selector {
        padding: 12px 16px;
    }

    .model-logo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .model-logo-card {
        padding: 12px 8px;
    }

    .model-logo-image-wrapper {
        width: 48px;
        height: 48px;
    }

    .model-logo-image {
        width: 40px;
        height: 40px;
    }

    .model-logo-name {
        font-size: 12px;
    }
}

/* ===========================
   卡片式模型选择器包装器
   =========================== */
.card-model-selector-wrapper {
    margin-bottom: 16px;
}

/* ===========================
   Token用量显示
   =========================== */
.chat-message-tokens {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(79, 70, 229, 0.05);
    border-radius: 8px;
    font-size: 12px;
    color: var(--color-text-secondary, #6b7280);
    width: fit-content;
}

.chat-message-tokens i {
    color: var(--color-primary, #4f46e5);
    font-size: 14px;
}

.chat-message-tokens .token-count {
    font-weight: 600;
    color: var(--color-text-primary, #111827);
}

.chat-message-tokens .token-detail {
    color: var(--color-text-tertiary, #9ca3af);
    font-size: 11px;
}

/* ===========================
   顶部配置面板样式
   =========================== */
.config-panel {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
    width: 100%;
    padding: 0;
}

.config-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary, #6b7280);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.config-label i {
    color: var(--color-primary, #4f46e5);
    font-size: 16px;
}

.config-input {
    flex: 0 1 300px;
    min-width: 200px;
    max-width: 350px;
    padding: 10px 14px;
    background: var(--color-bg-elevated, #f9fafb);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 10px;
    color: var(--color-text-primary, #111827);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.config-input:hover {
    border-color: var(--color-border-hover, #d1d5db);
}

.config-input:focus {
    outline: none;
    border-color: var(--color-primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: var(--color-bg-surface, #ffffff);
}

.config-input::placeholder {
    color: var(--color-text-muted, #9ca3af);
}

.config-save-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.config-url-example {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 280px;
}

.example-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.example-text {
    font-size: 11px;
    color: var(--color-text-tertiary, #9ca3af);
    line-height: 1.4;
}

.config-toggle-visibility {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-tertiary, #9ca3af);
    cursor: pointer;
    padding: 8px;
    font-size: 14px;
    transition: color 0.2s;
    border-radius: 6px;
}

.config-toggle-visibility:hover {
    color: var(--color-text-secondary, #6b7280);
    background: var(--color-bg-elevated, #f3f4f6);
}

/* 响应式适配 - 配置面板 */
@media (max-width: 1200px) {
    .config-panel {
        flex-wrap: wrap;
        gap: 12px;
    }

    .config-input {
        flex: 1 1 250px;
        max-width: none;
    }

    .config-save-section {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    .config-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .config-label {
        margin-bottom: -8px;
    }

    .config-input {
        flex: 1 1 auto;
        min-width: auto;
        width: 100%;
    }

    .config-save-section {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .config-save-section .btn {
        width: 100%;
        justify-content: center;
    }

    .config-url-example {
        max-width: none;
        text-align: center;
    }
}

/* ===========================
   对话导出对话框样式
   =========================== */

.chat-export-dialog-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chat-export-dialog {
    background: var(--color-bg-surface, #ffffff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
    animation: slideUp 0.3s ease;
}

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

.chat-export-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.chat-export-dialog-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary, #111827);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-export-dialog-header h3 i {
    color: var(--color-primary, #4f46e5);
}

.chat-export-dialog-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-bg-elevated, #f9fafb);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 10px;
    color: var(--color-text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-export-dialog-close:hover {
    background: var(--color-bg-hover, #f3f4f6);
    color: var(--color-text-primary, #111827);
    border-color: var(--color-border-hover, #d1d5db);
}

.chat-export-dialog-body {
    padding: 24px;
}

.chat-export-dialog-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-export-dialog-info {
    margin: 0 0 20px;
    font-size: 13px;
    color: var(--color-text-secondary, #6b7280);
}

.chat-export-dialog-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.chat-export-dialog-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--color-bg-elevated, #f9fafb);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-export-dialog-option:hover {
    background: var(--color-bg-surface, #ffffff);
    border-color: var(--color-primary, #4f46e5);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15);
}

.chat-export-dialog-option i {
    font-size: 28px;
    color: var(--color-primary, #4f46e5);
}

.chat-export-dialog-option span {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary, #111827);
}

/* 移动端适配 */
@media (max-width: 480px) {
    .chat-export-dialog {
        width: 95%;
        margin: 20px;
    }

    .chat-export-dialog-options {
        grid-template-columns: 1fr;
    }

    .chat-export-dialog-option {
        flex-direction: row;
        justify-content: flex-start;
        padding: 16px 20px;
    }

    .chat-export-dialog-option i {
        font-size: 24px;
    }
}
