body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    /*background-color: #f5f5f5;*/
    /* 移除固定高度 */
    /* height: 100vh; */
    /* 修改overflow属性 */
    overflow-y: auto;
    /* 添加Safari特定处理 */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-overflow-scrolling: touch; /* 启用iOS弹性滚动 */
}

/* 新增的横条区域样式 */
.top-bar {
    height: 40px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    /*box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);*/
    z-index: 1000;
    width: 100%;
    flex-shrink: 0; /* 防止横条区域被压缩 */
    position: sticky;
    top: 0;
}

.top-bar-left h1 {
    margin: 0;
    font-size: 20px;
    color: #333;
    font-family: "Arial", sans-serif;
}

.top-bar-title {
    margin: 0;
    font-size: 20px;
    color: #333;
    font-family: "Arial", sans-serif;
    margin-left: 10px;
}

.top-bar-left {
    display: flex;
    align-items: center;
}

/* 当侧边栏展开时隐藏顶部标题 */
.sidebar:not(.collapsed) ~ .content-area .top-bar-title {
    display: none;
}

.top-bar-center {
    flex: 1;
    /* 中间区域留空 */
}

.top-bar-right .message-icon {
    background: none;
    border: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-bar-right .message-icon img {
    width: 100%;
    height: 100%;
}

.main-container {
    display: flex;
    /* 使用最小高度而不是固定高度 */
    height: 100vh;
    /* 添加Safari兼容属性 */
    -webkit-overflow-scrolling: touch;
    position: relative;
    overflow: hidden; /* 防止整个页面滚动 */
}

/* 主内容区样式 */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    height: 100vh;
    overflow: hidden; /* 防止内容区域滚动 */
}

/* 侧边栏样式 */
.sidebar {
    width: 260px;
    background-color: #f8f9fa; /* 浅白色背景 */
    color: #333;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    flex-shrink: 0;
    border-right: 1px solid #dee2e6;
    border-radius: 0 10px 10px 0;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    /* 添加Safari安全区域支持 */
    padding-top: env(safe-area-inset-top);
}

@supports (-webkit-touch-callout: none) {
    .main-container {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
    border-right: none;
}

.sidebar-top {
    flex: 1;
    min-height: 60px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
}

.sidebar-top h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
    font-family: "Arial", sans-serif;
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    color: #333;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease-in-out;
}

.toggle-sidebar-btn:hover {
    background-color: #e9ecef;
    transform: scale(1.1);
}

.sidebar-middle {
    flex: 3;
    padding: 20px 0;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    padding: 0;
    position: relative;
}

.menu-link, .dropdown-link {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    align-items: center;
}

.menu-link {
    display: flex;
}

.menu-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: middle;
}

.arrow {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.menu-link:hover, .dropdown-link:hover {
    background-color: #e9ecef;
    color: #000;
    transform: translateX(5px);
}

.dropdown-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background-color: #fff;
    position: absolute;
    left: 100%;
    top: 0;
    width: 180px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    z-index: 1000;
    animation: fadeIn 0.2s ease-in-out;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-link {
    padding: 10px 20px;
}

.sidebar-bottom {
    flex: 6;
    padding: 20px 0;
    overflow-y: auto;
    flex-shrink: 0;
}

/* 用户信息区域 */
.user-info {
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    position: relative;
    flex-shrink: 0;
}
/* 网页端隐藏*/
.top-bar-right .user-info {
    display: none;
}

.user-info:hover .user-dropdown-menu {
    display: block;
}

.user-profile {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.user-nickname {
    font-size: 14px;
    color: #333;
}

.user-dropdown-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background-color: #fff;
    position: absolute;
    left: 20px;
    bottom: 100%;
    width: 120px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    z-index: 1000;
    animation: fadeIn 0.2s ease-in-out;
}

.user-dropdown-link {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

.user-dropdown-link:hover {
    background-color: #e9ecef;
    color: #000;
}

.sidebar-bottom h3 {
    padding: 0 20px;
    margin-top: 0;
    font-size: 16px;
    color: #666;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.history-header h3 {
    font-family: "Arial", sans-serif;
    padding-left: 0px;
    margin: 0;
    font-size: 16px;
    color: #cdcdcd;
    flex-grow: 1; /* 让标题占据剩余空间 */
    text-align: left; /* 明确指定文字靠左 */
}

.history-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0; /* 防止图标被压缩 */
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    height: calc(100% - 40px); /* 减去标题区域的高度 */
    overflow-x: hidden; /* 禁止水平滚动 */
    overflow-y: auto; /* 允许垂直滚动 */
    /* 启用硬件加速优化滚动性能 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* 历史记录列表的滚动条样式 */
.history-list::-webkit-scrollbar {
    width: 3px; /* 更细的滚动条 */
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: #ccc; /* 更浅的颜色 */
    border-radius: 3px; /* 滚动条圆角 */

}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #aaa; /* 悬停时稍深的颜色 */
}

/* 加载指示器样式 */
.loading-indicator {
    display: none;
    text-align: center;
    padding: 10px 0;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

.loading-text {
    vertical-align: middle;
    color: #666;
    font-size: 14px;
}

.history-item {
    padding: 10px 20px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease-in-out;
    font-family: "Arial", sans-serif;
    /* 启用硬件加速 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* 使用will-change提示浏览器优化 */
    will-change: background-color, transform;
}

.history-item:hover {
    background-color: #e9ecef;
    transform: translateX(5px);
}

/* 显示侧边栏按钮 */
.show-sidebar-btn {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px;
    cursor: pointer;
    display: none;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
}

.show-sidebar-btn:hover {
    background-color: #f8f9fa;
    transform: scale(1.1);
}

.show-sidebar-btn.visible {
    display: flex;
}

/* 主内容区样式 */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    height: 100vh;
    overflow: hidden; /* 防止内容区域滚动 */
}



.mobile-header {
    display: none;
    background-color: #007bff;
    color: white;
    padding: 15px;
    align-items: center;
    /* 添加Safari安全区域支持 */
    padding-top: calc(15px + env(safe-area-inset-top));
    padding-left: calc(15px + env(safe-area-inset-left));
    padding-right: calc(15px + env(safe-area-inset-right));
    /* 确保在Safari中正确显示 */
    position: sticky;
    top: 0;
    z-index: 10;
    -webkit-box-align: center;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    margin-right: 15px;
}

/* 聊天布局容器 - 三栏布局 */
.chat-layout-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

.chat-layout-left {
    flex: 2.5;
}

.chat-layout-center {
    flex: 5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.chat-layout-right {
    flex: 2.5;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 添加Safari支持 */
    -webkit-overflow-scrolling: touch;
    height: calc(100% - 120px);
    -webkit-overflow-scrolling: touch; /* 启用iOS弹性滚动 */
    margin-top: 50px;
}

/* 消息气泡样式 */
.message {
    max-width: 100%;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 8px;
    position: relative;
    line-height: 1.5;
    word-wrap: break-word;
    box-sizing: border-box;
}

/* 问题消息样式 */
.question {
    background-color: #f1f3f4;
    color: black;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

/* 答案消息样式 */
.answer {
    /*background-color: #f1f3f4;*/
    color: #202124;
    margin-right: auto;
    border-bottom-left-radius: 2px;
}

/* 加载状态样式 */
.loading {
    font-style: italic;
    color: #666;
}

/* 错误消息样式 */
.error {
    color: #dc3545;
    font-weight: bold;
}

/* 代码块复制按钮样式 */
.answer .copy-button {
    position: relative;
    float: right;
    background-image: url('/static/img/cp.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    width: 24px;
    height: 24px;
    border: none;
    cursor: pointer;
    margin-bottom: 4px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.answer .copy-button:hover {
    opacity: 1;
}

.answer .copy-button.copied {
    background-image: url('/static/img/cp.svg'); /* 您可以替换为不同的图标表示已复制 */
    opacity: 1;
}

.answer pre {
    padding: 16px;
    overflow: auto;
    font-size: 65%;
    line-height: 1.45;
    background-color: #f6f8fa;
    border-radius: 3px;
    position: relative;
    clear: both;
    margin-top: 0;
}

.answer pre code {
    padding: 0;
    margin: 0;
    font-size: 100%;
    word-break: normal;
    white-space: pre;
    background: transparent;
    border: 0;
}

.answer img {
    max-width: 100%;
    box-sizing: content-box;
}

.answer hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: #e1e4e8;
    border: 0;
}

.answer table {
    width: 100%;
    overflow: auto;
    border-collapse: collapse;
    margin: 16px 0;
    display: table; /* 改回默认的table显示 */
    max-width: 100%;
    table-layout: auto; /* 使用自动表格布局，更好的自适应 */
}

.answer table th {
    font-weight: 600;
    background-color: #f6f8fa;
}

.answer table th,
.answer table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
    white-space: pre-wrap; /* 更好的文本换行处理 */
    word-wrap: break-word; /* 允许长单词换行 */
    text-align: left; /* 左对齐 */
    box-sizing: border-box; /* 确保padding包含在宽度内 */
}

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

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

.answer table thead {
    display: table-header-group; /* 确保thead正常显示 */
}

.answer table tbody {
    display: table-row-group; /* 确保tbody正常显示 */
    overflow-x: auto; /* 保持横向滚动功能 */
    width: 100%;
}

/* 表格外层包装器，用于处理滚动 */
.answer .table-wrapper {
    overflow-x: auto;
    margin: 0 0 16px 0;
    border: 1px solid #dfe2e5;
    border-radius: 4px;
    max-width: 100%;
    position: relative;
    clear: both; /* 清除浮动，确保表格从新的一行开始 */
}

.answer .table-wrapper table {
    margin: 0;
    border: none;
    border-radius: 0;
    width: 100%;
}

.answer .table-wrapper table th,
.answer .table-wrapper table td {
    white-space: pre-wrap;
    word-wrap: break-word;
    box-sizing: border-box; /* 确保padding包含在宽度内 */
}

/* 表格复制按钮样式 */
.answer .copy-table-button {
    position: relative;
    float: right;
    background-image: url('/static/img/cp.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    width: 24px;
    height: 24px;
    border: none;
    cursor: pointer;
    margin-bottom: 4px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    display: block; /* 确保按钮独占一行 */
}

.answer .copy-table-button:hover {
    opacity: 1;
}

.answer .copy-table-button.copied {
    background-image: url('/static/img/cp.svg'); /* 您可以替换为不同的图标表示已复制 */
    opacity: 1;
}

/* 查询区域样式 */
.query-section {
    padding: 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    position: sticky;
    bottom: 0;
    /* 添加Safari支持 */
    -webkit-position: sticky;
}

.input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.query-input-container {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 2px solid #ddd;
    border-radius: 20px;
    background-color: white;
    min-height: 44px;
    max-height: 300px;
}

.query-input-container:focus-within {
    border-color: #007bff;
}

.uploaded-files {
    padding: 5px 12px 0 12px;
    max-height: 100px;
    overflow-y: auto;
}

.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.file-item {
    display: flex;
    align-items: center;
    background-color: #e9ecef;
    border-radius: 15px;
    padding: 5px 10px;
    font-size: 14px;
}

.file-name {
    margin-right: 5px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.file-name:hover {
    text-decoration: underline;
}

.remove-file {
    background: none;
    border: none;
    color: #6c757d;
    font-weight: bold;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.remove-file:hover {
    background-color: #6c757d;
    color: white;
}

.query-input {
    padding: 8px 12px;
    font-size: 16px;
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    line-height: 1.5;
    word-break: break-word;
    min-height: 24px;
    height: auto;
    box-sizing: border-box;
    border-radius: 18px;
}

.input-toolbar {
    display: flex;
    align-items: center;
    padding: 0 12px 8px 12px;
    position: relative;
}

.upload-button {
    width: 20px;
    height: 20px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z'/%3E%3C/svg%3E");
    background-size: 20px 20px;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 10px;
    transition: opacity 0.2s ease-in-out;
}

.upload-button:hover {
    opacity: 0.8;
}

.streaming-toggle {
    width: 20px;
    height: 20px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
    background-size: 20px 20px;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 10px;
    transition: opacity 0.2s ease-in-out;
}

.streaming-toggle.active {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23007bff'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
}

.streaming-toggle:hover {
    opacity: 0.8;
}

.thinking-toggle {
    width: 20px;
    height: 20px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    background-image: url('/static/img/sikao1.svg');
    background-size: 20px 20px;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 10px;
    transition: opacity 0.2s ease-in-out;
}

.thinking-toggle.active {
    background-image: url('/static/img/sikao2.svg');
}

.thinking-toggle:hover {
    opacity: 0.8;
}

.voice-button {
    width: 20px;
    height: 20px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    background-image: url('/static/img/yuyin1.svg');
    background-size: 20px 20px;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 10px;
    transition: opacity 0.2s ease-in-out;
}

.voice-button:hover {
    opacity: 0.8;
}

.voice-button.active {
    background-image: url('/static/img/yuyin2.svg');
    /* 添加波形动画效果 */
    position: relative;
}

.voice-button.active::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 2px solid #007bff;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}


.query-button {
    position: absolute;
    right: 12px;
    bottom: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
    background-size: 20px 20px;
    background-repeat: no-repeat;
    background-position: center;
    transition: opacity 0.2s ease-in-out;
}

.query-button.active {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23007bff'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
}

.query-button.abort {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23dc3545'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
}

.query-button:hover:not(:disabled) {
    opacity: 0.8;
}

.query-button:disabled {
    cursor: not-allowed;
}

/* 自定义滚动条样式 */
.chat-container::-webkit-scrollbar, .sidebar-bottom::-webkit-scrollbar {
    width: 8px;
}
/*设置了滚动条滑块（就是你可以拖动的部分）的样式*/
.chat-container::-webkit-scrollbar-track, .sidebar-bottom::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
/*设置了滚动条滑块（就是你可以拖动的部分）的样式*/
.chat-container::-webkit-scrollbar-thumb, .sidebar-bottom::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover, .sidebar-bottom::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* 文件区域滚动条样式 */
.uploaded-files::-webkit-scrollbar {
    width: 6px;
}

.uploaded-files::-webkit-scrollbar-track {
    background: transparent;
}

.uploaded-files::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.uploaded-files::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 图片预览模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: none;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    text-align: center;
    position: relative;
    animation: fadeIn 0.3s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}



#previewImage {
    max-width: 100%;
    max-height: 80vh;
}

/* 用户设置模态框样式 */
.user-settings-modal {
    max-width: 500px;
    padding: 30px;
}

.user-settings-modal h2 {
    margin-top: 0;
    text-align: center;
    color: #333;
}

.avatar-upload-container {
    text-align: center;
    margin-bottom: 25px;
}

.avatar-preview-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.avatar-preview-container:hover {
    transform: scale(1.05);
}

.avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #007bff;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.avatar-preview-container:hover .avatar-preview {
    border-color: #0056b3;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.change-avatar-btn {
    display: block;
    margin: 15px auto 0;
    padding: 8px 16px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 20px;
    color: #495057;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.change-avatar-btn:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.form-group label {
    margin-right: 10px;
    white-space: nowrap;
    font-weight: 500;
    color: #555;
    width: 60px;
    font-size: 14px;
}

.form-group input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-group input:read-only {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.form-actions {
    text-align: center;
    margin-top: 30px;
}

.form-actions button {
    padding: 10px 20px;
    margin: 0 10px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

.form-actions button[type="submit"] {
    background-color: #007bff;
    color: white;
}

.form-actions button[type="submit"]:hover {
    background-color: #0056b3;
}

.form-actions button[type="button"] {
    background-color: #6c757d;
    color: white;
}

.form-actions button[type="button"]:hover {
    background-color: #545b62;
}

/* 消息弹窗样式 */
.message-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 300px;
}

.message-popup.show {
    transform: translateX(0);
    opacity: 1;
}

.message-popup.success {
    background-color: #28a745;
}

.message-popup.error {
    background-color: #dc3545;
}

.message-popup.warning {
    background-color: #ffc107;
    color: #212529;
}

.message-popup.info {
    background-color: #17a2b8;
}

/* 移动端适配 */
@media (max-width: 768px) {
    /* 确保只有聊天容器可以滚动 */
    .content-area {
        overflow: hidden;
    }
    
    .chat-container {
        -webkit-overflow-scrolling: touch; /* 启用iOS弹性滚动 */
        overflow-y: auto;
    }
    
    .sidebar {
        width: 53%;
        position: fixed; /* 改为fixed */
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
        border-radius: 0 10px 10px 0;
        /* 添加Safari支持 */
        -webkit-transform: translateX(-100%);
    }
    
    .sidebar.mobile-visible {
        transform: translateX(0);
        -webkit-transform: translateX(0);
        z-index: 2000; /* 当侧边栏可见时，置于最顶层，高于顶部横条 */
    }
    
    .mobile-header {
        display: none;
    }
    
    .sidebar-top {
        padding: 15px;
    }
    
    .sidebar-middle, .sidebar-bottom {
        padding: 15px 0;
    }
    
    .menu-link, .dropdown-link {
        padding: 10px 15px;
    }
    
    .dropdown-link {
        padding-left: 30px;
    }
    
    .history-item {
        padding: 8px 15px;
    }
    
    /* 在移动端隐藏左右两侧的空白区域 */
    .chat-layout-left, .chat-layout-right {
        display: none;
    }
    
    .chat-layout-center {
        flex: 1;
    }
    
    /* 确保聊天容器可以滚动 */
    /*.chat-container {*/
    /*    overflow-y: auto;*/
    /*    -webkit-overflow-scrolling: touch;*/
    /*}*/
    
    /* 在移动端，当侧边栏隐藏时才显示按钮 */
    .show-sidebar-btn {
        display: none;
    }
    
    .show-sidebar-btn.visible {
        display: flex;
    }
    
    /* 顶部横条区域在移动端的样式 */
    .top-bar {
        height: 50px;
        background-color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 15px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }
    
    .top-bar-left {
        display: flex;
        align-items: center;
    }
    .sidebar.mobile-visible ~ .content-area .top-bar-title {
        display: none;
    }

    .top-bar-title {
        margin: 0;
        font-size: 20px;
        color: #333;
        font-family: "Arial", sans-serif;
        margin-left: 10px;
    }

    .top-bar-left {
        display: flex;
        align-items: center;
    }
    
    /* 顶部横条用户信息区域样式 */
    .top-bar-right .user-info {
        display: block;
    }

    .top-bar-right .user-profile {
        display: flex;
        align-items: center;
    }
    
    .top-bar-right .user-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        margin-right: 10px;
        object-fit: cover;
    }
    
    .top-bar-right .user-nickname {
        font-size: 14px;
        color: #333;
        display: none; /* 默认隐藏昵称，只显示头像 */
    }
    
    /* 移动端查询区域样式 */
    .query-section {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #f8f9fa;
        border-top: 1px solid #dee2e6;
        padding: 10px;
        z-index: 1000;
        /* 添加底部安全区域支持 */
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
    
    .chat-container {
        height: calc(100vh - 170px); /* 使用视口高度计算，为顶部横条和底部查询区域留出空间 */
        margin-bottom: 120px; /* 在移动端也确保底部空间 */
    }
}

/* 思考内容容器样式 */
.thinking-container {
    /*margin-bottom: 15px;*/
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f8f9fa; /* 轻微背景色以区分思考区域 */
}

.thinking-header {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: #495057;
    background-color: #e9ecef; /* 头部背景色 */
}

.thinking-title {
    font-size: 14px;
    display: flex;
    align-items: center;
}

.thinking-icon {
    width: 16px;
    height: 16px;
    margin-right: 5px;
}

.thinking-content-toggle {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.thinking-content {
    padding: 15px;
    font-size: 14px;
    color: #6c757d; /* 灰色字体，区别于回答内容 */
    line-height: 1.5;
    max-height: none; /* 移除最大高度限制 */
    overflow-y: visible; /* 移除滚动条 */
    background-color: #ffffff; /* 白色背景 */
}

.answer-content {
    color: #202124; /* 深色字体，用于回答内容 */
    /*padding: 10px 0; !* 添加一些间距 *!*/
}

/* 答案功能区样式 */
.answer-actions {
    display: flex;
    gap: 5px;
    /*padding: 10px 0;*/
    justify-content: flex-start;
    align-items: center;
}

.action-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.action-button:hover {
    background-color: #f0f0f0;
}

.action-button img {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.action-button.liked {
    color: #007bff;
}

.action-button.liked img {
    transform: scale(1.2);
}

.copy-button, .like-button {
    min-width: 30px;
    min-height: 30px;
}

/* 踩理由区域样式 */
.dislike-reason {
    margin-top: 10px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.dislike-reason .modal {
    display: block;
    position: static;
    width: 100%;
    max-width: 100%;
    height: auto;
    background-color: transparent;
    overflow: visible;
    padding: 0;
    margin: 0;
}

.dislike-reason .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.dislike-reason .modal-header span {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.dislike-reason .modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dislike-reason .modal-close:hover {
    color: #333;
}

.dislike-reason .modal-body {
    margin-bottom: 15px;
}

.dislike-reason .options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.dislike-reason .option-button {
    padding: 6px 12px;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.dislike-reason .option-button:hover {
    background-color: #dee2e6;
}

.dislike-reason .option-button.selected {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.dislike-reason .input-group {
    margin-bottom: 15px;
}

.dislike-reason .input-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.dislike-reason .modal-footer {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
}

.dislike-reason .modal-footer button {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.dislike-reason .modal-footer .feedback-button {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.dislike-reason .modal-footer .feedback-button:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.dislike-reason .modal-footer button:not(.feedback-button):hover {
    background-color: #e9ecef;
}

/* 动态 iframe 模态框样式 */
.modal-content-dynamic {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 0;
    border: none;
    /*border-radius: 10px;*/
    width: 90%;
    max-width: 1200px;
    text-align: center;
    position: relative;
    animation: fadeIn 0.3s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    height: 90vh;
    max-height: 800px;
    overflow: hidden;
}

.modal-title-bar {
    background-color: #f5f7fa;
    border-bottom: 1px solid #dcdfe6;
    margin: 0;
    padding: 5px 10px 10px 10px;
    border-radius: 10px 10px 0 0;
    text-align: left;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.maximize-btn,
.restore-btn {
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background-color 0.2s;
    margin: 0;
    display: none; /* 默认隐藏，由JS控制显示 */
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 24px;
    box-sizing: border-box;
}

.maximize-btn:hover,
.restore-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ddd;
}
