/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background-color: #ffffff; 
    color: #333;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background-color: #F8F8F8;
    border-right: 1px solid #e9ecef;
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: visible; /* 允许内容溢出显示 */
    /* 确保子元素可以溢出到左侧 */
    clip-path: none;
    contain: none;
    /* 强制允许所有方向的溢出 */
    overflow-x: visible !important;
    overflow-y: visible !important;
}

/* 侧边栏收起状态 */
.sidebar.collapsed {
    transform: translateX(-250px);
}


/* 侧边栏收起时隐藏滚动条 */ 
.sidebar.collapsed .chat-history,
.sidebar.collapsed .chat-list,
.sidebar.collapsed .history-content {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.sidebar.collapsed .chat-history::-webkit-scrollbar,
.sidebar.collapsed .chat-list::-webkit-scrollbar,
.sidebar.collapsed .history-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* 侧边栏收起时显示的展开按钮 */
.collapsed-expand-btn {
    position: absolute;
    top: 8px;
    right: 0px;
    width: 30px;
    height: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
   
    transition: all 0.3s ease;
}

.collapsed-expand-btn:hover {
    background-color: transparent;
    transform: scale(1.05);
}

/* 展开按钮图标样式 */
.expand-icon {
    display: block;
    transition: opacity 0.3s ease;
}

.expand-hover-icon {
    display: none;
    transition: opacity 0.3s ease;
}

.collapsed-expand-btn:hover .expand-icon {
    display: none !important;
}

.collapsed-expand-btn:hover .expand-hover-icon {
    display: block !important;
}



.sidebar.collapsed .collapsed-expand-btn {
    display: flex;
}

/* 侧边栏收起时显示的新聊天按钮 */
.collapsed-expand-btn1 {
    position: absolute;
    top: 38px;
    right: 0px;
    width: 30px;
    height: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.3s ease;
    user-select: none;
}

.collapsed-expand-btn1:hover {
    background-color: #f8f9fa;
    border-color: #1890ff;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

.collapsed-expand-btn1:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(24, 144, 255, 0.2);
}

.sidebar.collapsed .collapsed-expand-btn1 {
    display: flex;
}

.sidebar-header {
    padding: 20px;

    margin-bottom: 10px;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
}

/* 移除新聊天按钮的悬浮效果 */

.new-chat-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}



.new-chat:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(24, 144, 255, 0.2);
}

.new-chat-icon {
    font-size: 16px;
}

.new-chat-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* 聊天历史记录 */
.chat-history {
    flex: 1;
    padding: 10px 12px 20px 20px;
    overflow-y: auto;
    overflow-x: visible !important; /* 强制允许水平溢出显示 */
    display: flex;
    flex-direction: column;
    min-height: 0; /* 确保flex子元素可以收缩 */
    /* 添加滚动条样式 */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #c1c1c1 #f1f1f1; /* Firefox */
    -ms-overflow-style: auto; /* IE and Edge */
}

/* 历史对话标题栏 */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 8px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.history-title {
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.history-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.toggle-icon {
    font-size: 12px;
    color: #666;
    transition: transform 0.3s ease;
}

.history-toggle.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* 历史对话内容 */
.history-content {
    overflow-x: visible !important; /* 强制允许水平溢出显示 */
    overflow-y: auto; /* 保持垂直滚动 */
    transition: all 0.3s ease;
    /* 确保激活状态的背景可以溢出 */
    position: relative;
    z-index: 1;
    /* 强制允许所有方向的溢出 */
    clip-path: none !important;
    contain: none !important;
    /* 确保不会裁剪子元素 */
    overflow: visible !important;
    /* 为溢出内容留出空间 */
    padding-left: 0;
    margin-left: 0;
}

/* 聊天标题头部 */
.chat-title-header {

  margin-bottom: 10px;
    color: rgba(203, 202, 202, 1);

    font-family: Noto Sans SC;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0px;
    text-align: left;
}

/* 聊天列表容器 */
.chat-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible !important; /* 强制允许水平溢出显示 */
    min-height: 0; /* 确保可以滚动 */
    /* 确保子元素可以溢出 */
    position: relative;
    /* 添加滚动条样式 */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #c1c1c1 #f1f1f1; /* Firefox */
    -ms-overflow-style: auto; /* IE and Edge */
    /* 确保激活状态的背景可以溢出 */
    z-index: 1;
    /* 强制允许所有方向的溢出 */
    clip-path: none !important;
    contain: none !important;
    /* 确保不会裁剪子元素 */
    overflow: visible !important;
    /* 为溢出内容留出空间 */
    padding-left: 0;
    margin-left: 0;
}

.history-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

.history-content.expanded {
    max-height: none;
    opacity: 1;
    flex: 1;
    overflow-y: auto;
    overflow-x: visible !important; /* 强制允许水平溢出显示 */
    /* 添加滚动条样式 */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #c1c1c1 #f1f1f1; /* Firefox */
    -ms-overflow-style: auto; /* IE and Edge */
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    /*margin-left: -3px; !* 增加负边距，让内容向左溢出更多 *!*/
    padding: 8px 12px 8px 17px; /* 调整左内边距以保持内容位置，增加上下padding */
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: transparent;
    margin-right: 8px; /* 为滚动条留出空间 */
    /* 确保内容可以溢出显示 */
    position: relative;
    z-index: 10; /* 提高z-index确保在最上层 */
    /* 强制允许溢出 */
    overflow: visible !important;
    white-space: nowrap;
    /* 使用transform进一步向左移动 */
    transform: translateX(-15px);
    /* 确保不会被父容器裁剪 */
    clip-path: none !important;
    contain: none !important;
    /* 确保背景色覆盖整个区域，包括溢出部分 */
    background-clip: padding-box;
    background-origin: padding-box;
}

.chat-item:hover {
    background-color: #e9ecef;
}

.chat-item.active {
    background-color: #e9ecef;
}


.chat-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.chat-title {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: visible !important; /* 强制允许文本溢出显示 */
    text-overflow: clip; /* 改为clip而不是ellipsis */
    /* 确保文本完全可见 */
    min-width: 0; /* 允许flex项目收缩 */
    width: auto; /* 让宽度自适应内容 */
    position: relative;
    z-index: 2;
}

.chat-time {
    font-size: 11px;
    color: #999;
    margin-left: auto;
    white-space: nowrap;
}

.chat-item.active .chat-time {
    color: #666;
}

/* 主聊天区域 */
.main-chat {
    margin-left: 280px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}


/* 侧边栏收起时主聊天区域样式 */
.sidebar.collapsed + .main-chat {
    margin-left: 30px;
}

/* 统一聊天容器 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto; /* 居中显示 */
    width: 100%;
    padding: 0 20px;
    position: relative; /* 为滚动按钮提供定位参考 */
    height: 100%; /* 确保容器占满高度 */
    min-height: 0; /* 允许flex子元素收缩 */
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    padding: 50px 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    min-height: 0; /* 允许flex子元素收缩 */
    max-height: calc(100vh - 200px); /* 限制最大高度，为输入框留出空间 */
}

.message {
    word-wrap: break-word;
    display: flex;
    width: 100%;
}

.user-message {
    justify-content: flex-end; /* 用户消息右对齐 */
}

.ai-message {
    justify-content: flex-start; /* AI消息左对齐 */
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-message .message-content {
    background-color: #F8F8F8;
    color: #333;
    border-bottom-right-radius: 4px;
    margin-left: auto;
    max-width: 70%;
}

.ai-message .message-content {
    background-color: #F8F8F8;
    color: #333;
    border-bottom-left-radius: 4px;
    margin-right: auto;
    max-width: 70%;
}

.system-message {
    align-self: center;
    max-width: 90%;
}

.system-message .message-content {
    background-color: #e6f7ff;
    color: #1890ff;
    border: 1px solid #91d5ff;
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
    padding: 8px 12px;
}

/* 滚动到底部按钮 */
.scroll-to-bottom-btn {
    position: absolute;
    bottom: 120px; /* 调整位置，确保在输入框上方 */
    right: 0;
    width: 40px;
    height: 40px;
    background-color: #1890ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-to-bottom-btn:hover {
    background-color: #40a9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.scroll-to-bottom-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 输入区域 */
.input-area {
    padding: 60px 0;
    padding-bottom: 0px;
    margin-top: 60px;

    background-color: #ffffff;
    flex-shrink: 0; /* 防止输入区域被压缩 */
    position: sticky; /* 使输入框粘性定位 */
    bottom: 0; /* 固定在底部 */
    z-index: 100; /* 确保在其他内容之上 */
}

.input-container {
    width: 100%;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.message-input {
    flex: 1;
    padding: 16px 80px 16px 16px; /* 上下padding相等，实现垂直居中 */
    border: 1px solid #e9ecef;
    border-radius: 40px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
    width: 100%;
}

.message-input:focus {
    border-color: #e9ecef;
}

.input-actions {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mic-button, .send-button {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 12px;
}

.mic-button {
    background-color: #f8f9fa;
    color: #666;
}

.mic-button:hover {
    background-color: #e9ecef;
    transform: scale(1.05);
}

.mic-button.listening {
    background-color: #ff4d4f;
    color: white;
    animation: pulse 1.5s infinite;
}

.send-button {
    background: rgba(234, 234, 234, 1);
    border: none;
}

.send-button:hover {
    background-color: rgba(234, 234, 234, 1);
    transform: none;
}

.send-button:disabled {
    background-color: #d9d9d9;
    cursor: not-allowed;
    transform: none;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}


/* 全局滚动条样式 - 隐藏所有滚动条 */
/* 默认隐藏滚动条，但允许特定区域显示 */
* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

*::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* 特定区域的滚动条样式 */
.chat-messages::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera - 主聊天区域保持隐藏 */
}

/* 左侧栏滚动条样式 - 显示滚动条 */
.chat-history::-webkit-scrollbar,
.chat-list::-webkit-scrollbar,
.history-content::-webkit-scrollbar {
    width: 6px; /* 滚动条宽度 */
}

.chat-history::-webkit-scrollbar-track,
.chat-list::-webkit-scrollbar-track,
.history-content::-webkit-scrollbar-track {
    background: #f1f1f1; /* 滚动条轨道颜色 */
    border-radius: 3px;
}

.chat-history::-webkit-scrollbar-thumb,
.chat-list::-webkit-scrollbar-thumb,
.history-content::-webkit-scrollbar-thumb {
    background: #c1c1c1; /* 滚动条滑块颜色 */
    border-radius: 3px;
}

.chat-history::-webkit-scrollbar-thumb:hover,
.chat-list::-webkit-scrollbar-thumb:hover,
.history-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8; /* 滚动条滑块悬停颜色 */
}

.chat-messages {
    scrollbar-width: none; /* Firefox - 主聊天区域保持隐藏 */
    -ms-overflow-style: none; /* IE and Edge - 主聊天区域保持隐藏 */
}

.chat-history,
.chat-list,
.history-content {
    scrollbar-width: thin; /* Firefox - 左侧栏显示滚动条 */
    scrollbar-color: #c1c1c1 #f1f1f1; /* Firefox - 左侧栏滚动条颜色 */
    -ms-overflow-style: auto; /* IE and Edge - 左侧栏显示滚动条 */
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
    }
    
    .main-chat {
        margin-left: 0;
    }
    
    .chat-container {
        padding: 0 15px;
    }
    
    .message {
        max-width: 100%;
    }

    .ai-message .message-content {
        max-width: 100%;
        margin-right: 0; /* 重置右外边距，确保消息靠左显示 */




    }
}

/* 小屏幕时侧边栏收起状态 */
@media (max-width: 640px) {
    .sidebar {
        display: none;
        width: 70%;
        /* 确保移动端侧边栏可以滚动 */
        overflow-y: auto;
        overflow-x: visible;
    }
    
    /* 移动端显示侧边栏时的样式 */
    .sidebar.mobile-visible {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 70%;
        height: 100vh;
        z-index: 1000;
        background-color: #F8F8F8;
        border-right: 1px solid #e9ecef;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: visible;
    }
    
    /* 确保移动端聊天历史可以滚动 */
    .sidebar.mobile-visible .chat-history {
        flex: 1;
        overflow-y: auto;
        overflow-x: visible;
        min-height: 0;
    }
    
    .sidebar.mobile-visible .chat-list {
        flex: 1;
        overflow-y: auto;
        overflow-x: visible;
        min-height: 0;
    }
    
    .sidebar.mobile-visible .history-content {
        flex: 1;
        overflow-y: auto;
        overflow-x: visible;
        min-height: 0;
    }
}


@media (max-width: 640px) {
    .ai-message .message-content {
        max-width: 100% !important;
        width: 100% !important;
        margin-right: 0 !important;
    }
    
    .user-message .message-content {
        max-width: 100% !important;

    }
}


@media (max-width: 480px) {
    .chat-container {
        padding: 0 10px;
    }
    
    .chat-messages {
        padding: 15px 0;
    }
    
    .input-area {
        padding: 15px 0;
    }
    
    .message-content {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .mic-button, .send-button {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }
    
    .scroll-to-bottom-btn {
        width: 36px;
        height: 36px;
        bottom: 90px;
    }
}

/* 侧边栏切换按钮样式 */
.sidebar-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;


}

.toggle-btn {
    cursor: pointer;
    transition: opacity 0.3s ease;
    width: 24px;
    height: 24px;
}

.toggle-btn:hover {
    opacity: 0.7;
}

.hidden {
    display: none;
}

/* 展开侧边栏按钮样式 */
.expand-sidebar-btn {
    position: fixed;
    top: 20px;
    left: 5px;
    width: 20px;
    height: 20px;
    background-color: #1890ff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.expand-sidebar-btn:hover {
    background-color: #40a9ff;
    transform: scale(1.05);
}

.expand-sidebar-btn img {
    width: 12px;
    height: 12px;
    filter: brightness(0) invert(1);
}

.expand-sidebar-btn:not(.hidden) {
    display: flex;
}

/* 语音消息提示样式 */
.voice-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    max-width: 300px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    white-space: pre-line;
}

.voice-message-voice-message-success {
    background-color: #52c41a;
}

.voice-message-voice-message-error {
    background-color: #ff4d4f;
}

.voice-message-voice-message-info {
    background-color: #1890ff;
}

/* 流式消息样式 */
.message-content.streaming {
    position: relative;
}

.message-content.streaming::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 50%;
    margin-left: 8px;
    animation: ballGrow 1.5s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes ballGrow {
    0% { 
        transform: scale(0.3);
        opacity: 0.7;
    }
    50% { 
        transform: scale(1.2);
        opacity: 1;
    }
    100% { 
        transform: scale(0.3);
        opacity: 0.7;
    }
}
.new-chat1{
    color: rgba(91, 91, 91, 1);

    font-family: Noto Sans SC;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0px;
    text-align: left;
    margin-left: 10px;
}
/* 错误消息样式 */
.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    background-color: #ff4d4f;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    max-width: 300px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

/* 发送按钮禁用状态 */
.send-button:disabled {
    background-color: #d9d9d9 !important;
    cursor: not-allowed !important;
    transform: none !important;
    opacity: 0.5 !important;
}

/* 加载状态指示器 */
.loading-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

/* 列表项样式 */
.message-content ul {
    list-style-type: none;
    padding-left: 0;
    margin: 8px 0;
}

.message-content li {
    position: relative;
    padding-left: 20px;
    margin: 4px 0;
    line-height: 1.5;
}

.message-content li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #333;
    font-weight: bold;
    font-size: 16px;
}

/* 确保黑点显示在正确位置 */
.message-content br + strong + br + li::before,
.message-content br + li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #333;
    font-weight: bold;
    font-size: 16px;
}
.mobile-phone{
    color: rgba(91, 91, 91, 1);

    font-family: Noto Sans SC;
    font-size: 9px;
    font-weight: 400;
    line-height: 13px;
    letter-spacing: 0px;
    text-align: left;
}