/* 
 * 重置默认样式，确保所有元素的盒模型为 border-box
 */
 /* 在原有 CSS 基础上添加以下样式 */

/* 反馈成功消息样式 */
.message.feedback-success {
    background-color: #e8f5e9;
    border: 2px solid #4CAF50;
    border-radius: 18px;
    padding: 15px;
    max-width: 90%;
    margin: 15px auto;
}

.message.feedback-success .message-text {
    color: #2e7d32;
}

/* 封禁消息样式 */
.message.banned-message {
    background-color: #ffebee;
    border: 2px solid #ff6b6b;
    border-radius: 18px;
    padding: 20px;
    max-width: 90%;
    margin: 20px auto;
}

.message.banned-message h3 {
    color: #ff6b6b;
    margin-bottom: 10px;
}

/* 禁用状态样式 */
.input-container.disabled {
    opacity: 0.5;
    pointer-events: none;
}

#message-input:disabled,
#send-btn:disabled,
#domain-select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* 工具调用提示样式 */
.tool-call-indicator {
    background-color: #fff3e0;
    border-left: 3px solid #ff9800;
    padding: 10px;
    margin: 10px 0;
    font-size: 12px;
    color: #e65100;
}

/* 反馈表单样式（如果需要弹窗） */
.feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.feedback-modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
}

.feedback-modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

.feedback-modal-content label {
    display: block;
    margin-bottom: 5px;
    color: #666;
}

.feedback-modal-content input,
.feedback-modal-content textarea,
.feedback-modal-content select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.feedback-modal-content button {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
}

.feedback-modal-content button:hover {
    background-color: #45a049;
}
 /* 封禁消息样式 */
.message.banned-message {
    background-color: #ffebee;
    border: 2px solid #ff6b6b;
    border-radius: 18px;
    padding: 20px;
    max-width: 90%;
    margin: 20px auto;
}

.message.banned-message h3 {
    color: #ff6b6b;
    margin-bottom: 10px;
}

/* 禁用状态样式 */
.input-container.disabled {
    opacity: 0.5;
    pointer-events: none;
}

#message-input:disabled,
#send-btn:disabled,
#domain-select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* 封禁页面动画 */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.banned-icon {
    animation: pulse 2s infinite;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/*
 * 页面主体样式
 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    height: 100vh; /* 占满视口高度 */
    overflow: hidden; /* 隐藏页面级滚动条 */
}

/*
 * 主容器布局，采用 Flex 弹性布局
 */
.container {
    display: flex;
    height: 100vh;
    position: relative; /* 为汉堡按钮的绝对定位提供参照 */
}

/*
 * 汉堡菜单按钮（移动端用）
 */
.hamburger-btn {
    display: none; /* 默认隐藏 */
    position: absolute;
    top: 10px;
    right: 10px;
    background: #202123;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    z-index: 101; /* 确保在最上层 */
    border-radius: 4px;
}

/*
 * 侧边栏样式
 */
.sidebar {
    width: 260px; /* 固定宽度 */
    background-color: #202123; /* 深色背景 */
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* 内容溢出时显示垂直滚动条 */
    transition: transform 0.3s ease; /* 添加滑入滑出动画 */
    z-index: 100; /* 确保层级高于主内容区 */
}

/*
 * 聊天主区域样式
 */
.chat-container {
    flex: 1; /* 占据剩余空间 */
    display: flex;
    flex-direction: column;
    background-color: white;
    border-top: 1px solid #e5e5e5; /* 与侧边栏的分割线 */
    transition: margin-left 0.3s ease; /* 过渡效果配合侧边栏动画 */
}

/*
 * 通用按钮样式
 */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s; /* 悬停颜色变化动画 */
}

/*
 * 主要按钮样式 (例如 "新建聊天")
 */
.btn-primary {
    background-color: #4CAF50; /* 绿色 */
    color: white;
    width: 100%; /* 宽度占满父容器 */
    margin-bottom: 20px;
}
.btn-primary:hover {
    background-color: #45a049; /* 悬停加深绿色 */
}

/*
 * 发送按钮样式
 */
.btn-send {
    background-color: #10a37f; /* 绿松石色 */
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.btn-send:hover {
    background-color: #0d8a6a; /* 悬停加深绿松石色 */
}

/*
 * 停止生成按钮样式 (如果需要)
 */
.btn-stop {
    background-color: #ff6b6b; /* 红色 */
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.btn-stop:hover {
    background-color: #ff5252; /* 悬停加深红色 */
}

/*
 * 域名选择器容器样式
 */
.domain-selector {
    margin-bottom: 20px;
}
.domain-selector label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}
.domain-selector select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    background-color: #343541; /* 深灰色背景 */
    color: white;
    border: 1px solid #4d4d4f; /* 较浅的边框 */
}

/*
 * 对话列表样式
 */
.conversations-list h3 {
    margin-bottom: 15px;
    font-size: 16px;
}
.conversations-list ul {
    list-style: none; /* 去掉默认列表符号 */
    padding: 0;
}
.conversation-item {
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 5px;
    white-space: nowrap; /* 文本不换行 */
    overflow: hidden; /* 隐藏溢出文本 */
    text-overflow: ellipsis; /* 溢出部分显示省略号 */
}
.conversation-item:hover {
    background-color: #343541; /* 悬停高亮 */
}
.conversation-item.active {
    background-color: #343541; /* 当前选中项高亮 */
}

/*
 * 聊天头部样式
 */
.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5; /* 底部分割线 */
    background-color: white;
    position: sticky; /* 粘性定位，滚动时固定在顶部 */
    top: 0;
    z-index: 10; /* 层级高于消息内容 */
}
.chat-header h2 {
    color: #333;
}

/*
 * 消息内容区域样式
 */
.messages-container {
    flex: 1; /* 占据聊天区域的剩余空间 */
    padding: 20px;
    overflow-y: auto; /* 内容溢出时显示垂直滚动条 */
    display: flex;
    flex-direction: column;
    gap: 15px; /* 消息之间的间距 */
}

/*
 * 单条消息气泡样式
 */
.message {
    max-width: 80%; /* 最大宽度限制 */
    padding: 12px 16px;
    border-radius: 18px; /* 圆角气泡 */
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease-in-out; /* 进入动画 */
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/*
 * 用户消息气泡样式
 */
.user-message {
    align-self: flex-end; /* 自对齐到右侧 */
    background-color: #10a37f; /* 绿松石色背景 */
    color: white;
    border-bottom-right-radius: 4px; /* 右下角尖角效果 */
}

/*
 * 助手消息气泡样式
 */
.assistant-message {
    align-self: flex-start; /* 自对齐到左侧 */
    background-color: #f0f0f0; /* 浅灰色背景 */
    color: #333;
    border-bottom-left-radius: 4px; /* 左下角尖角效果 */
}

/*
 * 头像图片样式
 */
.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%; /* 圆形 */
    margin-right: 10px;
    object-fit: cover; /* 图片填充方式 */
}

/*
 * 消息内容布局
 */
.message-content {
    display: flex;
    align-items: flex-start; /* 顶部对齐 */
}
.message-text {
    flex: 1; /* 占据剩余空间 */
    word-wrap: break-word; /* 允许长单词换行 */
    white-space: pre-wrap; /* 保留空白符和换行符 */
}

/*
 * 输入框容器样式
 */
.input-container {
    padding: 20px;
    border-top: 1px solid #e5e5e5; /* 顶部分割线 */
    background-color: white;
    display: flex; /* 使用Flex布局排列输入框和按钮 */
    gap: 10px; /* 元素间距 */
}

/*
 * 消息输入框样式
 */
#message-input {
    flex: 1; /* 占据剩余空间 */
    padding: 12px 15px;
    border: 1px solid #ddd; /* 默认边框 */
    border-radius: 8px;
    resize: none; /* 禁止用户手动调整大小 */
    font-size: 16px;
    min-height: 50px;
    max-height: 150px;
}
#message-input:focus {
    outline: none; /* 去除默认焦点轮廓 */
    border-color: #10a37f; /* 获得焦点时的边框颜色 */
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2); /* 获得焦点时的外发光阴影 */
}

/*
 * 加载动画样式
 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3); /* 半透明白色边框 */
    border-radius: 50%;
    border-top-color: white; /* 顶部边框为纯白色，形成旋转效果 */
    animation: spin 1s ease-in-out infinite; /* 无限循环旋转动画 */
}
@keyframes spin {
    to { transform: rotate(360deg); } /* 旋转360度 */
}

/*
 * 响应式设计 - 平板及手机端
 */
@media (max-width: 768px) {
    .hamburger-btn {
        display: block; /* 移动端显示汉堡按钮 */
    }

    .sidebar {
        position: fixed; /* 移动端侧边栏固定定位 */
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%); /* 默认隐藏在屏幕外 */
    }

    .sidebar.open {
        transform: translateX(0); /* 显示侧边栏 */
    }

    .chat-container {
        margin-left: 0; /* 移动端主内容区无左边距 */
    }

    /* 可选：当侧边栏打开时，模糊主内容区 */
    .sidebar.open ~ .chat-container {
        filter: blur(2px);
    }
}