:root {
    --primary-color: #6c47ff;
    --secondary-color: #f5f6fa;
    --accent-color: #00b894;
    --danger-color: #ff7675;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --sidebar-width: 280px;
    --sidebar-bg: #fff;
    --sidebar-bg-rgb: 255, 255, 255;
    --sidebar-border: #ececec;
    --chat-bg: #f5f6fa;
    --card-radius: 18px;
    --shadow: 0 4px 24px 0 rgba(80,80,120,0.08);
    --user-msg-bg: #6c47ff;
    --user-msg-color: #fff;
    --ai-msg-bg: #fff;
    --ai-msg-color: #222;
    --input-bg: #fff;
    --input-border: #ececec;
    --input-radius: 16px;
    
    /* 滚动条配置变量 */
    --scrollbar-width: 14px;
    --scrollbar-thumb-min-height: 20px;
    --scrollbar-thumb-min-height-mobile: 25px;
    /* 减少滚动条轨道的margin，让滑块可以滚动到最底部 */
    --scrollbar-track-margin: 4px 2px 0 2px;
    --scrollbar-track-margin-mobile: 2px 1px 0 1px;
}

body, .bg-light {
    background: var(--chat-bg) !important;
}

.chat-ai-wrapper {
    --chat-primary-color: #6c47ff;
    --chat-secondary-color: #f5f6fa;
    --chat-accent-color: #00b894;
    --chat-danger-color: #ff7675;
    --chat-warning-color: #ffc107;
    --chat-info-color: #17a2b8;
    --chat-light-color: #f8f9fa;
    --chat-dark-color: #343a40;
    --chat-border-color: #dee2e6;
    --chat-sidebar-width: 320px; /* 增加侧边栏宽度 */
    --chat-sidebar-bg: #fff;
    --chat-sidebar-border: #ececec;
    --chat-bg: #f5f6fa;
    --chat-card-radius: 20px; /* 增加圆角 */
    --chat-shadow: 0 8px 40px 0 rgba(108, 71, 255, 0.12); /* 更好的阴影 */
    --chat-user-msg-bg: #6c47ff;
    --chat-user-msg-color: #fff;
    --chat-ai-msg-bg: #fff;
    --chat-ai-msg-color: #222;
    --chat-input-bg: #fff;
    --chat-input-border: #ececec;
    --chat-input-radius: 16px;
    
    /* 重新设计的布局 - 固定高度 */
    padding: 1.5rem;
    display: flex;
    align-items: stretch; /* 确保子元素高度一致 */
    height: 85vh; /* 固定高度，限制在视窗内 */
    min-height: 600px; /* 最小高度保证可用性 */
    max-height: 85vh; /* 最大高度不超出视窗 */
    max-width: 1600px; /* 增加最大宽度 */
    margin: 1rem auto; /* 添加上下边距 */
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 50%, #e8efff 100%); /* 渐变背景 */
    border-radius: var(--chat-card-radius);
    box-shadow: var(--chat-shadow);
    gap: 1rem; /* 添加区域间隙 */
    border: 1px solid rgba(108, 71, 255, 0.08); /* 微妙的边框 */
    position: relative;
    overflow: hidden; /* 隐藏溢出 */
}

/* 左侧会话列表 - 重新设计 */
.session-sidebar {
    width: var(--chat-sidebar-width);
    height: 100%; /* 填充父容器高度 */
    background: linear-gradient(145deg, #ffffff 0%, #f8f9ff 50%, #f0f4ff 100%);
    border-radius: var(--chat-card-radius);
    box-shadow: 
        0 4px 20px rgba(108, 71, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(108, 71, 255, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* 右侧聊天主区域 - 重新设计 */
.chat-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9ff 30%, #ffffff 100%);
    border-radius: var(--chat-card-radius);
    box-shadow: 
        0 4px 20px rgba(108, 71, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(108, 71, 255, 0.08);
    overflow: hidden;
    position: relative;
    height: 100%; /* 填充父容器高度 */
    backdrop-filter: blur(10px);
}

/* 聊天头部工具栏 - 重新设计 */
.chat-header-bar {
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.03) 0%, rgba(108, 71, 255, 0.01) 100%);
    border-bottom: 1px solid rgba(108, 71, 255, 0.08);
    border-radius: var(--chat-card-radius) var(--chat-card-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 80px;
    box-shadow: 0 2px 8px rgba(108, 71, 255, 0.06);
}

/* 会话信息显示区域 */
.session-info {
    flex: 1;
    display: flex;
    align-items: center;
}

.session-info-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.session-info-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}

.session-info-title i {
    color: #6c47ff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.session-info-details {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.session-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #718096;
    background: rgba(108, 71, 255, 0.08);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(108, 71, 255, 0.12);
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* 起始时间特殊样式 */
#session-start-time {
    font-weight: 500;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* tokens数量特殊样式 */
.session-info-item:has(#session-total-tokens) {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.06) 100%);
    border-color: rgba(34, 197, 94, 0.18);
}

.session-info-item:has(#session-total-tokens):hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.1) 100%);
    border-color: rgba(34, 197, 94, 0.25);
}

.session-info-item:has(#session-total-tokens) i {
    color: #22c55e;
}

/* 响应时间特殊样式 */
.session-info-item:has(#session-total-time) {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1) 0%, rgba(249, 115, 22, 0.06) 100%);
    border-color: rgba(249, 115, 22, 0.18);
}

.session-info-item:has(#session-total-time):hover {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0.1) 100%);
    border-color: rgba(249, 115, 22, 0.25);
}

.session-info-item:has(#session-total-time) i {
    color: #f97316;
}

/* 为起始时间的分组信息添加特殊样式 */
.session-info-item:has(#session-start-time) {
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.1) 0%, rgba(108, 71, 255, 0.06) 100%);
    border-color: rgba(108, 71, 255, 0.18);
}

.session-info-item:has(#session-start-time):hover {
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.15) 0%, rgba(108, 71, 255, 0.1) 100%);
    border-color: rgba(108, 71, 255, 0.25);
}

.session-info-item i {
    font-size: 0.75rem;
    color: #6c47ff;
    flex-shrink: 0;
}

.session-info-item:hover {
    background: rgba(108, 71, 255, 0.12);
    border-color: rgba(108, 71, 255, 0.2);
    transform: translateY(-1px);
}

/* 操作按钮区域 */
.session-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* 聊天消息区域 - 重新设计 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    position: relative;
    /* 确保在固定高度容器内正确滚动 */
    min-height: 0; /* 允许flex子项收缩 */
}

/* 输入框容器 - 重新设计 */
.chat-input-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border-top: 1px solid rgba(108, 71, 255, 0.1);
    border-radius: 0 0 var(--chat-card-radius) var(--chat-card-radius);
    padding: 20px;
    position: relative;
    flex-shrink: 0;
    box-shadow: 
        0 -2px 10px rgba(108, 71, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* 移除之前的拼接效果，采用独立卡片设计 */



.chat-form {
    display: flex;
    gap: 0.8rem;
}

.input-group {
    display: flex;
    flex: 1;
    gap: 0;
    align-items: stretch;
}

#message-input {
    flex: 1;
    resize: none;
    border: 2px solid var(--chat-primary-color);
    border-radius: 18px 0 0 18px;
    padding: 16px 20px;
    font-size: 16px;
    background: #ffffff;
    min-height: 56px;
    max-height: 160px;
    height: 56px;
    transition: all 0.3s ease;
    overflow-y: auto;
    line-height: 1.5;
    font-family: inherit;
    box-shadow: 
        0 2px 8px rgba(108, 71, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#message-input:focus {
    outline: none;
    border-color: var(--chat-primary-color);
    box-shadow: 0 0 0 3px rgba(108,71,255,0.1);
}

.send-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    border: none;
    border-radius: 0 18px 18px 0;
    background: linear-gradient(135deg, var(--chat-primary-color), #4b2fff);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 2px 8px rgba(108, 71, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.send-button:hover {
    background: #4b2fff;
}

.session-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    background: var(--sidebar-bg);
}

.session-header h5 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #222;
    letter-spacing: 2px;
    margin-bottom: 0;
    padding-left: 0.1em;
}

#new-session-btn {
    width: 100%;
    padding: 0.5rem;
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#new-session-btn:hover {
    background: #0b5ed7;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(13,110,253,0.2);
}

#new-session-btn i {
    margin-right: 0.5rem;
}

.session-list {
    /* 启用垂直滚动，禁用水平滚动 */
    overflow-y: auto;
    overflow-x: hidden;
    /* 减少底部padding，确保滚动条完全可见 */
    padding: 8px 16px 4px 16px;
    background: transparent;
    /* 使用flex: 1自动填充固定容器的剩余空间 */
    flex: 1;
    /* 确保在固定高度容器内正确滚动 */
    min-height: 0; /* 允许flex子项收缩 */
    /* 平滑滚动效果 */
    scroll-behavior: smooth;
    position: relative;
}

/* 减少底部额外间距，确保滚动条完全可见 */
.session-list::after {
    content: '';
    display: block;
    height: 4px;
    flex-shrink: 0;
}

/* 置顶会话栏样式 - 现代化设计 */
.pinned-sessions-section {
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(108, 71, 255, 0.1);
    padding-bottom: 12px;
}

.pinned-sessions-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.05), rgba(108, 71, 255, 0.1));
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid rgba(108, 71, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.pinned-sessions-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(108, 71, 255, 0.6), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.pinned-title {
    font-size: 13px;
    font-weight: 700;
    color: #6c47ff;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.pinned-title i {
    color: #6c47ff;
    font-size: 14px;
    filter: drop-shadow(0 0 4px rgba(108, 71, 255, 0.3));
}

.pinned-sessions-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pinned-sessions-content.collapsed {
    max-height: 0 !important;
    padding: 0;
    margin: 0;
    border: none;
    overflow: hidden;
}

/* 置顶组折叠图标样式 */
.pinned-sessions-header .collapse-icon {
    font-size: 12px;
    color: #6c47ff;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 0 2px rgba(108, 71, 255, 0.3));
}

.pinned-sessions-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.pinned-sessions-header:hover {
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.08), rgba(108, 71, 255, 0.12));
    border-color: rgba(108, 71, 255, 0.3);
    box-shadow: 0 4px 16px rgba(108, 71, 255, 0.15);
}

/* 置顶会话项特殊样式 - 高级视觉效果 */
.pinned-sessions-content .session-item {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 193, 7, 0.05));
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-left: 4px solid #6c47ff;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}

.pinned-sessions-content .session-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pinned-sessions-content .session-item:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.1));
    border-color: rgba(255, 152, 0, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.2);
}

.pinned-sessions-content .session-item:hover::before {
    opacity: 1;
}

.pinned-sessions-content .session-item.active {
    background: linear-gradient(135deg, #6c47ff, #4b2fff);
    color: white;
    border-color: #6c47ff;
    box-shadow: 0 10px 30px rgba(108, 71, 255, 0.3);
    transform: translateY(-1px);
}

.pinned-sessions-content .session-item.active .session-title {
    color: white;
    font-weight: 600;
}

.pinned-sessions-content .session-item.active .session-date {
    color: rgba(255, 255, 255, 0.8);
}

/* 深色主题下的置顶栏样式 */
[data-theme="dark"] .pinned-sessions-section {
    border-bottom-color: rgba(108, 71, 255, 0.2);
}

[data-theme="dark"] .pinned-sessions-header {
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.1), rgba(108, 71, 255, 0.15));
    border-color: rgba(108, 71, 255, 0.3);
}

[data-theme="dark"] .pinned-title {
    color: #8b7aff;
}

[data-theme="dark"] .pinned-title i {
    color: #8b7aff;
}

[data-theme="dark"] .pinned-sessions-content .session-item {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 193, 7, 0.03));
    border-color: rgba(255, 193, 7, 0.4);
    color: #e0e0e0;
}

[data-theme="dark"] .pinned-sessions-content .session-item:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.12), rgba(255, 152, 0, 0.08));
    border-color: rgba(255, 152, 0, 0.6);
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.15);
}

[data-theme="dark"] .pinned-sessions-content .session-item.active {
    background: linear-gradient(135deg, #6c47ff, #4b2fff);
    color: white;
    border-color: #6c47ff;
    box-shadow: 0 10px 30px rgba(108, 71, 255, 0.25);
}

/* 深色主题下的置顶组折叠样式 */
[data-theme="dark"] .pinned-sessions-header .collapse-icon {
    color: #8b7aff;
    filter: drop-shadow(0 0 2px rgba(139, 122, 255, 0.4));
}

[data-theme="dark"] .pinned-sessions-header:hover {
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.12), rgba(108, 71, 255, 0.18));
    border-color: rgba(108, 71, 255, 0.4);
    box-shadow: 0 4px 16px rgba(108, 71, 255, 0.2);
}

/* 添加侧边栏的装饰光效 */
.session-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(108, 71, 255, 0.3) 25%, 
        rgba(108, 71, 255, 0.6) 50%, 
        rgba(108, 71, 255, 0.3) 75%, 
        transparent 100%
    );
    z-index: 20;
}

/* 会话项"被吞噬"动画效果 */
@keyframes sessionDevoured {
    0% {
        opacity: 1;
        transform: scaleY(1) scaleX(1);
        filter: blur(0px);
    }
    25% {
        opacity: 0.8;
        transform: scaleY(0.95) scaleX(1.02);
        filter: blur(0.5px);
    }
    50% {
        opacity: 0.6;
        transform: scaleY(0.85) scaleX(1.05);
        filter: blur(1px);
    }
    75% {
        opacity: 0.3;
        transform: scaleY(0.6) scaleX(1.1);
        filter: blur(2px);
    }
    100% {
        opacity: 0;
        transform: scaleY(0.1) scaleX(1.2);
        filter: blur(4px);
    }
}

/* 会话项接近分组标题时的淡出效果 */
.session-item.being-devoured {
    animation: sessionDevoured 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 旧的分组标题吞噬效果已移除，使用新的顶部操作栏吞噬效果 */

/* 会话列表加载指示器 */
.sessions-loading-indicator {
    padding: 1rem;
    text-align: center;
    color: #6c47ff;
    background: rgba(108, 71, 255, 0.05);
    border-radius: 8px;
    margin: 0.5rem 0;
    position: relative;
    z-index: 50;
}

.sessions-loading-indicator .loading-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sessions-loading-indicator i {
    font-size: 0.9rem;
}

.sessions-loading-indicator span {
    font-size: 0.85rem;
    font-weight: 500;
}

/* 没有更多会话提示 */
.no-more-sessions-indicator {
    padding: 1rem;
    text-align: center;
    color: #888;
    background: rgba(136, 136, 136, 0.05);
    border-radius: 8px;
    margin: 0.5rem 0;
    position: relative;
    z-index: 50;
}

.no-more-sessions-indicator .no-more-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.no-more-sessions-indicator i {
    font-size: 0.9rem;
    color: #4caf50;
}

.no-more-sessions-indicator span {
    font-size: 0.85rem;
    font-weight: 500;
}

.session-group-header {
    font-size: 0.75rem;
    color: #888;
    margin: 1rem 0 0.5rem 0;
    padding: 0.5rem 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 0;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
    z-index: 10;
    /* 扁平化设计，类似分隔符 */
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(136, 136, 136, 0.2);
    text-transform: uppercase;
    /* 支持滚动时的隐藏动画 */
    opacity: 1;
    transform: translateY(0);
}

/* 滚动时隐藏分组标题的动画效果 */
.scrolling .session-group-header {
    opacity: 0;
    transform: translateY(-15px) scale(0.95);
    pointer-events: none;
}

/* 🚫 禁用会话项吞噬效果 - 确保所有会话都正常显示 */
.session-item.near-top-1 {
    opacity: 0.85;
    transform: scaleY(0.98);
    filter: blur(0.5px);
    transition: all 0.3s ease-out;
}

.session-item.near-top-2 {
    opacity: 0.7;
    transform: scaleY(0.95);
    filter: blur(1px);
    transition: all 0.3s ease-out;
}

.session-item.near-top-3 {
    opacity: 0.5;
    transform: scaleY(0.9);
    filter: blur(1.5px);
    transition: all 0.3s ease-out;
}

.session-item.near-top-4 {
    opacity: 0.3;
    transform: scaleY(0.8);
    filter: blur(2px);
    transition: all 0.3s ease-out;
}

.session-item.near-top-5 {
    opacity: 0.1;
    transform: scaleY(0.6);
    filter: blur(3px);
    transition: all 0.3s ease-out;
}

.session-item.being-devoured-by-top {
    opacity: 0;
    transform: scaleY(0.1) scaleX(1.2);
    filter: blur(5px);
    transition: all 0.4s ease-out;
    pointer-events: none;
}

/* 顶部吞噬动画关键帧 */
@keyframes topDevoured {
    0% {
        opacity: 1;
        transform: scaleY(1) scaleX(1);
        filter: blur(0px);
    }
    25% {
        opacity: 0.8;
        transform: scaleY(0.9) scaleX(1.03);
        filter: blur(0.5px);
    }
    50% {
        opacity: 0.5;
        transform: scaleY(0.7) scaleX(1.07);
        filter: blur(1.5px);
    }
    75% {
        opacity: 0.2;
        transform: scaleY(0.4) scaleX(1.15);
        filter: blur(3px);
    }
    100% {
        opacity: 0;
        transform: scaleY(0.1) scaleX(1.3);
        filter: blur(5px);
    }
}

/* 今天分组 - 最活跃，使用主色调 */
.session-group[data-group="今天"] .session-group-header {
    color: #6c47ff;
    border-bottom-color: rgba(108, 71, 255, 0.3);
}

/* 三天内分组 - 次活跃 */
.session-group[data-group="三天内"] .session-group-header {
    color: #5a39e6;
    border-bottom-color: rgba(90, 57, 230, 0.25);
}

/* 七天内分组 */
.session-group[data-group="七天内"] .session-group-header {
    color: #aaa;
    border-bottom-color: rgba(170, 170, 170, 0.15);
}

/* 一个月内分组 */
.session-group[data-group="一个月内"] .session-group-header {
    color: #bbb;
    border-bottom-color: rgba(187, 187, 187, 0.12);
}

/* 更早分组 */
.session-group[data-group="更早"] .session-group-header {
    color: #ccc;
    border-bottom-color: rgba(204, 204, 204, 0.1);
}

/* 简洁的悬停效果 */
.session-group-header:hover {
    color: #6c47ff;
    border-bottom-color: rgba(108, 71, 255, 0.3);
}

/* .group-title 不需要单独的CSS样式，整体由 .session-group-header 控制 */

.session-group-header .collapse-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    color: #888;
}

.session-group-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.session-group-content {
    overflow: visible;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: none; /* 移除高度限制，允许显示所有会话 */
    opacity: 1;
    /* 设置较低的z-index，让分组标题可以遮挡内容 */
    position: relative;
    z-index: 1;
}

/* 所有会话项使用统一的z-index，与分组标题在同一层级 */
.session-group .session-item {
    z-index: 10;  /* 与分组标题相同层级，通过"吞噬"效果实现视觉遮挡 */
}

.session-group-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    overflow: hidden; /* 折叠时隐藏内容 */
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 2px 8px rgba(108, 71, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    /* 确保会话项不会被内容撑开 */
    min-height: 52px;
    max-height: 64px;
    flex-shrink: 0;
    /* 与分组标题在同一层级，通过"吞噬"效果实现自然遮挡 */
    position: relative;
    z-index: 10;
    /* 为"被吞噬"效果做准备 */
    transform-origin: center top;
}

.session-item:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 16px rgba(108, 71, 255, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    border-color: rgba(108, 71, 255, 0.2);
}

.session-item.active {
    background: linear-gradient(135deg, 
        rgba(108, 71, 255, 0.1) 0%, 
        rgba(108, 71, 255, 0.05) 100%
    );
    border-color: rgba(108, 71, 255, 0.3);
    box-shadow: 
        0 4px 12px rgba(108, 71, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    color: #6c47ff;
}

.session-title {
    font-weight: 500;
    color: #333;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* 确保标题有最大宽度，避免撑开容器 */
    max-width: 160px;
    flex: 1;
    min-width: 0;
    /* 保持默认光标，用户主要是切换会话 */
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    transition: all 0.2s ease;
    user-select: none; /* 防止意外选择文本 */
}

.session-title:hover {
    background: rgba(108, 71, 255, 0.05);
    color: #6c47ff;
    transform: scale(1.02);
}

.session-date {
    font-size: 0.8rem;
    color: #b2bec3;
    margin-left: 0.5rem;
}

.session-actions {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
    min-width: 80px;
}

.session-actions button {
    border: none;
    background: none;
    color: #b2bec3;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    padding: 0.2rem 0.4rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.session-actions button:hover {
    background: #f5f6fa;
    color: var(--primary-color);
}

/* 消息样式优化 */
.message {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    max-width: 85%;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
    position: relative;
    scroll-snap-align: start;
}

.user-message {
    margin-left: auto;
    flex-direction: row-reverse;
}

.ai-message {
    margin-right: auto;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.user-message .message-avatar {
    background: var(--primary-color);
    color: #fff;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, #f0f0ff, #e8efff);
    color: var(--primary-color);
    /* AI头像电波波纹效果 */
    position: relative;
    overflow: visible;
    z-index: 1;
}

/* AI头像电波波纹效果 - 第一层 */
.ai-message .message-avatar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(108, 71, 255, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: aiWaveRipple1 2s ease-out infinite;
    z-index: -1;
}

/* AI头像电波波纹效果 - 第二层 */
.ai-message .message-avatar::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(108, 71, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: aiWaveRipple2 2s ease-out infinite 0.6s;
    z-index: -2;
}

/* 第一层波纹动画 */
@keyframes aiWaveRipple1 {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.6;
        border-width: 3px;
    }
    50% {
        width: 160%;
        height: 160%;
        opacity: 0.3;
        border-width: 2px;
    }
    100% {
        width: 220%;
        height: 220%;
        opacity: 0;
        border-width: 1px;
    }
}

/* 第二层波纹动画 */
@keyframes aiWaveRipple2 {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.5;
        border-width: 2px;
    }
    50% {
        width: 140%;
        height: 140%;
        opacity: 0.25;
        border-width: 1.5px;
    }
    100% {
        width: 200%;
        height: 200%;
        opacity: 0;
        border-width: 1px;
    }
}

/* AI头像悬停时的增强电波效果 */
.ai-message .message-avatar:hover {
    background: linear-gradient(135deg, #e8efff, #d8e3ff);
    animation: aiAvatarGlow 1.5s ease-in-out infinite;
}

@keyframes aiAvatarGlow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 0 15px rgba(108, 71, 255, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 4px 16px rgba(0,0,0,0.2), 0 0 25px rgba(108, 71, 255, 0.5);
        transform: scale(1.02);
    }
}

/* 第三层波纹效果 - 在悬停时激活 */
.ai-message .message-avatar:hover::before {
    animation: aiWaveRippleIntense1 1.5s ease-out infinite;
}

.ai-message .message-avatar:hover::after {
    animation: aiWaveRippleIntense2 1.5s ease-out infinite 0.4s;
}

/* 悬停时的强化波纹动画 */
@keyframes aiWaveRippleIntense1 {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.8;
        border-width: 4px;
        border-color: rgba(108, 71, 255, 0.6);
    }
    50% {
        width: 180%;
        height: 180%;
        opacity: 0.4;
        border-width: 2px;
        border-color: rgba(108, 71, 255, 0.4);
    }
    100% {
        width: 250%;
        height: 250%;
        opacity: 0;
        border-width: 1px;
        border-color: rgba(108, 71, 255, 0.2);
    }
}

@keyframes aiWaveRippleIntense2 {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.7;
        border-width: 3px;
        border-color: rgba(108, 71, 255, 0.5);
    }
    50% {
        width: 160%;
        height: 160%;
        opacity: 0.35;
        border-width: 2px;
        border-color: rgba(108, 71, 255, 0.3);
    }
    100% {
        width: 220%;
        height: 220%;
        opacity: 0;
        border-width: 1px;
        border-color: rgba(108, 71, 255, 0.1);
    }
}

.message-content {
    background: #fff;
    border-radius: 18px;
    padding: 1rem 1.2rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    position: relative;
    max-width: calc(100% - 60px);
}

.user-message .message-content {
    background: var(--primary-color);
    color: #fff;
    overflow-x: hidden;
    word-wrap: break-word;
    word-break: break-word;
}

.message-text {
    font-size: 0.95rem;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow-x: hidden;
    max-width: 100%;
}

/* 消息元数据区域 */
.message-meta {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.user-message .message-meta {
    color: rgba(255,255,255,0.8);
}

/* 用户消息文本防止横向滚动 */
.user-message .message-text {
    overflow-x: hidden;
    word-wrap: break-word;
    word-break: break-all;
    white-space: pre-wrap;
    max-width: 100%;
}

/* 用户消息内所有元素防止横向滚动 */
.user-message * {
    overflow-x: hidden !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    max-width: 100% !important;
}

/* 用户消息内的代码块和预格式化文本 */
.user-message pre,
.user-message code {
    overflow-x: hidden !important;
    word-wrap: break-word !important;
    word-break: break-all !important;
    white-space: pre-wrap !important;
}

/* 隐藏用户消息中的所有滚动条 */
.user-message::-webkit-scrollbar,
.user-message *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.user-message,
.user-message * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

/* 消息复制按钮 - 基础样式 */
.message-copy-button {
    margin-left: auto;  /* 推到右侧 */
    padding: 0.3rem 0.6rem;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    opacity: 1;  /* 改为始终完全显示 */
    transition: all 0.2s ease;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

/* 注释掉hover显示逻辑，让复制按钮始终可见 */
/* .message:hover .message-copy-button {
    opacity: 1;
} */

.message-copy-button i {
    font-size: 0.8rem;
}

/* 用户消息的复制按钮样式 - 优化颜色对比度 */
.user-message .message-copy-button {
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.user-message .message-copy-button:hover {
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.user-message .message-copy-button::after {
    content: "复制";
    font-size: 0.75rem;
}

/* 用户消息复制按钮图标加强 */
.user-message .message-copy-button i {
    color: #ffffff !important;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* AI消息的复制按钮样式 */
.ai-message .message-copy-button {
    background: rgba(108, 71, 255, 0.1);
    color: #6c47ff;
    border-color: rgba(108, 71, 255, 0.2);
}

.ai-message .message-copy-button:hover {
    background: #6c47ff;
    color: white;
    border-color: #6c47ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 71, 255, 0.3);
}

.ai-message .message-copy-button::after {
    content: "复制";
    font-size: 0.75rem;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-ai-wrapper {
        flex-direction: column;
        height: 95vh; /* 固定高度，适合手机屏幕 */
        max-height: 95vh;
        margin: 0.5rem;
        padding: 1rem;
        gap: 1rem;
        min-height: 500px; /* 最小高度保证可用性 */
    }
    
    .session-sidebar {
        width: 100%;
        height: 35%; /* 使用百分比，相对于父容器 */
        min-height: 200px; /* 最小高度保证可用性 */
        border-radius: var(--chat-card-radius);
        border: 1px solid rgba(108, 71, 255, 0.1);
    }
    
    .chat-main-area {
        height: 60%; /* 使用百分比，相对于父容器 */
        min-height: 300px; /* 最小高度保证可用性 */
        border-radius: var(--chat-card-radius);
    }
    
    .session-header-bar {
        padding: 15px;
        gap: 8px;
    }
    
    .session-header-bar .btn {
        font-size: 12px;
        padding: 10px 12px;
        min-height: 40px;
    }
    
    .chat-header-bar {
        padding: 12px 16px;
        min-height: 60px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .session-info-title {
        font-size: 1.1rem;
    }
    
    .session-info-details {
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .session-info-item {
        font-size: 0.75rem;
        padding: 3px 6px;
        min-width: fit-content;
    }
    
    /* 移动端时起始时间换行显示 */
    #session-start-time {
        max-width: 160px;
    }
    
    .session-actions-bar {
        align-self: flex-end;
        margin-top: -8px;
    }
    
    .chat-messages {
        padding: 16px;
        gap: 16px;
    }
    
    .chat-input-container {
        padding: 16px;
    }
    
    #message-input {
        font-size: 15px;
        padding: 12px 16px;
        min-height: 48px;
        height: 48px;
    }
    
    .send-button {
        width: 48px;
        font-size: 16px;
    }
    
    .session-list {
        overflow-y: auto;
        flex: 1;
        padding: 8px 16px 4px 16px;
    }
    
    .message {
        max-width: 95%;
    }
}

/* 其他细节优化可继续补充... */

/* 思考动画容器 */
.thinking-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    margin: 8px 0;
}

.thinking-dots {
    display: flex;
    gap: 0.25rem;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    animation: thinking 1.4s infinite ease-in-out;
}

.thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* 复制提示 */
.copy-tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10000;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.copy-tooltip.show {
    opacity: 1;
}

/* 确保消息容器不会截断提示 */
.message-content {
    position: relative;
    overflow: visible;
}

/* 为action-button添加更好的提示支持 */
.action-button {
    position: relative;
}

.action-button::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 10000;
    margin-bottom: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateX(-50%) translateY(-5px);
}

.action-button:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 加载更多按钮 */
.load-more-button {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-button:hover {
    background: var(--hover-color);
    color: white;
}

.load-more-button i {
    margin-right: 5px;
}

/* 回到底部按钮样式 - 显示在聊天区域右侧外部 */
.scroll-to-bottom-button {
    position: absolute !important;
    bottom: 100px !important;
    right: -80px !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #6c47ff, #4b2fff) !important;
    background-color: #6c47ff !important;
    color: white !important;
    border: none !important;
    border-width: 0 !important;
    cursor: pointer !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(108, 71, 255, 0.3) !important;
    transition: all 0.3s ease !important;
    z-index: 9999 !important;
    font-size: 16px !important;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    text-align: center !important;
    vertical-align: middle !important;
    text-decoration: none !important;
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900 !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    box-sizing: border-box !important;
}

/* 当按钮需要显示时 */
.scroll-to-bottom-button.show,
.scroll-to-bottom-button.visible {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

/* 悬停效果 */
.scroll-to-bottom-button:hover {
    background: linear-gradient(135deg, #4b2fff, #3517cc) !important;
    background-color: #4b2fff !important;
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 6px 16px rgba(108, 71, 255, 0.4) !important;
    color: white !important;
}

/* 点击效果 */
.scroll-to-bottom-button:active {
    background: linear-gradient(135deg, #3517cc, #2510a3) !important;
    background-color: #3517cc !important;
    transform: translateY(0) scale(0.95) !important;
    box-shadow: 0 2px 8px rgba(108, 71, 255, 0.3) !important;
    color: white !important;
}

/* 按钮内的图标 */
.scroll-to-bottom-button i,
.scroll-to-bottom-button::before {
    font-size: 16px !important;
    color: white !important;
    line-height: 1 !important;
    display: inline-block !important;
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900 !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .scroll-to-bottom-button {
        bottom: 80px !important;
        right: -60px !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        max-width: 44px !important;
        max-height: 44px !important;
        font-size: 14px !important;
    }
    
    .scroll-to-bottom-button i,
    .scroll-to-bottom-button::before {
        font-size: 14px !important;
    }
}

/* 错误提示 */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

.alert-danger {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

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

/* Markdown 样式优化 */
.markdown-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #2c3e50;
}

/* AI消息容器增强 */
.ai-message .message-text {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 1px solid rgba(108, 71, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.ai-message .message-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6c47ff, #4b2fff, #6c47ff);
    background-size: 200% 100%;
    animation: gradient-flow 3s ease-in-out infinite;
}

@keyframes gradient-flow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* 深色主题下的AI消息 */
[data-theme="dark"] .ai-message .message-text {
    background: linear-gradient(135deg, #2a2a2a, #333333);
    border-color: rgba(108, 71, 255, 0.3);
    color: #e0e0e0;
}

.markdown-body pre, .markdown-body code {
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}
.markdown-body pre {
    position: relative;
    margin: 1.5em 0;
    padding: 1.5em;
    background: linear-gradient(135deg, #0d1117, #161b22);
    border-radius: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    border: 1px solid rgba(108, 71, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: #f0f6fc;
}
.markdown-body code {
    background: #000000;
    color: #ffff00;
    border-radius: 6px;
    padding: 0.2em 0.4em;
    font-size: 0.9em;
}
.code-copy-button {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.8), rgba(75, 47, 255, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    backdrop-filter: blur(10px);
}
/* 注释掉hover显示逻辑，让代码复制按钮始终可见 */
/* .markdown-body pre:hover .code-copy-button {
    opacity: 1;
} */
.code-copy-button:hover {
    background: linear-gradient(135deg, #6c47ff, #4b2fff);
    border-color: rgba(255, 255, 255, 0.4);
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 71, 255, 0.3);
}

/* 行号样式 */
.line-numbers {
    position: relative;
    padding-left: 3.5em;
}

.line-numbers-rows {
    position: absolute;
    top: 1.5em;
    left: 0;
    width: 3em;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Monaco', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.4);
    text-align: right;
    padding-right: 0.8em;
    user-select: none;
    pointer-events: none;
    border-right: 1px solid rgba(108, 71, 255, 0.2);
}

.line-numbers-rows span {
    display: block;
    counter-increment: line;
}

.line-numbers-rows span:before {
    content: counter(line);
}

/* 深色主题下的行号 */
[data-theme="dark"] .line-numbers-rows {
    color: rgba(255, 255, 255, 0.3);
    border-right-color: rgba(108, 71, 255, 0.3);
}

/* 浅色主题下的行号 */
[data-theme="light"] .line-numbers-rows {
    color: rgba(0, 0, 0, 0.4);
    border-right-color: rgba(108, 71, 255, 0.2);
}

.markdown-body p {
    margin-bottom: 1rem;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
}

.markdown-body th, .markdown-body td {
    border: 1px solid #dee2e6;
    padding: 0.5rem;
}

.markdown-body th {
    background: #f8f9fa;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 滚动条样式 - 与会话滑块保持一致的宽度 */
.chat-messages::-webkit-scrollbar {
    width: var(--scrollbar-width);
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.08);
    border-radius: calc(var(--scrollbar-width) / 2);
    border: 1px solid rgba(108, 71, 255, 0.1);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), #4b2fff);
    border-radius: calc(var(--scrollbar-width) / 2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(108, 71, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a39e6, #3d1fe6);
    box-shadow: 0 4px 12px rgba(108, 71, 255, 0.4);
    transform: scaleX(1.15);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
    }
    
    .chat-header {
        padding: 1rem;
    }
    
    .header-left h2 {
        font-size: 1.25rem;
    }
    
    .model-selector {
        padding: 0.25rem 0.5rem;
    }
    
    .message {
        max-width: 95%;
    }
    
    .chat-messages {
        padding: 1rem;
    }
}

/* Markdown 样式 */
.markdown-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
    padding: 0.5rem;
}

.markdown-body pre {
    position: relative;
    margin: 1.5em 0;
    padding: 1.5em;
    background: linear-gradient(135deg, #0d1117, #161b22);
    border-radius: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    border: 1px solid rgba(108, 71, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: #f0f6fc;
}

.markdown-body pre code {
    color: #ffff00;
    font-family: inherit;
    font-size: inherit;
    background: none;
    padding: 0;
    border-radius: 0;
}

.markdown-body table {
    border-spacing: 0;
    border-collapse: collapse;
    margin: 16px 0;
    width: 100%;
}

.markdown-body table th,
.markdown-body table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

.markdown-body table tr {
    background-color: #fff;
    border-top: 1px solid #c6cbd1;
}

.markdown-body table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

.markdown-body blockquote {
    margin: 0;
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
}

.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 */
.message-content {
    max-width: 100%;
    overflow-x: hidden;
    padding-right: 40px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ai-message .message-text {
    padding: 0.5rem;
    background-color: var(--ai-msg-bg);
    border-radius: 8px;
}

/* 复制成功提示 */
.copy-tooltip {
    position: absolute;
    top: -35px;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

.copy-tooltip.show {
    opacity: 1;
}

/* 强制语法高亮 - 丰富的多彩配色方案 */

/* Python 关键字 */
.ai-message .message-text .markdown-body pre .hljs-keyword,
.markdown-body pre .hljs-keyword,
pre .hljs-keyword,
.hljs-built_in,
.hljs-literal { color: #ff6b9d !important; }  /* 关键字：粉红色 */

/* 字符串 */
.ai-message .message-text .markdown-body pre .hljs-string,
.markdown-body pre .hljs-string,
pre .hljs-string,
.hljs-regexp { color: #c3e88d !important; }   /* 字符串：浅绿色 */

/* 数字 */
.ai-message .message-text .markdown-body pre .hljs-number,
.markdown-body pre .hljs-number,
pre .hljs-number { color: #f78c6c !important; }   /* 数字：橙色 */

/* 注释 */
.ai-message .message-text .markdown-body pre .hljs-comment,
.markdown-body pre .hljs-comment,
pre .hljs-comment { color: #676e95 !important; }  /* 注释：灰蓝色 */

/* 函数名和方法 */
.ai-message .message-text .markdown-body pre .hljs-function,
.markdown-body pre .hljs-function,
pre .hljs-function,
.hljs-title,
.hljs-name { color: #82aaff !important; } /* 函数：蓝色 */

/* 变量名 */
.ai-message .message-text .markdown-body pre .hljs-variable,
.markdown-body pre .hljs-variable,
pre .hljs-variable,
.hljs-attr { color: #ffcb6b !important; } /* 变量：黄色 */

/* 操作符 */
.ai-message .message-text .markdown-body pre .hljs-operator,
.markdown-body pre .hljs-operator,
pre .hljs-operator { color: #89ddff !important; } /* 操作符：青色 */

/* 标点符号 */
.ai-message .message-text .markdown-body pre .hljs-punctuation,
.markdown-body pre .hljs-punctuation,
pre .hljs-punctuation { color: #ffffff !important; } /* 标点：白色 */

/* 类名 */
.ai-message .message-text .markdown-body pre .hljs-class,
.markdown-body pre .hljs-class,
pre .hljs-class,
.hljs-type { color: #ffcb6b !important; } /* 类名：黄色 */

/* HTML标签 */
.ai-message .message-text .markdown-body pre .hljs-tag,
.markdown-body pre .hljs-tag,
pre .hljs-tag,
.hljs-selector-tag { color: #ff5370 !important; } /* HTML标签：红色 */

/* HTML属性 */
.ai-message .message-text .markdown-body pre .hljs-attribute,
.markdown-body pre .hljs-attribute,
pre .hljs-attribute { color: #c792ea !important; } /* 属性：紫色 */

/* HTML属性值 */
.ai-message .message-text .markdown-body pre .hljs-value,
.markdown-body pre .hljs-value,
pre .hljs-value { color: #c3e88d !important; } /* 属性值：绿色 */

/* 导入语句 */
.ai-message .message-text .markdown-body pre .hljs-meta,
.markdown-body pre .hljs-meta,
pre .hljs-meta,
.hljs-keyword.hljs-import { color: #c792ea !important; } /* 导入：紫色 */

/* 装饰器 */
.ai-message .message-text .markdown-body pre .hljs-decorator,
.markdown-body pre .hljs-decorator,
pre .hljs-decorator { color: #ffcb6b !important; } /* 装饰器：黄色 */

/* 内置函数 */
.ai-message .message-text .markdown-body pre .hljs-built_in,
.markdown-body pre .hljs-built_in,
pre .hljs-built_in { color: #82aaff !important; } /* 内置函数：蓝色 */

/* 模块名 */
.ai-message .message-text .markdown-body pre .hljs-module,
.markdown-body pre .hljs-module,
pre .hljs-module { color: #ff6b9d !important; } /* 模块：粉红色 */

/* 参数 */
.ai-message .message-text .markdown-body pre .hljs-params,
.markdown-body pre .hljs-params,
pre .hljs-params { color: #f78c6c !important; } /* 参数：橙色 */

/* CSS选择器 */
.ai-message .message-text .markdown-body pre .hljs-selector-class,
.markdown-body pre .hljs-selector-class,
pre .hljs-selector-class,
.hljs-selector-id { color: #ffcb6b !important; } /* CSS选择器：黄色 */

/* CSS属性 */
.ai-message .message-text .markdown-body pre .hljs-property,
.markdown-body pre .hljs-property,
pre .hljs-property { color: #c792ea !important; } /* CSS属性：紫色 */

/* JavaScript关键字 */
.ai-message .message-text .markdown-body pre .hljs-keyword.hljs-var,
.markdown-body pre .hljs-keyword.hljs-var,
pre .hljs-keyword.hljs-var,
.hljs-keyword.hljs-let,
.hljs-keyword.hljs-const { color: #ff6b9d !important; } /* JS关键字：粉红色 */

/* 默认文本 */
.ai-message .message-text .markdown-body pre,
.markdown-body pre,
pre { color: #ffffff !important; } /* 默认文本：白色 */

/* 列表样式 */
.markdown-body ul,
.markdown-body ol {
    padding-left: 2em;
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-body li {
    margin-top: 0.25em;
}

/* 标题样式 */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    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;
}

/* 思考动画容器 */
.thinking-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    margin: 8px 0;
}

/* 思考动画点 */
.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: thinking 1.4s infinite ease-in-out;
}

.thinking-dot:nth-child(1) {
    animation-delay: 0s;
}

.thinking-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* 思考文本 */
.thinking-text {
    color: #666;
    font-size: 14px;
    margin-left: 4px;
}

/* 确保思考动画在AI消息中正确显示 */
.message.ai-message .thinking-container {
    margin-left: 48px;  /* 与头像对齐 */
}

/* 淡入效果 */
.thinking-container.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* 没有更多消息提示 */
.no-more-messages {
    text-align: center;
    padding: 12px;
    margin: 10px 0;
    color: #666;
    font-size: 0.9rem;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease-in-out;
}

.no-more-messages i {
    margin-right: 5px;
    color: #4CAF50;
}

/* 加载更多按钮样式 */
.load-more-button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-button:hover {
    background: var(--hover-color);
    color: white;
}

.load-more-button i {
    margin-right: 5px;
}

/* 加载中动画 */
.loading-more {
    text-align: center;
    padding: 10px;
    color: var(--text-color);
    font-size: 0.9rem;
}

.loading-more i {
    margin-right: 5px;
}

/* 确保加载更多按钮在消息列表顶部 */
.chat-messages {
    display: flex;
    flex-direction: column;
}

.load-more-button,
.loading-more,
.no-more-messages {
    order: -1;
    margin-bottom: 1rem;
}

/* 添加按钮出现和消失的动画 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.scroll-to-bottom-button.visible {
    animation: slideUp 0.3s ease forwards;
}

.scroll-to-bottom-button:not(.visible) {
    animation: slideDown 0.3s ease forwards;
}

.always-visible {
    opacity: 1 !important;
    pointer-events: auto !important;
    transition: none !important;
}

/* 会话列表滚动条样式优化 
 * - 桌面端14px宽，移动端10px宽，便于操作
 * - 滑块最小高度：桌面端20px，移动端25px
 * - 滑块大小会根据内容量自适应：内容越多，滑块越小，滚动越精确
 * - 当会话数量很大时，滑块可以变得很小，提供精确的滚动控制
 */
.session-list::-webkit-scrollbar {
    width: var(--scrollbar-width);
    background: transparent;
}

.session-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.08);
    border-radius: calc(var(--scrollbar-width) / 2);
    margin: var(--scrollbar-track-margin);
    border: 1px solid rgba(108, 71, 255, 0.1);
}

.session-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), #4b2fff);
    border-radius: calc(var(--scrollbar-width) / 2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(108, 71, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    /* 让滑块可以根据内容量自适应变小，最小值保证可点击性 */
    min-height: var(--scrollbar-thumb-min-height);
    /* 当会话很多时，滑块会自动变得更小，提供更精确的滚动控制 */
    /* 内容比例：当内容高度是容器的10倍时，滑块大约是容器高度的1/10 */
}

.session-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a39e6, #3d1fe6);
    box-shadow: 0 4px 12px rgba(108, 71, 255, 0.4);
    transform: scaleX(1.15);
    border-color: rgba(255, 255, 255, 0.5);
    /* 悬停时稍微增大滑块，便于精确操作 */
}

.session-list::-webkit-scrollbar-thumb:active {
    background: linear-gradient(135deg, #4b2fff, #2a1acc);
    box-shadow: 0 2px 8px rgba(108, 71, 255, 0.5);
    transform: scaleX(1.2);
    /* 激活时进一步增大，提供清晰的操作反馈 */
}

.session-title-container {
    flex: 1;
    min-width: 0;
    position: relative;
}

.session-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 4px 0;
}

.session-title-edit {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #4a9eff;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    background: #fff;
    color: #333;
    outline: none;
    cursor: text; /* 编辑模式下确保文本光标 */
}

.session-title-edit:focus {
    border-color: #4a9eff;
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

/* 模态对话框样式 */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.modal-container.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-dialog {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 10000;
    pointer-events: auto;
}

.modal-container.show .modal-dialog {
    transform: translateY(0);
}

.modal-header {
    margin-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.modal-body {
    margin-bottom: 1.5rem;
    color: #4b5563;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-button {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    min-width: 80px;
    position: relative;
    z-index: 10001;
}

.modal-button:active {
    transform: scale(0.98);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.modal-button.cancel {
    background-color: #f3f4f6;
    color: #4b5563;
}

.modal-button.cancel:hover {
    background-color: #e5e7eb;
}

.modal-button.confirm {
    background-color: #dc2626;
    color: white;
}

.modal-button.confirm:hover {
    background-color: #b91c1c;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-ai-wrapper {
        flex-direction: column;
        height: 90vh;
        padding: 0;
        border-radius: 0 0 var(--chat-card-radius) var(--chat-card-radius);
    }
    
    .session-sidebar {
        width: 100%;
        height: 30vh;
        border-radius: 0;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        border-radius: var(--chat-card-radius) var(--chat-card-radius) 0 0;
    }
    
    .chat-main-area {
        border-radius: 0 0 var(--chat-card-radius) var(--chat-card-radius);
    }
    
    .session-list {
        /* max-height: 200px; */ /* 移除高度限制，显示所有会话 */
        /* overflow-y: auto; */ /* 移除滚动条 */
        overflow-y: visible;
    }
    
    .chat-messages {
        height: calc(70vh - 250px);
        min-height: 250px;
        max-height: calc(70vh - 250px);
        padding: 1rem;
    }
    
    .message {
        max-width: 95%;
    }
}

/* 强制代码块样式 - 使用!important确保生效 */
.ai-message .message-text .markdown-body pre,
.markdown-body pre,
pre {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-radius: 12px !important;
    padding: 1.2rem 1.5rem !important;
    margin: 1.2em 0 !important;
    font-size: 0.95rem !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    word-break: break-all !important;
    position: relative !important;
    box-shadow: 0 2px 12px 0 rgba(80,80,120,0.10) !important;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', 'monospace' !important;
}

/* 强制行内代码样式 */
.ai-message .message-text .markdown-body code,
.markdown-body code,
code {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-radius: 6px !important;
    padding: 0.2em 0.4em !important;
    font-size: 0.9em !important;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', 'monospace' !important;
}

/* 强制代码块内的代码样式 */
.ai-message .message-text .markdown-body pre code,
.markdown-body pre code,
pre code {
    background: none !important;
    background-color: transparent !important;
    color: #ffff00 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-family: inherit !important;
    font-size: inherit !important;
}

/* 代码块样式更新 - 强制刷新缓存 */

/* 语法高亮更新 v2.0 - 多彩配色方案 */

/* 复制按钮优化更新 v1.1 - 更明显的样式 */

/* 表格包装器和标题样式 */
.table-wrapper {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    background: white;
}

.table-title {
    background: linear-gradient(135deg, #6c47ff, #4b2fff);
    color: white;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: none;
}

/* 数学公式错误样式 */
.katex-error {
    background: linear-gradient(135deg, #ffebee, #fef5f5);
    border: 1px solid #f44336;
    border-radius: 6px;
    padding: 8px 12px;
    color: #c62828;
    font-family: monospace;
    font-size: 0.9rem;
    margin: 4px 0;
    display: inline-block;
}

/* 代码块容器增强 - 修复换行显示 */
.ai-message .message-text .markdown-body pre,
.markdown-body pre,
pre {
    position: relative;
    margin: 1.2em 0 !important;
    padding: 1.5rem !important;
    background: linear-gradient(135deg, #1a1a1a, #000000) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
    border: 1px solid #333 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    word-break: break-all !important;
}

/* 代码复制按钮增强 */
.code-copy-button {
    position: absolute !important;
    top: 12px !important;
    right: 16px !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1)) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 8px !important;
    color: #ffff00 !important;
    cursor: pointer !important;
    opacity: 0.7 !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
    backdrop-filter: blur(10px) !important;
}

.code-copy-button:hover {
    opacity: 1 !important;
    background: linear-gradient(135deg, #6c47ff, #4b2fff) !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(108, 71, 255, 0.3) !important;
}

.code-copy-button i {
    font-size: 14px !important;
}

/* Mermaid 容器样式增强 */
.mermaid-container,
.mindmap-container {
    background: linear-gradient(135deg, #f8f9ff, #ffffff);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(108, 71, 255, 0.1);
    border: 2px solid rgba(108, 71, 255, 0.1);
    position: relative;
}

.mindmap-container h4,
.mermaid-container h4 {
    margin: 0 0 16px 0;
    color: #6c47ff;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mindmap-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6c47ff, #4b2fff, #ff6b9d);
    border-radius: 16px 16px 0 0;
}

/* 图表容器样式 */
.chart-container {
    background: linear-gradient(135deg, #ffffff, #f8f9ff);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    border: 2px solid rgba(108, 71, 255, 0.1);
    position: relative;
}

.chart-container h4 {
    margin: 0 0 20px 0;
    color: #6c47ff;
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(108, 71, 255, 0.1);
}

.chart-container canvas {
    max-height: 400px !important;
    border-radius: 8px;
}

/* 绘画容器样式 */
.drawing-container {
    background: linear-gradient(135deg, #ffffff, #f0f8ff);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    border: 2px solid rgba(108, 71, 255, 0.1);
    text-align: center;
    position: relative;
}

.drawing-container h4 {
    margin: 0 0 16px 0;
    color: #6c47ff;
    font-weight: 600;
    font-size: 1.1rem;
}

.drawing-canvas {
    border: 2px dashed rgba(108, 71, 255, 0.3);
    border-radius: 12px;
    margin: 16px 0;
    padding: 16px;
    background: rgba(108, 71, 255, 0.02);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawing-canvas svg {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* 任务列表样式增强 */
.markdown-body .task-list-item {
    list-style-type: none;
    margin-left: -20px;
    padding: 8px 0;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.markdown-body .task-list-item:hover {
    background: rgba(108, 71, 255, 0.05);
    padding-left: 8px;
    border-radius: 8px;
    margin-left: -28px;
}

.markdown-body .task-list-item input[type="checkbox"] {
    margin-right: 12px;
    margin-left: 0;
    transform: scale(1.3);
    accent-color: #6c47ff;
    cursor: pointer;
}

.markdown-body .task-list-item input[type="checkbox"]:checked + span {
    text-decoration: line-through;
    color: #666;
    opacity: 0.8;
}

.markdown-body .task-list-item span {
    flex: 1;
}

/* 脚注样式增强 */
.markdown-body .footnotes {
    border-top: 3px solid #6c47ff;
    margin-top: 32px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.02), rgba(108, 71, 255, 0.05));
    border-radius: 12px;
    font-size: 0.9em;
    position: relative;
}

.markdown-body .footnotes::before {
    content: '📝 脚注';
    position: absolute;
    top: -12px;
    left: 20px;
    background: white;
    color: #6c47ff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 2px solid #6c47ff;
}

.markdown-body .footnote-ref {
    color: #6c47ff;
    text-decoration: none;
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.1), rgba(108, 71, 255, 0.15));
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.2s ease;
}

.markdown-body .footnote-ref:hover {
    text-decoration: none;
    background: linear-gradient(135deg, #6c47ff, #4b2fff);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 71, 255, 0.3);
}

/* 警告框样式增强 */
.markdown-body .alert {
    padding: 20px 24px;
    margin: 20px 0;
    border-left: 5px solid #ddd;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
    overflow: hidden;
}

.markdown-body .alert::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    border-radius: 0 12px 12px 0;
}

.markdown-body .alert strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.markdown-body .alert-info {
    background: linear-gradient(135deg, #e3f2fd, #f0f8ff);
    border-left-color: #2196F3;
    color: #1565C0;
}

.markdown-body .alert-info::before {
    background: linear-gradient(180deg, #2196F3, #1976D2);
}

.markdown-body .alert-warning {
    background: linear-gradient(135deg, #fff8e1, #fffef7);
    border-left-color: #FF9800;
    color: #E65100;
}

.markdown-body .alert-warning::before {
    background: linear-gradient(180deg, #FF9800, #F57C00);
}

.markdown-body .alert-error {
    background: linear-gradient(135deg, #ffebee, #fef5f5);
    border-left-color: #f44336;
    color: #c62828;
}

.markdown-body .alert-error::before {
    background: linear-gradient(180deg, #f44336, #d32f2f);
}

.markdown-body .alert-success {
    background: linear-gradient(135deg, #e8f5e8, #f1f8e9);
    border-left-color: #4caf50;
    color: #2e7d32;
}

.markdown-body .alert-success::before {
    background: linear-gradient(180deg, #4caf50, #388e3c);
}

/* 数学公式容器样式增强 */
.katex-display {
    margin: 20px 0 !important;
    padding: 20px !important;
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.03), rgba(108, 71, 255, 0.06)) !important;
    border-radius: 12px !important;
    border-left: 4px solid #6c47ff !important;
    box-shadow: 0 4px 16px rgba(108, 71, 255, 0.1) !important;
    position: relative;
    overflow-x: auto;
}

.katex-display::before {
    content: '🧮';
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 1.2rem;
    opacity: 0.6;
}

.katex-inline {
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.08), rgba(108, 71, 255, 0.12)) !important;
    padding: 3px 6px !important;
    border-radius: 6px !important;
    margin: 0 2px !important;
    border: 1px solid rgba(108, 71, 255, 0.2);
}

/* 表格样式进一步增强 */
.markdown-body table {
    border-collapse: collapse;
    margin: 16px 0;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-radius: 12px;
    overflow: hidden;
    background: white;
}

.markdown-body table th {
    background: linear-gradient(135deg, #6c47ff, #4b2fff);
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 16px;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.markdown-body table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.markdown-body table tr:nth-child(even) {
    background: linear-gradient(135deg, #f8f9ff, #ffffff);
}

.markdown-body table tr:hover {
    background: linear-gradient(135deg, #f0f0ff, #f8f9ff);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 71, 255, 0.1);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .chart-container,
    .drawing-container,
    .mindmap-container,
    .mermaid-container {
        padding: 16px;
        margin: 16px 0;
    }
    
    .chart-container h4,
    .drawing-container h4,
    .mindmap-container h4 {
        font-size: 1rem;
    }
    
    .katex-display {
        padding: 16px !important;
        margin: 16px 0 !important;
    }
    
    .markdown-body table {
        font-size: 0.85rem;
    }
    
    .markdown-body table th,
    .markdown-body table td {
        padding: 10px 8px;
    }
}

/* 键盘快捷键样式 */
.keyboard-key,
.keyboard-combo kbd {
    display: inline-block;
    padding: 3px 6px;
    margin: 0 2px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em;
    font-weight: 600;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.8);
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
    white-space: nowrap;
}

.keyboard-combo {
    display: inline-block;
    white-space: nowrap;
}

.keyboard-combo kbd + kbd::before {
    content: '+';
    margin: 0 2px;
    color: #666;
}

/* 时间和日期样式 */
.datetime,
.date,
.time {
    display: inline-block;
    padding: 2px 6px;
    background: linear-gradient(135deg, #e3f2fd, #f0f8ff);
    color: #1565C0;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid rgba(21, 101, 192, 0.2);
    cursor: help;
}

.datetime::before {
    content: '📅 ';
}

.date::before {
    content: '📆 ';
}

.time::before {
    content: '🕐 ';
}

/* 用户提及和标签样式 */
.user-mention {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #6c47ff, #4b2fff);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9em;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-mention:hover {
    background: linear-gradient(135deg, #4b2fff, #6c47ff);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 71, 255, 0.3);
}

.topic-tag {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #ff6b9d, #ff4081);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9em;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topic-tag:hover {
    background: linear-gradient(135deg, #ff4081, #ff6b9d);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 157, 0.3);
}

/* 变量和占位符样式 */
.variable-placeholder,
.variable-single {
    display: inline-block;
    padding: 2px 6px;
    background: linear-gradient(135deg, #fff3e0, #ffeaa7);
    color: #e65100;
    border: 1px solid rgba(230, 81, 0, 0.3);
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    font-weight: 600;
    cursor: help;
}

.env-variable {
    display: inline-block;
    padding: 2px 6px;
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    color: #2e7d32;
    border: 1px solid rgba(46, 125, 50, 0.3);
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    font-weight: 600;
    cursor: help;
}

/* Emoji样式 */
.emoji {
    font-size: 1.2em;
    display: inline-block;
    margin: 0 2px;
    cursor: help;
    transition: transform 0.2s ease;
}

.emoji:hover {
    transform: scale(1.2);
}

/* 折叠内容样式 */
.collapsible-content {
    margin: 16px 0;
    border: 2px solid rgba(108, 71, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 16px rgba(108, 71, 255, 0.1);
}

.collapsible-summary {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9ff, #f0f0ff);
    color: #6c47ff;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    user-select: none;
}

.collapsible-summary::before {
    content: '▶';
    margin-right: 10px;
    transition: transform 0.2s ease;
    font-size: 0.8em;
}

.collapsible-content[open] .collapsible-summary::before {
    transform: rotate(90deg);
}

.collapsible-summary:hover {
    background: linear-gradient(135deg, #f0f0ff, #e8e8ff);
}

.collapsible-body {
    padding: 20px;
    border-top: 1px solid rgba(108, 71, 255, 0.2);
    background: white;
}

/* ASCII艺术样式 */
.ascii-art {
    background: linear-gradient(135deg, #2a2a2a, #1e1e1e) !important;
    border: 2px solid #444 !important;
    border-radius: 12px !important;
    padding: 20px !important;
    margin: 20px 0 !important;
    font-family: 'Courier New', 'Monaco', 'Consolas', monospace !important;
    font-size: 0.8em !important;
    line-height: 1.2 !important;
    color: #00ff00 !important;
    overflow-x: auto !important;
    text-align: center !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
    position: relative;
}

.ascii-art::before {
    content: '🎨 ASCII Art';
    position: absolute;
    top: -12px;
    left: 20px;
    background: #2a2a2a;
    color: #00ff00;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 2px solid #444;
}

.ascii-art code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    border: none !important;
    font-family: inherit !important;
    white-space: pre !important;
}

/* 引用块增强样式 */
.quote-level-1 {
    border-left: 4px solid #6c47ff;
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.05), rgba(108, 71, 255, 0.08));
    margin: 16px 0;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    position: relative;
}

.quote-level-2 {
    border-left: 4px solid #ff6b9d;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.05), rgba(255, 107, 157, 0.08));
    margin: 16px 0;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
}

.quote-level-3 {
    border-left: 4px solid #4ecdc4;
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.05), rgba(78, 205, 196, 0.08));
    margin: 16px 0;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
}

.quote-level-1::before {
    content: '"';
    position: absolute;
    left: -2px;
    top: -10px;
    font-size: 3em;
    color: #6c47ff;
    opacity: 0.3;
    font-family: serif;
}

/* 链接增强样式 */
.auto-link {
    color: #6c47ff;
    text-decoration: none;
    border-bottom: 1px dashed #6c47ff;
    transition: all 0.2s ease;
    word-break: break-all;
}

.auto-link:hover {
    color: #4b2fff;
    border-bottom-color: #4b2fff;
    background: rgba(108, 71, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    border-bottom-style: solid;
}

.email-link {
    color: #ff6b9d;
    text-decoration: none;
    border-bottom: 1px dashed #ff6b9d;
    transition: all 0.2s ease;
}

.email-link:hover {
    color: #ff4081;
    border-bottom-color: #ff4081;
    background: rgba(255, 107, 157, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    border-bottom-style: solid;
}

.email-link::before {
    content: '📧 ';
    font-size: 0.9em;
}

.file-icon {
    margin-right: 6px;
    color: #666;
}

/* 特殊文本格式样式 */
.highlight {
    background: linear-gradient(135deg, #ffeb3b, #ffc107);
    color: #333;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
}

.small-text {
    font-size: 0.8em;
    color: #666;
}

.inserted-text {
    background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
    color: #2e7d32;
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 4px;
}

/* 分隔线样式 */
.hr-solid {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #6c47ff, transparent);
    margin: 24px 0;
}

.hr-dotted {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ff6b9d, transparent);
    margin: 24px 0;
    background-image: radial-gradient(circle, #ff6b9d 1px, transparent 1px);
    background-size: 8px 2px;
    background-repeat: repeat-x;
}

.hr-dashed {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, #4ecdc4 20%, transparent 20%, transparent 40%, #4ecdc4 40%, #4ecdc4 60%, transparent 60%, transparent 80%, #4ecdc4 80%);
    background-size: 20px 2px;
    background-repeat: repeat-x;
    margin: 24px 0;
}

.hr-double {
    border: none;
    height: 4px;
    background: linear-gradient(90deg, transparent, #6c47ff, transparent);
    margin: 24px 0;
    position: relative;
}

.hr-double::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #6c47ff, transparent);
}

/* 图片增强样式 */
.content-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.content-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.image-figure {
    margin: 20px 0;
    text-align: center;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.image-figure figcaption {
    margin-top: 12px;
    color: #666;
    font-style: italic;
    font-size: 0.9em;
}

/* 上标下标样式优化 */
sub, sup {
    font-size: 0.7em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
    padding: 1px 2px;
    background: rgba(108, 71, 255, 0.1);
    border-radius: 3px;
    margin: 0 1px;
}

sub {
    bottom: -0.25em;
}

sup {
    top: -0.5em;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .keyboard-key,
    .keyboard-combo kbd {
        padding: 2px 4px;
        font-size: 0.8em;
    }
    
    .ascii-art {
        font-size: 0.6em !important;
        padding: 12px !important;
    }
    
    .collapsible-summary {
        padding: 12px 16px;
        font-size: 0.9em;
    }
    
    .collapsible-body {
        padding: 16px;
    }
    
    .quote-level-1,
    .quote-level-2,
    .quote-level-3 {
        padding: 12px 16px;
        margin: 12px 0;
    }
    
    .image-figure {
        padding: 12px;
        margin: 16px 0;
    }
} 

/* 数学公式样式 - 修复KaTeX渲染 */
.katex-display-wrapper {
    margin: 16px 0;
    text-align: center;
    background: rgba(108, 71, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #6c47ff;
}

.katex-inline-wrapper {
    background: rgba(108, 71, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    margin: 0 2px;
    display: inline-block;
}

.katex-error {
    color: #dc3545;
    background: #f8d7da;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    font-family: monospace;
    font-size: 0.9em;
}

/* 确保KaTeX字体正确加载 */
.katex {
    font-size: 1.1em !important;
    line-height: 1.2 !important;
}

.katex .katex-mathml {
    display: none;
}

/* 针对行内和块级公式的特殊处理 */
.markdown-body .katex-display-wrapper .katex {
    font-size: 1.2em !important;
}

.markdown-body .katex-inline-wrapper .katex {
    font-size: 1em !important;
}

/* 键盘快捷键样式 */
.keyboard-combo {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-family: inherit;
}

.keyboard-combo kbd {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #495057;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.85em;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    min-width: 20px;
    text-align: center;
}

.keyboard-combo .plus {
    color: #6c757d;
    font-weight: 400;
    margin: 0 2px;
}

/* 时间日期样式 */
.datetime, .date, .time {
    background: linear-gradient(135deg, #e3f2fd, #f0f8ff);
    color: #1565c0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid #bbdefb;
    white-space: nowrap;
}

.datetime:hover, .date:hover, .time:hover {
    background: linear-gradient(135deg, #bbdefb, #e3f2fd);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* 用户提及和标签样式优化 */
.user-mention {
    background: linear-gradient(135deg, #e8f5e8, #f1f8e9);
    color: #2e7d32;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 600;
    border: 1px solid #c8e6c9;
    text-decoration: none;
}

.user-mention:hover {
    background: linear-gradient(135deg, #c8e6c9, #e8f5e8);
    color: #1b5e20;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

.topic-tag {
    background: linear-gradient(135deg, #fff3e0, #ffeaa7);
    color: #ef6c00;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 600;
    border: 1px solid #ffcc02;
    text-decoration: none;
}

.topic-tag:hover {
    background: linear-gradient(135deg, #ffcc02, #fff3e0);
    color: #e65100;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

/* 变量占位符样式 */
.variable-placeholder {
    background: linear-gradient(135deg, #f3e5f5, #fce4ec);
    color: #7b1fa2;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid #ce93d8;
    font-weight: 500;
}

.env-variable {
    background: linear-gradient(135deg, #fff8e1, #fffef7);
    color: #f57f17;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid #fff176;
    font-weight: 600;
}

/* Emoji样式 */
.emoji {
    font-size: 1.1em;
    margin: 0 1px;
    vertical-align: baseline;
}

.emoji:hover {
    transform: scale(1.2);
    transition: transform 0.2s ease;
}

/* 处理阶段提示（开发调试用） */
.processing-stage {
    background: rgba(108, 71, 255, 0.1);
    border-left: 3px solid #6c47ff;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    font-size: 0.85em;
    color: #5a2d91;
    display: none; /* 生产环境隐藏 */
}

/* 响应式优化 */
@media (max-width: 768px) {
    .keyboard-combo kbd {
        padding: 1px 4px;
        font-size: 0.8em;
    }
    
    .datetime, .date, .time {
        font-size: 0.8em;
        padding: 1px 4px;
    }
    
    .user-mention, .topic-tag {
        font-size: 0.85rem;
        padding: 2px 6px;
    }
    
    .variable-placeholder, .env-variable {
        font-size: 0.85rem;
        padding: 2px 6px;
    }
}

/* AI消息功能按钮样式 */
.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.message-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: #666;
}

.message-info span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.message-info i {
    font-size: 0.8rem;
    opacity: 0.7;
}

.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 1;  /* 改为始终显示，不再是0 */
    transition: opacity 0.2s ease;
}

/* 注释掉hover显示逻辑，让按钮始终可见 */
/* .message:hover .message-actions {
    opacity: 1;
} */

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    position: relative;
}

.action-button:hover {
    background: rgba(108, 71, 255, 0.1);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.action-button:active {
    transform: translateY(0);
}

/* 特定按钮颜色 */
.action-button.regenerate-button:hover {
    background: rgba(0, 184, 148, 0.1);
    color: var(--accent-color);
}

.action-button.like-button:hover,
.action-button.like-button.active {
    background: rgba(0, 184, 148, 0.1);
    color: var(--accent-color);
}

.action-button.dislike-button:hover,
.action-button.dislike-button.active {
    background: rgba(255, 118, 117, 0.1);
    color: var(--danger-color);
}

.action-button.copy-button:hover {
    background: rgba(23, 162, 184, 0.1);
    color: var(--info-color);
}

.action-button.share-button:hover {
    background: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
}

/* 活跃状态 */
.action-button.active {
    background: rgba(108, 71, 255, 0.1);
    color: var(--primary-color);
}

.action-button.like-button.active {
    background: rgba(0, 184, 148, 0.15);
    color: var(--accent-color);
}

.action-button.dislike-button.active {
    background: rgba(255, 118, 117, 0.15);
    color: var(--danger-color);
}

/* 提示工具 */
.action-button::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 10000;
    margin-bottom: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateX(-50%) translateY(-5px);
}

.action-button:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 思考指示器样式 */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(108, 71, 255, 0.05);
    border: 1px solid rgba(108, 71, 255, 0.1);
    border-radius: 12px;
    margin: 8px 0;
    color: #666;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}

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

.thinking-indicator .thinking-dot {
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: thinking 1.4s infinite ease-in-out;
}

.thinking-indicator .thinking-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-indicator .thinking-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.thinking-indicator .thinking-text {
    color: var(--primary-color);
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .message-meta {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .message-info {
        justify-content: center;
        gap: 12px;
    }
    
    .message-actions {
        justify-content: center;
        opacity: 1;
    }
    
    .action-button {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .action-button::after {
        display: none;
    }
    
    .thinking-indicator {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
}

/* 会话头部操作栏样式 - 简洁设计 */
.session-header-bar {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.05) 0%, rgba(108, 71, 255, 0.02) 100%);
    border-bottom: 1px solid rgba(108, 71, 255, 0.1);
    border-radius: var(--chat-card-radius) var(--chat-card-radius) 0 0;
    align-items: center;
    flex-shrink: 0;
    min-height: 60px;
    position: relative;
    z-index: 10;
}

/* 移除装饰线，保持简洁 */

/* 移除复杂的吞噬效果，保持简洁设计 */

.session-header-bar .btn {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(108, 71, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    min-height: 44px;
    box-shadow: 
        0 2px 8px rgba(108, 71, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 新建会话按钮 - 主要操作 */
.session-header-bar .btn-outline-primary {
    background: linear-gradient(135deg, #6c47ff, #4b2fff);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(108, 71, 255, 0.3);
}

.session-header-bar .btn-outline-primary:hover {
    background: linear-gradient(135deg, #5a39e6, #3d1fe6);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 71, 255, 0.4);
}

.session-header-bar .btn-outline-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(108, 71, 255, 0.3);
}

/* 展开/折叠按钮 - 次要操作 */
.session-header-bar .btn-outline-secondary {
    background: linear-gradient(135deg, #ffffff, #f8f9ff);
    color: #6c47ff;
    border-color: rgba(108, 71, 255, 0.2);
}

.session-header-bar .btn-outline-secondary:hover {
    background: linear-gradient(135deg, #6c47ff, #4b2fff);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 71, 255, 0.25);
}

.session-header-bar .btn-outline-secondary:active {
    transform: translateY(0);
}

/* 清空按钮 - 危险操作 */
.session-header-bar .btn-outline-danger {
    background: linear-gradient(135deg, #ffffff, #fef5f5);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.2);
}

.session-header-bar .btn-outline-danger:hover {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
}

.session-header-bar .btn-outline-danger:active {
    transform: translateY(0);
}

/* 按钮图标和文字水平布局优化 */
.session-header-bar .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    text-align: center;
}

.session-header-bar .btn i {
    font-size: 12px;
    transition: transform 0.3s ease;
    margin: 0;
    flex-shrink: 0;
}

.session-header-bar .btn:hover i {
    transform: scale(1.1);
}

.session-header-bar .btn span {
    display: inline-block;
    line-height: 1;
    font-size: 11px;
    font-weight: 600;
}

/* 按钮涟漪效果 */
.session-header-bar .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.session-header-bar .btn:active::before {
    width: 300px;
    height: 300px;
}

/* 模态框默认聚焦按钮样式 */
.modal-button.default-focus {
    outline: 2px solid #6c47ff;
    outline-offset: 2px;
}

.modal-button.default-focus:focus {
    outline: 2px solid #6c47ff;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(108, 71, 255, 0.2);
}

/* 移动端优化 */
@media (max-width: 768px) {
    /* 会话头部操作栏移动端样式 */
    .session-header-bar {
        padding: 10px;
        gap: 6px;
        min-height: 50px;
    }
    
    .session-header-bar .btn {
        flex: 0 0 calc(33.333% - 4px);
        width: calc(33.333% - 4px);
        font-size: 11px;
        padding: 6px 2px;
        border-radius: 8px;
        min-height: 36px;
        gap: 3px;
    }
    
    .session-header-bar .btn i {
        font-size: 11px;
    }
    
    .session-header-bar .btn span {
        font-size: 10px;
    }
    
    /* 移动端会话列表滚动修复 - 支持滚动加载更多 */
    /* 已经在前面的移动端@media查询中定义了，这里注释掉避免冲突 */
    /*
    .session-list {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        max-height: calc(30vh - 60px) !important;
        min-height: 150px !important;
        padding: 1rem 1rem 0 1rem !important;
        scrollbar-width: thin;
        scrollbar-color: #6c47ff rgba(0, 0, 0, 0.1);
    }
    */
    
    /* 移动端分组标题调整 */
    .session-group-header {
        margin-left: -1rem !important;
        margin-right: -1rem !important;
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
        font-size: 0.8rem !important;
    }
    
    /* 确保滚动功能在移动端正常工作 - 最高优先级 */
    /* 移动端session-list的底部间距 */
    .session-list::after {
        height: 0.5rem;
    }
    
    /* 移动端滚动条样式 - 适中宽度便于触摸操作 */
    .session-list::-webkit-scrollbar {
        width: 10px !important;
    }
    
    .session-list::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.08) !important;
        border-radius: 5px !important;
        margin: var(--scrollbar-track-margin-mobile) !important;
        border: 1px solid rgba(108, 71, 255, 0.1) !important;
    }
    
    .session-list::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, var(--primary-color), #4b2fff) !important;
        border-radius: 5px !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        /* 移动端滑块最小高度，便于触摸操作但允许自适应变小 */
        min-height: var(--scrollbar-thumb-min-height-mobile) !important;
        box-shadow: 0 2px 4px rgba(108, 71, 255, 0.3) !important;
    }
    
    .session-list::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, #5a39e6, #3d1fe6) !important;
        transform: scaleX(1.1) !important;
        border-color: rgba(255, 255, 255, 0.4) !important;
    }
    
    /* 移动端隐藏连接效果 */
    .chat-input-container::before {
        display: none;
    }
}

/* 确认消息样式 */
.confirm-message {
    text-align: left;
    line-height: 1.6;
}

.confirm-message p {
    margin: 8px 0;
}

.confirm-message i {
    margin-right: 6px;
}

/* 置顶图标样式 */
.pin-btn {
    border: none;
    background: none;
    color: #b2bec3;
    border-radius: 6px;
    transition: all 0.3s ease;
    padding: 0.2rem 0.4rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
}

.pin-btn:hover {
    background: rgba(108, 71, 255, 0.1);
}

/* 未置顶状态的图钉 - 斜着的，灰色 */
.pin-btn .unpinned-icon {
    transform: rotate(45deg);
    color: #999;
    transition: all 0.3s ease;
    font-size: 12px;
}

.pin-btn:hover .unpinned-icon {
    color: #6c47ff;
    transform: rotate(45deg) scale(1.1);
}

/* 置顶状态的图钉 - 立起来的，彩色 */
.pin-btn .pinned-icon {
    transform: rotate(0deg);
    color: #ff6b35;
    transition: all 0.3s ease;
    font-size: 12px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 2px rgba(255, 107, 53, 0.4));
}

.pin-btn.pinned {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.2);
}

.pin-btn.pinned:hover {
    background: rgba(255, 107, 53, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.2);
}

.pin-btn.pinned:hover .pinned-icon {
    transform: rotate(0deg) scale(1.1);
    filter: drop-shadow(0 0 4px rgba(255, 107, 53, 0.6));
}

/* 深色主题下的置顶图标样式 */
[data-theme="dark"] .pin-btn:hover {
    background: rgba(108, 71, 255, 0.2);
}

[data-theme="dark"] .pin-btn .unpinned-icon {
    color: #ccc;
}

[data-theme="dark"] .pin-btn:hover .unpinned-icon {
    color: #6c47ff;
}

[data-theme="dark"] .pin-btn .pinned-icon {
    color: #ff8a50;
    background: linear-gradient(135deg, #ff8a50, #ffa726);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 2px rgba(255, 138, 80, 0.5));
}

[data-theme="dark"] .pin-btn.pinned {
    background: rgba(255, 138, 80, 0.15);
    border: 1px solid rgba(255, 138, 80, 0.3);
}

[data-theme="dark"] .pin-btn.pinned:hover {
    background: rgba(255, 138, 80, 0.2);
}

[data-theme="dark"] .pin-btn.pinned:hover .pinned-icon {
    filter: drop-shadow(0 0 4px rgba(255, 138, 80, 0.7));
}

/* 深色主题下的会话标题样式 */
[data-theme="dark"] .session-title {
    color: #e0e0e0;
}

[data-theme="dark"] .session-title:hover {
    background: rgba(108, 71, 255, 0.15);
    color: #8b7fff;
}

/* 深色主题下的编辑框样式 */
[data-theme="dark"] .session-title-edit {
    background: #3a3a3a;
    border-color: #6c47ff;
    color: #e0e0e0;
    cursor: text;
}

/* 深色主题下的分组栏样式 */
[data-theme="dark"] .session-group-header {
    color: #666;
    border-bottom-color: rgba(102, 102, 102, 0.2);
}

[data-theme="dark"] .session-group[data-group="今天"] .session-group-header {
    color: #8b7fff;
    border-bottom-color: rgba(139, 127, 255, 0.3);
}

[data-theme="dark"] .session-group[data-group="三天内"] .session-group-header {
    color: #7d6fff;
    border-bottom-color: rgba(125, 111, 255, 0.25);
}

[data-theme="dark"] .session-group[data-group="七天内"] .session-group-header {
    color: #777;
    border-bottom-color: rgba(119, 119, 119, 0.15);
}

[data-theme="dark"] .session-group[data-group="一个月内"] .session-group-header {
    color: #888;
    border-bottom-color: rgba(136, 136, 136, 0.12);
}

[data-theme="dark"] .session-group[data-group="更早"] .session-group-header {
    color: #999;
    border-bottom-color: rgba(153, 153, 153, 0.1);
}

[data-theme="dark"] .session-group-header:hover {
    color: #8b7fff;
    border-bottom-color: rgba(139, 127, 255, 0.4);
}

/* 深色主题下的AI头像电波效果 */
[data-theme="dark"] .ai-message .message-avatar {
    background: linear-gradient(135deg, #3a3a5a, #4a4a6a);
    color: #8b7fff;
}

[data-theme="dark"] .ai-message .message-avatar::before {
    border-color: rgba(139, 127, 255, 0.5);
    animation: aiWaveRippleDark1 2s ease-out infinite;
}

[data-theme="dark"] .ai-message .message-avatar::after {
    border-color: rgba(139, 127, 255, 0.4);
    animation: aiWaveRippleDark2 2s ease-out infinite 0.6s;
}

[data-theme="dark"] .ai-message .message-avatar:hover {
    background: linear-gradient(135deg, #4a4a6a, #5a5a7a);
    animation: aiAvatarGlowDark 1.5s ease-in-out infinite;
}

/* 深色主题电波波纹动画 */
@keyframes aiWaveRippleDark1 {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.7;
        border-width: 3px;
        border-color: rgba(139, 127, 255, 0.6);
    }
    50% {
        width: 160%;
        height: 160%;
        opacity: 0.35;
        border-width: 2px;
        border-color: rgba(139, 127, 255, 0.4);
    }
    100% {
        width: 220%;
        height: 220%;
        opacity: 0;
        border-width: 1px;
        border-color: rgba(139, 127, 255, 0.2);
    }
}

@keyframes aiWaveRippleDark2 {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.6;
        border-width: 2px;
        border-color: rgba(139, 127, 255, 0.5);
    }
    50% {
        width: 140%;
        height: 140%;
        opacity: 0.3;
        border-width: 1.5px;
        border-color: rgba(139, 127, 255, 0.3);
    }
    100% {
        width: 200%;
        height: 200%;
        opacity: 0;
        border-width: 1px;
        border-color: rgba(139, 127, 255, 0.1);
    }
}

@keyframes aiAvatarGlowDark {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 15px rgba(139, 127, 255, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 25px rgba(139, 127, 255, 0.6);
        transform: scale(1.02);
    }
}

/* 深色主题悬停时的强化波纹 */
[data-theme="dark"] .ai-message .message-avatar:hover::before {
    animation: aiWaveRippleIntenseDark1 1.5s ease-out infinite;
}

[data-theme="dark"] .ai-message .message-avatar:hover::after {
    animation: aiWaveRippleIntenseDark2 1.5s ease-out infinite 0.4s;
}

@keyframes aiWaveRippleIntenseDark1 {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.9;
        border-width: 4px;
        border-color: rgba(139, 127, 255, 0.7);
    }
    50% {
        width: 180%;
        height: 180%;
        opacity: 0.45;
        border-width: 2px;
        border-color: rgba(139, 127, 255, 0.5);
    }
    100% {
        width: 250%;
        height: 250%;
        opacity: 0;
        border-width: 1px;
        border-color: rgba(139, 127, 255, 0.2);
    }
}

@keyframes aiWaveRippleIntenseDark2 {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.8;
        border-width: 3px;
        border-color: rgba(139, 127, 255, 0.6);
    }
    50% {
        width: 160%;
        height: 160%;
        opacity: 0.4;
        border-width: 2px;
        border-color: rgba(139, 127, 255, 0.4);
    }
    100% {
        width: 220%;
        height: 220%;
        opacity: 0;
        border-width: 1px;
        border-color: rgba(139, 127, 255, 0.1);
    }
}