/* ==================== 性能优化 ==================== */
/* 开启GPU加速 */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 优化滚动性能 */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* 减少重绘和重排 */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* 优化动画性能 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==================== 基础样式 ==================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden; /* 防止body滚动 */
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

.loading-message {
    background-color: #fff;
    border: 1px solid #dde;
    padding: 10px;
    border-radius: 5px;
    margin: 5px 0;
    display: block;
    text-align: left;
}

.loader {
    display: inline-block;
    vertical-align: middle;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 2s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 懒加载指示器样式 */
.load-more-indicator {
    text-align: center;
    padding: 10px;
    color: #888;
    font-size: 14px;
    background-color: #f7f7f7;
    border-radius: 5px;
    margin: 5px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.load-more-indicator:hover {
    background-color: #eaeaea;
}

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

.load-more-indicator.loading {
    animation: pulse 1.5s infinite;
}

/* 高档顶部区域样式 */
h1 {
    background-color: #4a90e2;
    color: white;
    padding: 15px 25px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(74, 144, 226, 0.3);
    position: relative;
    z-index: 10;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

h1::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%, rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
}

h1 span {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 1.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(45deg, #ffffff 0%, #f0f8ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    position: relative;
    z-index: 2;
}

h1 div {
    position: relative;
    z-index: 2;
}

/* 图标高档效果 */
h1 i {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
}

h1 button:hover i {
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.15));
    transform: scale(1.05);
}

/* 高档顶部按钮样式 */
#sidebar-toggle, #clear, #autoPlayButton, #export-image {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    letter-spacing: 0.5px;
}

#sidebar-toggle:hover, #clear:hover, #autoPlayButton:hover, #export-image:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

#sidebar-toggle:active, #clear:active, #autoPlayButton:active, #export-image:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 主页右侧新建话题按钮高档样式 */
#new-topic {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    backdrop-filter: blur(15px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    font-weight: 600;
    letter-spacing: 0.8px;
    position: relative;
    overflow: hidden;
}

#new-topic::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

#new-topic:hover::before {
    left: 100%;
}

#new-topic:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.2) 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

#new-topic i {
    font-size: 11px;
    margin-right: 6px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* 侧边栏新建话题按钮高档样式 */
#new-topic-sidebar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.15) 100%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: white;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    backdrop-filter: blur(15px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    font-weight: 600;
    letter-spacing: 0.8px;
    position: relative;
    overflow: hidden;
}

#new-topic-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

#new-topic-sidebar:hover::before {
    left: 100%;
}

#new-topic-sidebar:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.25) 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
}

#new-topic-sidebar i {
    font-size: 11px;
    margin-right: 6px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* 清空所有话题按钮高档样式 */
#clear-all-sessions {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#clear-all-sessions:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.2) 100%);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

#close-sidebar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#close-sidebar:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.2) 100%);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* 响应式优化 */
@media (max-width: 768px) {
    h1 {
        padding: 12px 20px;
    }
    
    h1 span {
        display: none; /* 移动端隐藏问答标题 */
    }
    
    #sidebar-toggle, #clear, #autoPlayButton, #export-image {
        padding: 6px 10px;
    }
    
    #sidebar-toggle i, #clear i, #autoPlayButton i, #export-image i {
        font-size: 14px;
    }
    
    #new-topic, #new-topic-sidebar {
        padding: 7px 14px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    h1 {
        padding: 10px 15px;
    }
    
    h1 span {
        display: none; /* 手机端隐藏问答标题 */
    }
    
    #sidebar-toggle, #clear, #autoPlayButton, #export-image {
        padding: 5px 8px;
    }
    
    #sidebar-toggle i, #clear i, #autoPlayButton i, #export-image i {
        font-size: 12px;
    }
    
    #new-topic, #new-topic-sidebar {
        padding: 6px 12px;
        font-size: 12px;
    }
}

#chat-history {
    border: 1px solid #ccc;
    padding: 10px;
    flex-grow: 1;
    overflow-y: scroll;
    margin: 2%;
    background-color: white;
    display: flex;
    flex-direction: column;
    word-wrap: break-word;
    word-break: break-word;
    font-size: clamp(16px, 2.5vw, 17px);
    line-height: 1.7;
    margin-bottom: 0;
}

#input-area {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
    background-color: #ffffff;
    padding: 6px 8px;
    border-radius: 22px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin: 0;
}

#question {
    font-size: 16px;
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 5px 5px;
    margin: 0;
    border: none;
    background-color: transparent;
    resize: none;
    flex-grow: 1;
    outline: none;
    min-height: 26px;
    max-height: 96px;
    overflow-y: auto;
    line-height: 1.5;
}

/* 桌面端样式：启用拖拽并给更大的最大高度 */
@media (min-width: 769px) {
    #question {
        resize: vertical;
        max-height: 250px;
    }
}

/* 拖拽文件时的高亮效果 */
#question.drag-hover {
    border: 2px dashed #007bff !important;
    background-color: #e7f3ff !important;
}

/* 聊天历史区域拖拽高亮效果 */
#chat-history.drag-hover {
    border: 2px dashed #007bff !important;
    background-color: #f0f8ff !important;
    position: relative;
}

/* 聊天历史区域拖拽时的提示文字 */
#chat-history.drag-hover::before {
    content: '📎 拖拽文件到此处上传';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(74, 144, 226, 0.9);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#action {
    display: inline-block;
    padding: 0;
    border: none;
    cursor: pointer;
}

.user-question {
    background-color: #eef;
    border: 1px solid #dde;
    padding: 5px;
    border-radius: 5px;
    font-size: clamp(16px, 2.5vw, 17px);
    line-height: 1.6;
}

#model-selector {
    margin-right: 10px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

#model-selector:hover {
    border-color: #bbb;
}

#model-selector:focus {
    outline: none;
    border-color: #007bff;
}

#image-upload-area {
    display: none !important;
}

.timestamp {
    color: gray;
    font-size: 0.8em;
    margin-top: 10px;
    text-align: right;
}

table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin-bottom: 15px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    min-width: 100px;
}

th {
    background-color: #f2f2f2;
    position: sticky;
    top: 0;
    z-index: 1;
}

pre {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    position: relative;
    font-size: 14px;
}

code {
    font-family: monospace;
    font-size: 14px;
}

#autoPlayButton i {
    color: blue;
}

#autoPlayButton.active i {
    color: black;
}

@keyframes sound-wave {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

#togglePlayButton .fa-volume-up {
    animation: sound-wave 1s infinite;
}

#remaining-power {
    font-size: 0.4em;
    color: #1e3a8a;
    margin-right: 10px;
}

.science-color {
    color: blue;
}

.general-color {
    color: green;
}

.arts-color {
    color: #FF69B4;
}

.ds-color {
    color: purple;
}

.pro-code-color {
    color: #fd7e14;
}

/* 思考内容样式 */
.think-content-inner {
    background-color: #f0f8ff;
    color: #4682b4;
    border-left: 3px solid #4682b4;
    padding: 8px;
    font-style: italic;
    font-size: 0.9em;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.think-content-inner pre {
    background: linear-gradient(145deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    color: #0c4a6e;
}

.think-content-inner code {
    color: #be123c; /* 更改为红色系 */
    background: rgba(190, 18, 60, 0.1); /* 更改为红色系背景 */
    padding: 1px 4px;
    border-radius: 3px;
}

.think-content-inner p {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.think-content-inner ul, .think-content-inner ol {
    margin-left: 20px;
    padding-left: 0;
}

.think-content-inner li {
    margin-bottom: 0.2em;
}

/* 思考块容器和按钮的样式 */
.think-block-container {
    margin: 8px 0;
}

.think-content-stream-wrapper {
    margin: 8px 0;
}

.toggle-think-button {
    background-color: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
    padding: 10px 15px;
    border-radius: 0.25rem;
    cursor: pointer;
    display: block;
    width: 100%;
    text-align: left;
    margin-bottom: 5px;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.15s ease-in-out;
}

.toggle-think-button:hover {
    background-color: #e9ecef;
}

.toggle-think-button i.fas {
    margin-left: 8px;
    float: right;
    line-height: inherit;
}

.think-content.collapsible-think {
    /* overflow: hidden; */
}

/* 定义选项的颜色样式 */
#model-selector option {
    background-color: white;
}

#model-selector option[value="1"] {
    color: #28a745;
}

#model-selector option[value="0"] {
    color: #007bff;
}

#model-selector option[value="2"] {
    color: #dc3545;
}

#model-selector option[value="3"] {
    color: #6f42c1;
}

#model-selector option[value="4"] {
    color: #fd7e14;
}

/* 移动端控制台样式 */
#mobile-console::-webkit-scrollbar {
    width: 6px;
}

#mobile-console::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

#mobile-console::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* ==================== 代码块优化 ==================== */
/* 代码块容器 */
pre {
    background-color: #f6f8fa;
    border: 1px solid #e1e4e8;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    position: relative;
    font-size: 14px;
    line-height: 1.45;
    margin: 16px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 暗色主题代码块 */
@media (prefers-color-scheme: dark) {
    pre {
        background-color: #161b22;
        border-color: #30363d;
        color: #c9d1d9;
    }
}

/* 代码样式优化 */
code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    tab-size: 4;
}

/* 内联代码 */
p > code, li > code {
    background: transparent;
    color: #be123c; /* 更改为红色系 */
    padding: 1px 2px;
    font-size: 0.9em;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* 粗体内的代码 - 特殊强调样式 */
strong > code, b > code {
    background: transparent;
    color: #be123c;
    font-weight: bold;
    padding: 1px 2px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* 代码复制按钮样式 */
.copy-button {
    background: linear-gradient(145deg, #f1f8ff 0%, #e3f2fd 100%);
    border: 1px solid #bfdbfe;
    color: #1e40af;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    font-weight: 500;
    letter-spacing: 0.3px;
}

pre:not(.streaming):hover .copy-button {
    opacity: 0.8;
}

.copy-button:hover {
    opacity: 1 !important;
    background-color: #e8e8e8;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.copy-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.copy-button.copied {
    background-color: #4CAF50;
    color: #000;
    border-color: #4CAF50;
    opacity: 1 !important;
    font-weight: bold;
}

.copy-button.copied::after {
    content: ' ✓';
    margin-left: 2px;
}

/* 代码块按钮容器 */
.code-buttons-container {
    position: absolute;
    bottom: 5px;
    right: 5px;
    display: flex;
    flex-direction: row-reverse;
    gap: 5px;
    opacity: 0; /* 默认隐藏 */
    transition: opacity 0.3s ease;
    z-index: 10; /* 确保按钮在最上层 */
}

/* 鼠标悬停时显示按钮 */
pre:not(.streaming):hover .code-buttons-container {
    opacity: 1;
}

/* HTML运行按钮样式 */
.run-button {
    background-color: #e8f0fe;
    border: 1px solid #a9c7fd;
    color: #1967d2;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap; /* 防止文字换行 */
}

.run-button:hover {
    background-color: #d0e0fd;
    border-color: #73a2f0;
    transform: translateY(-1px); /* 添加悬停效果 */
}

/* 自定义右键菜单样式 */
.custom-context-menu {
    position: fixed;
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.15);
    z-index: 10000;
    padding: 5px 0;
    border-radius: 4px;
    min-width: 120px;
}

.context-menu-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
}

.context-menu-item:hover {
    background-color: #f0f0f0;
}

/* 会话侧边栏样式 */
#sidebar {
    position: fixed;
    left: -320px;
    top: 0;
    width: 320px;
    height: 100vh;
    background-color: #f8f9fa;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    z-index: 100;
    transition: left 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    touch-action: none;
}

#sidebar.open {
    left: 0;
}

#sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 15px;
    background-color: #4a90e2;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

#sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#session-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.session-item {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    position: relative;
}

.session-item:hover {
    background-color: #f0f3f7;
}

.session-item.active {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding-left: 11px;
}

.session-content {
    flex-grow: 1;
    overflow: hidden;
    padding-right: 10px;
}

.session-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.session-title {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

/* 版本徽章样式 */
.version-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.version-badge.v1, .version-badge-v1 {
    background-color: #f39c12;
    color: white;
    border: 1px solid #e67e22;
}

.version-badge.v2, .version-badge-v2 {
    background-color: #27ae60;
    color: white;
    border: 1px solid #2ecc71;
    animation: v2Glow 2s ease-in-out infinite alternate;
}

.version-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* V2版本发光效果 */
@keyframes v2Glow {
    from {
        box-shadow: 0 0 2px #27ae60;
    }
    to {
        box-shadow: 0 0 8px #2ecc71, 0 0 12px rgba(46, 204, 113, 0.3);
    }
}

.session-time {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 4px;
}

.session-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.session-delete {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 6px 8px;
    opacity: 0.7;
    transition: all 0.2s ease;
    border-radius: 4px;
}

/* 移动端始终显示删除按钮 */
@media (max-width: 768px) {
    .session-delete {
        opacity: 0.7;
    }
}

/* 桌面端hover显示 */
@media (min-width: 769px) {
    .session-delete {
        opacity: 0;
    }
    
    .session-item:hover .session-delete {
        opacity: 0.7;
    }
}

.session-delete:hover {
    opacity: 1 !important;
    background-color: rgba(231, 76, 60, 0.1);
}

.empty-tip {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.delete-session {
    color: #ff4d4f;
    margin-left: 10px;
    opacity: 0.5;
}

#new-session-btn {
    width: calc(100% - 20px);
    padding: 14px;
    margin: 10px;
    background: linear-gradient(135deg, #5ba0f2 0%, #4590e2 100%);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(91, 160, 242, 0.3);
}

#new-session-btn:hover {
    background: linear-gradient(135deg, #4590e2 0%, #357abd 100%);
    box-shadow: 0 4px 8px rgba(91, 160, 242, 0.4);
    transform: translateY(-1px);
}

#new-session-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(91, 160, 242, 0.3);
}

#new-session-btn i {
    font-size: 14px;
}

/* 搜索框样式 */
.session-search {
    padding: 10px;
    background-color: white;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 5;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.search-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

/* 排序选择器样式 */
.sort-selector {
    margin: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.sort-selector select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

/* 会话列表容器样式 */
#session-list-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    flex: 1;
    overflow: hidden;
    contain: layout style paint;
}

#session-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    list-style: none;
    padding: 0;
    margin: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    z-index: 99;
    display: none;
}

#overlay.open {
    display: block;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #sidebar {
        width: 85%;
        max-width: 320px;
        left: -100%;
    }
    
    #sidebar.open {
        left: 0;
    }
    
    .session-item {
        padding: 14px 15px;
    }
    
    .session-title {
        font-size: 15px;
    }
    
    .session-delete {
        padding: 8px 10px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #sidebar-header {
        padding: 15px 12px;
    }
    
    #sidebar-header h3 {
        font-size: 16px;
    }
    
    #new-session-btn {
        padding: 12px;
        font-size: 13px;
    }
}

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

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

table::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

table::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 响应式表格样式 */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 15px;
    position: relative;
}

.responsive-table {
    width: 100%;
    border-collapse: collapse;
    transition: font-size 0.2s ease;
}

.responsive-table th,
.responsive-table td {
    padding: 8px;
    border: 1px solid #ddd;
    white-space: nowrap;
    font-size: inherit;
}

.responsive-table th {
    background-color: #f2f2f2;
    position: sticky;
    top: 0;
    z-index: 1;
}

@media (max-width: 768px) {
    .responsive-table {
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    .responsive-table {
        font-size: 12px;
    }

    /* 优化移动端对话的阅读体验 */
    #chat-history {
        font-size: clamp(16px, 4.2vw, 18px);
        line-height: 1.8;
        letter-spacing: 0.2px;
    }

    #chat-history p {
        margin-bottom: 1em;
    }

    #chat-history ul,
    #chat-history ol {
        padding-left: 24px;
        margin-bottom: 1em;
    }

    #chat-history li {
        margin-bottom: 0.6em;
        padding-left: 4px;
    }

    .user-question {
        font-size: clamp(17px, 3.5vw, 18px);
    }
}

/* 文本追加的渐显动画 */
.newly-appended-text {
    display: inline;
    opacity: 0;
    animation: fadeInTextEffect 1s ease-out forwards;
}

@keyframes fadeInTextEffect {
    to { opacity: 1; }
}

/* 平滑滚动样式 */
#chat-history {
    -webkit-overflow-scrolling: touch;
    overflow-y: scroll;
    scroll-behavior: auto;
}

#chat-history.smooth-scrolling {
    scroll-behavior: smooth;
}

/* 系统消息样式 */
.system-message {
    padding: 12px 20px;
    margin: 10px auto;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    animation: slideInDown 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

/* 添加进度条效果 */
.system-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.3);
    animation: progressBar 3s linear;
}

@keyframes progressBar {
    from { width: 100%; }
    to { width: 0%; }
}

.system-message.info {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #64b5f6;
}

.system-message.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #66bb6a;
}

.system-message.warning {
    background-color: #fff8e1;
    color: #ef6c00;
    border: 1px solid #ffa726;
}

.system-message.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* 新增：输入区域容器 */
.input-container-wrapper {
    padding: 10px 2%;
    background-color: #f0f0f0;
    flex-shrink: 0;
}

/* 新增：快速操作按钮容器 */
#quick-actions-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    -ms-overflow-style: none; /* IE & Edge */
    scrollbar-width: none;    /* Firefox */
}
#quick-actions-container::-webkit-scrollbar {
    display: none;            /* Chrome & Safari */
}

/* 新增：快速操作按钮样式 */
.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    background-color: #ffffff;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-action-btn:hover {
    background-color: #f5f5f5;
    border-color: #d0d0d0;
}

.quick-action-btn.active {
    background-color: #e3f2fd;
    border-color: #4a90e2;
    color: #4a90e2;
    font-weight: 500;
}

.quick-action-btn i {
    font-size: 14px;
}

.quick-action-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
}

.quick-action-btn.disabled:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    transform: none;
    box-shadow: none;
}

/* 根据 is-typing 或 is-focused 类来隐藏图标按钮 */
#input-area.is-typing #camera-btn,
#input-area.is-focused #camera-btn {
    display: none;
}

/* 新增：输入栏图标按钮样式 */
.input-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 20px;
    color: #555;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: color 0.2s;
}

.input-icon-btn:hover {
    color: #000;
}

/* 新增：加号按钮特定样式 */
#action.plus-btn, #action.input-icon-btn {
    background-color: #4a90e2;
    color: white;
    border-radius: 50%;
}

#action.plus-btn:hover, #action.input-icon-btn:hover {
    background-color: #357abd;
    color: white;
}

/* 发送图标尺寸调整 */
#action .fa-paper-plane {
    font-size: 18px;
}
/* 停止按钮样式 */
#action.sending {
    background-color: #dc3545; /* 使用红色作为停止颜色 */
}

#action.sending:hover {
    background-color: #c82333; /* 停止按钮的悬停颜色 */
}

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

#file-btn.uploading i,
#camera-btn.uploading i {
    animation: spin-upload 1s linear infinite;
}

/* ==================== 文件管理区域样式 ==================== */
#file-list-container {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 10px 15px 5px 15px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

#file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.clear-files-btn {
    background: #dc3545;
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.clear-files-btn:hover {
    background: #c82333;
}

#file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 12px;
    transition: all 0.2s;
}

.file-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0,123,255,0.1);
}

.file-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.file-icon {
    margin-right: 8px;
    font-size: 16px;
    color: #6c757d;
}

.file-icon.c-file { color: #007bff; }
.file-icon.h-file { color: #28a745; }
.file-icon.txt-file { color: #ffc107; }
.file-icon.html-file { color: #e34c26; }
.file-icon.md-file { color: #6f42c1; }
.file-icon.js-file { color: #f7df1e; }
.file-icon.css-file { color: #1572b6; }
.file-icon.py-file { color: #3776ab; }
.file-icon.java-file { color: #f89820; }
.file-icon.cpp-file { color: #00599c; }
.file-icon.cxx-file { color: #00599c; }
.file-icon.php-file { color: #777bb4; }
.file-icon.rb-file { color: #cc342d; }
.file-icon.go-file { color: #00add8; }
.file-icon.rs-file { color: #dea584; }
.file-icon.ts-file { color: #3178c6; }
.file-icon.jsx-file { color: #61dafb; }
.file-icon.tsx-file { color: #61dafb; }
.file-icon.vue-file { color: #4fc08d; }
.file-icon.sh-file { color: #4eaa25; }
.file-icon.sql-file { color: #336791; }
.file-icon.xml-file { color: #ff6600; }
.file-icon.json-file { color: #000000; }
.file-icon.yaml-file { color: #cb171e; }
.file-icon.yml-file { color: #cb171e; }
.file-icon.docx-file { color: #2b579a; }
.file-icon.xlsx-file { color: #217346; }
.file-icon.pptx-file { color: #d24726; }
.file-icon.m4a-file { color: #17a2b8; }

.file-name {
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.file-size {
    font-size: 12px;
    color: #6c757d;
    margin-left: 8px;
}

.file-actions {
    display: flex;
    gap: 4px;
}

.file-action-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 14px;
}

.file-action-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.file-action-btn.delete:hover {
    color: #dc3545;
    background: #f8d7da;
}

/* 文件拖拽区域 */
.file-drop-zone {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    background: #f8f9fa;
    margin: 10px 15px;
    transition: all 0.3s;
    cursor: pointer;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: #007bff;
    background: #e7f3ff;
    color: #0056b3;
}

.file-drop-zone i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

/* 响应式优化 */
@media (max-width: 768px) {
    #file-list-container {
        margin: 8px 10px 4px 10px;
        max-height: 150px;
    }
    
    .file-name {
        max-width: 120px;
    }
    
    .file-drop-zone {
        margin: 8px 10px;
        padding: 15px;
    }
}

/* ==================== 内容审核拦截消息样式 ==================== */
.intercept-message {
    margin: 15px;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease-in-out;
}

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

.intercept-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.intercept-header i {
    font-size: 20px;
}

.intercept-body {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}

/* 阻止类型样式 - 红色警告 */
.intercept-block {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    border-left: 4px solid #dc3545;
}

.intercept-block .intercept-header {
    color: #dc3545;
}

.intercept-block .intercept-header i {
    color: #dc3545;
}

/* 注册类型样式 - 蓝色引导 */
.intercept-register {
    background: linear-gradient(135deg, #f0f7ff 0%, #e0efff 100%);
    border-left: 4px solid #007bff;
}

.intercept-register .intercept-header {
    color: #007bff;
}

.intercept-register .intercept-header i {
    color: #007bff;
}

/* 信息类型样式 - 灰色提示 */
.intercept-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #6c757d;
}

.intercept-info .intercept-header {
    color: #6c757d;
}

.intercept-info .intercept-header i {
    color: #6c757d;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .intercept-message {
        margin: 10px;
        padding: 15px;
    }

    .intercept-header {
        font-size: 14px;
    }

    .intercept-body {
        font-size: 13px;
    }
}