
/* 全局样式 */
:root {
    --primary-color: #4a6baf;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white-color: #ffffff;
    --body-bg: #f5f8fa;
    --card-bg: #ffffff;
    --border-color: #e1e4e8;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: var(--body-bg);
    padding-bottom: 0 !important;
}
a {
    color: var(--primary-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 导航栏 */
.navbar {
    background-color: var(--white-color);
    box-shadow: var(--shadow);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}
.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/* 让导航在整页左右对齐，不受全局 .container 最大宽度限制 */
.navbar .container {
    max-width: none;
    width: 100%;
    padding: 0 20px;
}
/* 双保险：左侧logo靠左，右侧菜单靠右 */
.navbar-logo { margin-right: auto; }
.navbar-menu { margin-left: auto; }
.navbar-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}
.navbar-menu {
    display: flex;
    list-style: none;
    margin-left: auto; /* 将右侧菜单推到右边 */
}
.navbar-menu li {
    margin-left: 20px;
}
.navbar-menu a {
    color: var(--dark-color);
    font-weight: 500;
}
.navbar-menu a:hover {
    color: var(--primary-color);
}

.main-container {
    flex-grow: 1;
    display: flex;
    padding-top: 20px;
    padding-bottom: 20px;
    box-sizing: border-box;
    overflow: visible;
}

/* 按钮基础样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
}
.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
}
.btn-primary:hover {
    background-color: #3a5a9f;
    text-decoration: none;
}
.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white-color);
}
.btn-secondary:hover {
    background-color: #5a6268;
    text-decoration: none;
}
.btn-success {
    background-color: var(--success-color);
    color: var(--white-color);
}
.btn-success:hover {
    background-color: #218838;
    text-decoration: none;
}
.btn-danger {
    background-color: var(--danger-color);
    color: var(--white-color);
}
.btn-danger:hover {
    background-color: #c82333;
    text-decoration: none;
}
/* 表单样式 */
.form-group {
    margin-bottom: 20px;
    width: 100%;
}
.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 107, 175, 0.25);
}

/* 卡片组件 */
.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 15px 20px;
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--border-color);
}
.card-body {
    padding: 20px;
}
.card-footer {
    padding: 15px 20px;
    background-color: rgba(0, 0, 0, 0.03);
    border-top: 1px solid var(--border-color);
}

/* 警告提示 */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: opacity 0.3s ease;
}
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-danger { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }
.alert-warning { color: #856404; background-color: #fff3cd; border-color: #ffeeba; }
.alert-info { color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb; }

/* 登录/注册表单 */
.auth-container {
    max-width: 500px;
    width: 100%;
    margin: 50px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}
.auth-form button {
    width: 100%;
    padding: 12px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.auth-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}
.auth-footer {
    text-align: center;
    margin-top: 20px;
}


.api-key-container {
    display: flex;
    align-items: center;
}
.api-key-input {
    flex: 1;
}
.api-key-toggle {
    margin-left: 10px;
    cursor: pointer;
    color: var(--primary-color);
}

/* 后台管理 */
.admin-container {
    display: flex;
    min-height: calc(100vh - 150px);
}
.admin-sidebar {
    width: 250px;
    background-color: var(--dark-color);
    color: var(--white-color);
    padding: 20px 0;
}
.admin-sidebar-menu {
    list-style: none;
}
.admin-sidebar-menu li {
    margin-bottom: 5px;
}
.admin-sidebar-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--white-color);
    text-decoration: none;
}
.admin-sidebar-menu a:hover,
.admin-sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.1);
}
.admin-content {
    flex: 1;
    padding: 20px;
}
.admin-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.admin-table th {
    background-color: rgba(0, 0, 0, 0.03);
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
    }
    .navbar-menu {
        margin-top: 15px;
    }
    .admin-container {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100%;
        margin-bottom: 20px;
    }
    .profile-container {
        flex-direction: column;
    }
    .auth-container {
        max-width: 90%;
        padding: 20px;
        margin: 30px auto;
    }
}

/* 管理员登录页面样式 */
.admin-login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f5f5f5;
}
.admin-login-container {
    width: 100%;
    max-width: 400px;
    padding: 15px;
    margin: auto;
}
.admin-login-box {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
}
.admin-login-footer {
    margin-top: 20px;
    text-align: center;
}

/* 聊天相关布局 */
/* 聊天布局居中显示 */
.chat-layout {
    display: flex;
    max-width: none;
    width: 100%;
    margin: 0 auto;
    padding-top: 20px;
}

/* 聊天主区域样式 */
.chat-main {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 0 280px;
    padding: 0 20px;
}

/* 消息气泡样式 - 修改为左右分布 */
.message {
    margin-bottom: 15px;
    max-width: none;
    width: auto;
    position: relative;
    padding: 12px 15px;
    border-radius: 18px;
    margin-left: 5px;
    margin-right: 5px;
}

.message-user {
    margin-left: auto;
    margin-right: 5px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #fff;
    border-radius: 18px 18px 0 18px;
    padding-right: 44px;
}

.message-bot {
    margin-right: auto;
    margin-left: 5px;
    background-color: #f7faff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 18px 18px 18px 0;
    padding-left: 44px;
}

/* 输入框固定在底部并居中 */
.chat-input-container {
    position: fixed;
    bottom: 0;
    left: 280px;
    right: 0;
    background: #fff;
    padding: 12px 20px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    z-index: 100;
}

/* 模型选择器样式调整 */
.model-select {
    min-width: 120px;
    padding: 8px 10px;
    border: none;
    border-radius: 5px;
    background-color: #f0f0f0;
    margin-right: 10px;
    font-size: 14px;
    outline: none;
}

/* 模型选择器放在输入框外部左上角 */
/* 确保未登录状态会话框与已登录状态会话框宽度一致 */
/* 移除登录页面较小的矩形背景 */
.login-bubble {
    /* 保留容器结构，但移除背景和边框 */
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    /* 其他样式保持不变，如宽度、边距等 */
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    padding: 20px;
    text-align: center;
}

/* 可以为登录气泡内的实际内容添加背景和样式 */
.login-bubble-content { /* 假设你的登录表单或提示信息包裹在这个div内 */
    background: none;
    box-shadow: none;
    padding: 0;
}


/* 移除PC端右上角不明图标和右侧条形框 */
@media (min-width: 769px) {
    /* 隐藏移动端专用的历史会话按钮 */
    .sidebar-toggle {
        display: none !important;
    }
    
    /* 隐藏右侧不必要的元素 */
    .right-sidebar-placeholder,
    .debug-icon,
    .unknown-icon {
        display: none !important;
    }
    
    /* 修复右侧边栏显示问题 */
    .chat-main {
        margin-right: 0;
    }
}

/* 修复移动端侧边栏显示问题 */
@media (max-width: 768px) {
    .chat-sidebar {
        width: 100%;
        max-width: 100%;
        position: fixed;
        top: 60px;
        left: 0;
        height: calc(100% - 60px);
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }
    
    .chat-sidebar.active {
        transform: translateX(0);
    }
    
    /* 确保侧边栏内容在移动端正确显示 */
    .conversation-list {
        height: auto;
        max-height: calc(100vh - 180px); /* 调整最大高度以适应屏幕 */
        overflow-y: auto;
        padding-bottom: 20px; /* 增加底部空间 */
    }

    /* 移动端会话标题过长处理 */
    .conversation-item .conversation-title {
        white-space: nowrap; /* 不换行 */
        overflow: hidden; /* 隐藏溢出部分 */
        text-overflow: ellipsis; /* 显示省略号 */
        max-width: calc(100% - 40px); /* 减去按钮和一些边距的宽度 */
        display: inline-block; /* 确保 max-width 生效 */
        vertical-align: middle; /* 垂直居中对齐 */
    }

    .conversation-item .delete-chat-btn {
        /* 确保删除按钮在移动端也能正常显示 */
        display: inline-block;
        position: absolute; /* 使用绝对定位替代float */
        right: 0; /* 靠右对齐 */
        margin-left: 5px; /* 和标题保持一点距离 */
        opacity: 1; /* 移动端默认显示删除按钮 */
        color: #b0b0c0; /* 默认颜色 */
    }
    .conversation-item .delete-chat-btn:hover {
        color: #ff4d4f; /* 悬停时变红 */
    }

    /* 调整日期显示，避免换行 */
    .conversation-item .conversation-date {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.8em; /* 可以适当缩小字体 */
        text-align: left; /* 日期靠左显示 */
        margin-top: 4px;
    }

    /* 确保整个会话项布局合理 */
     .conversation-item {
         display: block; /* 确保宽度占满 */
         padding: 10px 12px; /* 调整内边距 */
     }
}

/* 模型选择器宽度调整 */
#model-select {
    position: absolute;
    top: -40px;
    left: 0;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    background-color: #f5f7fa;
    color: #555;
    max-width: 220px; /* 增加宽度，显示完整模型信息 */
    width: auto; /* 允许根据内容自动调整宽度 */
    z-index: 101;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 移动端适配 */
@media (max-width: 768px) {
    #model-select {
        top: -35px;
        font-size: 12px;
        max-width: 180px; /* 移动端也增加宽度，原来是100px */
    }
}

/* 输入框容器样式调整 */
.input-wrapper {
    display: flex;
    align-items: center;
    background-color: #f5f5f5;
    border-radius: 10px;
    padding: 8px 15px;
    width: 100%;
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    resize: none;
    outline: none;
    max-height: 150px;
    overflow-y: auto;
}

/* 输入框内部样式优化 */
.input-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between; /* 内容均匀分布 */
    gap: 12px;
    position: relative; /* 确保相对定位 */
}

/* 确保输入框本身占据足够空间 */
#chat-input {
    flex: 1;
    min-height: 100px;
    max-height: 300px; /* 设置最大高度，超过会出现滚动条 */
    border-radius: 8px;
    padding: 8px 12px;
    padding-right: 50px; /* 为内部发送按钮留出空间 */
    border: 1px solid #e0e0e0;
    outline: none;
    resize: none;
    overflow-y: auto; /* 内容超出时显示滚动条 */
    transition: height 0.2s ease; /* 平滑过渡效果 */
}

/* 发送按钮样式 - 放入输入框内部 */
#chat-send-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: unset;
}

#chat-send-btn:hover {
    background: #1d4ed8;
}

/* 修复复制按钮遮挡内容问题 */
.copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255, 255, 255, 0.9);
    color: #2563eb;
    border: none;
    border-radius: 6px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    z-index: 5;
}
.message:hover .copy-btn { opacity: 1; }

/* 针对不同气泡背景的复制按钮适配 */
.message-user .copy-btn {
    background: rgba(255,255,255,0.96);
    color: #111827;
    border: 1px solid rgba(255,255,255,0.7);
}
.message-bot .copy-btn {
    background: rgba(37,99,235,0.08);
    color: #2563eb;
    border: 1px solid #c7d2fe;
}

/* 消息内容添加右侧内边距，防止被复制按钮遮挡 */
.message-content {
    padding-right: 36px;
    position: relative;
    width: 100%;
}

.message-user::before,
.message-bot::before {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.message-user::before {
    content: '我';
    top: -10px;
    right: -20px;
    background: #1d4ed8;
    color: #fff;
    z-index: 3;
}

.message-bot::before {
    content: 'AI';
    top: -10px;
    left: -20px;
    background: #e0e7ff;
    color: #1d4ed8;
    border: 1px solid #c7d2fe;
    z-index: 3;
}

.message-content pre {
    background: #0b1220;
    color: #e6edf3;
    border-radius: 10px;
    padding: 12px 14px;
    overflow: auto;
    border: 1px solid rgba(255,255,255,0.08);
}

.message-content code:not(pre code) {
    background: #eef2ff;
    color: #1f2937;
    border-radius: 6px;
    padding: 2px 6px;
    border: 1px solid #e5e7eb;
}

.message-bot .message-content h1,
.message-bot .message-content h2,
.message-bot .message-content h3 {
    color: #111827;
}
.message-bot .message-content ul,
.message-bot .message-content ol {
    padding-left: 22px;
}
.message-bot .message-content a {
    color: #2563eb;
    text-decoration: underline;
}

.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #2563eb;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 5; /* 确保按钮在上层 */
}

.copy-btn:hover {
    opacity: 1;
    background: #fff;
    transform: scale(1.05);
}

.code-copy-btn:hover {
    opacity: 1;
    background: #fff;
    transform: scale(1.05);
}

/* 确保消息容器有足够的底部间距 */
#chat-messages {
    /* 增加底部内边距，确保滚动时最后的消息不被输入框遮挡 */
    /* 这个值需要大于或等于 .chat-input-container 的高度 + 一些额外间距 */
    padding-bottom: 200px !important;
    position: relative;
    /* 其他样式 */
    flex: 1;
    overflow-y: auto;
    padding-top: 20px; /* 顶部也加一些间距 */
    padding-left: 15px;
    padding-right: 15px;
    scroll-behavior: smooth; /* 平滑滚动 */
}

/* 添加底部占位元素 */
#chat-messages::after {
    content: "";
    display: block;
    height: 210px;  /* 与padding-bottom保持一致 */
    width: 100%;
}

/* 消息容器样式优化 */
.message {
    position: relative;
    overflow: visible;
}

.message-bot + .message-user,
.message-user + .message-bot {
    margin-top: 24px;
}



/* 侧边栏 */
.chat-sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
    width: 260px;
    background: linear-gradient(135deg, #e6eaff 0%, #f7f8fa 100%);
    border-right: 1.5px solid #e5e7eb;
    overflow-y: auto;
    z-index: 10;
    padding-top: 20px !important;
    border-radius: 0 18px 18px 0;
    box-shadow: 2px 0 12px rgba(80,120,255,0.04);
}
.sidebar-header {
    padding: 0 18px 8px 18px;
    font-weight: bold;
    font-size: 18px;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.new-chat-btn {
    background: #2563eb;
    color: #fff;
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 14px;
    border: none;
    margin-left: 8px;
    transition: background 0.2s;
}
.new-chat-btn:hover {
    background: #1749b1;
}
.conversation-list {
    padding: 16px 8px 8px 8px;
    margin-top: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    height: calc(100vh - 150px);
    overflow-y: auto;
    border: none;
    background: none;
}

.conversation-item {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 18px 18px 12px 18px;
    border-radius: 12px;
    margin-bottom: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(74,107,175,0.06);
    transition: box-shadow 0.2s, border-color 0.2s, background 0.2s;
    position: relative;
}

.conversation-item.active,
.conversation-item:hover {
    background: #f5f8ff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(74,107,175,0.12);
}

.conversation-title {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 4px;
    position: relative;
}

.conversation-title .title-text {
    display: inline-block;
    max-width: calc(100% - 56px); /* 预留删除按钮与图标空间 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    margin-left: 8px;
}

.conversation-title span {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
}

.conversation-date {
    font-size: 12px;
    color: #94a3b8;
    text-align: right;
    font-family: 'Courier New', monospace;
    margin-top: 2px;
    opacity: 0.8;
}

.delete-chat-btn {
    background: none;
    border: none;
    color: #b0b0c0;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 16px;
    margin-left: 6px;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
    box-shadow: none;
    position: absolute; /* 避免占据文本宽度 */
    right: 8px;
    top: 2px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.delete-chat-btn::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b0b0c0'%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");
    background-repeat: no-repeat;
    background-position: center;
    transition: all 0.2s ease;
}

.delete-chat-btn:hover::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ef4444'%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");
}

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

.delete-chat-btn:hover {
    color: #ef4444;
    background: #fff0f0;
}

/* 响应式 */
@media (max-width: 1024px) {
    .chat-sidebar { 
        width: 60px; 
    }
    .chat-main, .chat-input-container { 
        margin-left: 60px; 
        width: calc(100% - 60px); 
    }
    .chat-container, .chat-input-container { 
        max-width: 98vw; 
    }
}

@media (max-width: 768px) {
    .chat-layout {
        flex-direction: column;
    }
    
    .chat-sidebar {
        width: 100%;
        max-width: 100%;
        position: fixed;
        top: 60px;
        left: 0;
        height: calc(100% - 60px);
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }
    
    .chat-sidebar.active {
        transform: translateX(0);
    }
    
    .chat-main {
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .chat-container {
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
        height: calc(100vh - 120px);
        display: flex;
        flex-direction: column;
        position: relative;
    }
    
    /* 添加侧边栏切换按钮 */
    .sidebar-toggle {
        display: block;
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
        background-color: #4a6cf7;
        color: white;
        border-radius: 50%;
        text-align: center;
        line-height: 50px;
        font-size: 20px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        z-index: 101;
    }
    
    /* 输入框在移动端的调整 */
    .input-wrapper {
        flex-wrap: wrap;
    }
    
    .model-select {
        width: 100%;
        margin-bottom: 8px;
        margin-right: 0;
    }
    
    .chat-main, .chat-input-container { 
        margin-left: 0; 
        width: 100%; 
        left: 0; 
        right: 0;
    }   left: 0; 
        right: 0;
    }
    
    .chat-container, .chat-input-container { 
        max-width: 100vw; 
    }
    
    /* 添加一个历史会话切换按钮 */
    .history-toggle-btn {
        position: fixed;
        top: 70px;
        left: 10px;
        width: 40px;
        height: 40px;
        background: #2563eb;
        color: white;
        border: none;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1001;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        cursor: pointer;
    }
    
    /* 当侧边栏激活时，调整历史按钮位置 */
    .history-toggle-btn.active {
        left: calc(100% - 50px);
    }
    
    /* 确保侧边栏内容在移动端正确显示 */
    .conversation-list {
        height: auto;
        max-height: 70vh;
        overflow-y: auto;
    }
}
#chat-messages {
    padding: 100px 20px 120px !important;
    min-height: calc(100vh - 220px);
    margin-top: 0;
}

/* 移动端适配 */
@media (max-width: 768px) {
    #chat-messages {
        padding: 80px 10px 100px !important;
    }
}

/* 隐藏PC端不需要的元素 */
@media (min-width: 769px) {
    /* 隐藏移动端专用的历史会话按钮 */
    .history-toggle-btn {
        display: none !important;
    }
    
    /* 隐藏截图中红框标记的内容 */
    .debug-info, 
    .mobile-only-controls {
        display: none !important;
    }
    
    /* 修复右侧边栏显示问题 */
    .chat-main {
        margin-right: 0;
    }
    
    /* 确保右侧不显示多余的滚动条 */
    .right-sidebar-placeholder {
        display: none !important;
    }
}
.chat-main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto 0 280px;
    padding: 0 20px;
    background-color: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 聊天消息容器 - 允许滚动 */
.chat-messages {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 200px !important;
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding-top: 20px;
    padding-left: 120px;
    padding-right: 120px;
    scroll-behavior: smooth;
}

/* 输入框固定在底部 */
.chat-input-container {
    position: fixed;
    bottom: 0;
    width: 1200px;
    left: calc(280px + (100vw - 280px - 1200px)/2);
    right: auto;
    background: #fff;
    padding: 12px 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
    z-index: 100;
}

/* 确保聊天区域有足够的底部padding，避免被输入框遮挡 */
#chat-messages {
    padding-bottom: 100px !important;
}

/* 聊天中心包装器 */
.chat-center-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: visible;
}

/* 确认弹窗蒙版 */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

/* 确认弹窗样式优化 */
.confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    width: 320px;
    max-width: 90%;
    text-align: center;
    display: none;
}

.confirm-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 300px;
    width: 90%;
    text-align: center;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.confirm-btn, .cancel-btn {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.confirm-btn {
    background: #ff4d4f;
    color: white;
    border: none;
}

.cancel-btn {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}
/* 复制提示样式 */
.copy-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* 打字指示器样式 */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
}

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

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #007bff;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

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

/* 复制按钮样式优化 */
.copy-btn {
    opacity: 0.7;
    transition: opacity 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    border-radius: 3px;
}

.copy-btn:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
}

.message-content {
    position: relative;
}

.typing-bounce {
    display: inline-block;
}

.typing-bounce div {
    width: 8px;
    height: 8px;
    background-color: #3498db;
    border-radius: 50%;
    display: inline-block;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

@keyframes typing-bounce {
    0%, 80%, 100% { 
        transform: translateY(0);
    }
    40% {
        transform: translateY(-15px);
    }
}

/* 结束标记 */
