/* 群组列表样式 */
#groups-area {
    width: 200px;
    height: 100%;
    background-color: #f8f9fa;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    /* 移除固定定位，使其回到正常文档流 */
}

#groups-area h3 {
    padding: 5px 16px;
    margin: 0;
    background-color: #e9ecef;
    border-bottom: 1px solid #ddd;
    font-size: 15px;
    font-weight: 600;
    color: #495057;
    /* 文字居中 */
    text-align: center;
}

/* 服务列表标题样式 */
.service-list-title {
    font-size: 15px;
    margin: 0;
    padding: 5px 10px;
    background: linear-gradient(135deg, #667eea 0%, #4b7fa2 100%);
    color: white;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* 文字居中 */
    text-align: center;
}
/* 服务列表标题样式 */
.service-detail-title {
    font-size: 15px;
    margin: 0;
    padding: 5px 10px;
    background: linear-gradient(135deg, #667eea 0%, #4b7fa2 100%);
    color: white;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* 文字居中 */
    text-align: center;
}

/* 群组容器样式 */
#groups-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background-color: #f8f9fa;
}

/* 登录按钮容器 */
.login-button-container {
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 登录按钮样式 */
.login-button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
}

/* 群组项基础样式 */
.group-item {
    padding: 15px 15px;
    cursor: pointer;
    margin-bottom: 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

/* 群组项悬停效果 */
.group-item:hover {
    background-color: #f5f7fa;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 群组项激活状态 */
.group-item.active {
    background: linear-gradient(135deg, #667eea 0%, #4b7fa2 100%);
    color: white;
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* 群组项加载状态 */
.group-item.loading {
    color: #666;
    font-style: italic;
    cursor: default;
    opacity: 0.7;
}

/* 群组图片样式 */
.group-image {
    width: 35px;
    height: 35px;
    border-radius: 20%;
    margin-right: 12px;
    object-fit: cover;
    border: 2px solid #e1e8ed;
    transition: all 0.3s ease;
}

.group-item.active .group-image {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* 群组图片占位符样式 */
.group-image-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    background: linear-gradient(135deg, #90caf9 0%, #42a5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    border: 2px solid #e1e8ed;
    transition: all 0.3s ease;
}

.group-item.active .group-image-placeholder {
    background: linear-gradient(135deg, #e0f7fa 0%, #80deea 100%);
    color: #00796b;
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* 群组名称样式 */
.group-name {
    font-weight: 500;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 群组项激活时的名称样式 */
.group-item.active .group-name {
    font-weight: 600;
}

/* 群组项添加微妙的背景图案 */
.group-item::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.group-item:hover::after {
    opacity: 1;
}



* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', sans-serif;
}

/* 主容器布局 - 固定宽度800px并居中 */
body {
    background-color: #f7f7f7;
    height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* 页面主容器 - 固定宽度800px并居中 */
#page-container {
    height: 100vh;
}

/* 确保页面容器内的元素正确布局 */
#groups-area,
#chat-area {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 确保群组区域和聊天区域正确占用空间 */
#groups-area {
    flex-shrink: 0;
    /* 不允许缩小 */
}

#chat-area {
    flex-grow: 1;
    /* 尽可能占用剩余空间 */
}

/* 中间聊天区域 */
#chat-area {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    position: relative;
    /* 确保聊天区域与群组列表正确分布 */
    min-width: 0;
}



.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .2s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: #4da6ff;
}

input:checked+.toggle-slider:before {
    transform: translateX(16px);
}


/* 提示词区域 */
#prompts-section {
    margin-bottom: 15px;
}

#prompts-section h4 {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.prompt-tag {
    display: inline-block;
    padding: 4px 8px;
    margin: 2px;
    background-color: #f0f0f0;
    border-radius: 12px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.prompt-tag:hover {
    background-color: #e6f2ff;
    color: #0066cc;
}



/* Webhook消息样式 */
.webhook-message {
    background-color: #f0f7ff;
    border: 1px solid #b3d9ff;
    border-radius: 10px;
    padding: 12px;
    margin: 10px 0;
    word-break: break-word;
}

.webhook-title {
    font-weight: bold;
    color: #0066cc;
    margin-bottom: 8px;
    font-size: 14px;
    /* 居中对齐 */
    text-align: center;
}

.webhook-section {
    margin-bottom: 8px;
}

.webhook-section-title {
    font-weight: bold;
    color: #333;
    font-size: 13px;
    margin-bottom: 4px;
}

.webhook-content {
    background-color: #fff;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #333;
    white-space: pre-wrap;
    overflow-x: auto;
}

.webhook-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

/* 聊天容器样式 */
#chat-container {
    height: calc(100% - 180px);
    /* 默认高度，输入区域200px */
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

#chat-container::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.message-wrapper {
    margin-bottom: 5px;
    display: flex;
    flex-direction: column;
}



.bot-message-wrapper {
    align-self: flex-start;
    align-items: flex-start;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px 18px 18px 0px;
    word-break: break-word;
    line-height: 1.5;
    white-space: pre-wrap;
    margin-bottom: 15px;
}

.user-message {
    background-color: #aedfff;
    color: #333;
    border: 1px solid #aedfff;
}

.bot-message {
    background-color: #ffffff;
    color: #333;
    border: 1px solid #e0e0e0;
}

.system-message {
    background-color: #f0f0f0;
    color: #666;
    font-size: 12px;
    text-align: center;
    padding: 5px 10px;
    border-radius: 12px;
    margin: 5px auto;
    max-width: 60%;
}

.system-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    text-align: center;
    width: 100%;
}

/* 服务器消息样式 - 不使用气泡 */
.server-message {
    padding: 5px 0;
    width: 100%;
    word-break: break-word;
}

.message-time {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    text-align: left;
    width: 100%;
}

/* 可拖动分隔线 */
.resizer {
    height: 6px;
    background-color: #e0e0e0;
    cursor: ns-resize;
    transition: background-color 0.2s;
    position: relative;
}

.resizer:hover {
    background-color: #4da6ff;
}

.resizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 4px;
    background-color: #fff;
    transform: translate(-50%, -50%);
    border-radius: 2px;
    box-shadow: 0 0 0 1px #ccc;
}

/* 输入容器样式 */
#input-container {
    display: flex;
    flex-direction: column;
    height: 240px;
    /* 默认高度 */
    min-height: 240px;
    /* 最小高度 */
    padding: 0px 15px;
    border-top: 1px solid #e0e0e0;
    box-sizing: border-box;
    /* 确保padding不会增加总高度 */
}

/* 输入消息容器 - 左右布局 */
#input-message-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    width: 100%;
}

/* 按钮容器 - 不伸缩 */
#input-message-container-buttons {
    flex: 0 0 auto !important;
}

/* 提示词区域固定高度 */
#prompts-info-container {
    height: auto;
    /* padding: 5px; */
    flex-shrink: 0;
    /* 不允许缩小 */
}

/* 消息输入框自适应剩余空间 */
#message-input {
    flex: 1;
    /* 占据剩余全部空间 */
    min-width: 0;
    /* 防止flex子项溢出 */
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 18px;
    max-height: none;
    /* 不限制最大高度 */
    font-size: 14px;
    outline: none;
    overflow-y: auto;
    background-color: #fff;
    word-break: break-word;
    box-sizing: border-box;
    /* 确保padding不会增加总宽度 */
    line-height: 1.5;
    white-space: pre-wrap;
}

#function-bar {
    display: flex;
    margin-bottom: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

#function-bar button {
    margin-right: 15px;
    padding: 6px 12px;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    outline: none;
    /* 移除默认轮廓线 */
}

#function-bar button:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

#function-bar button:focus,
#function-bar button:active {
    background-color: #e6f2ff;
    /* 浅蓝色背景 */
    border-color: #4da6ff;
    /* 蓝色边框 */
    color: #0066cc;
    /* 蓝色文字 */
    box-shadow: 0 0 0 2px rgba(77, 166, 255, 0.3);
    /* 蓝色阴影效果 */
}

/* 消息输入框样式已经在前面定义，这里不再重复 */

#message-input img {
    max-width: 200px !important;
    height: auto !important;
    display: inline-block;
    margin: 5px;
    vertical-align: middle;
}

/* 提示文本样式 */
.placeholder {
    color: #aaa;
    pointer-events: none;
    position: absolute;
    left: 12px;
    top: 12px;
}

/* 富文本样式增强 */
.message b,
.message strong {
    font-weight: bold;
}

.message i,
.message em {
    font-style: italic;
}

.message u,
.message ins {
    text-decoration: underline;
}

.message a {
    color: #0066cc;
    text-decoration: underline;
}

.message pre {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: monospace;
}

.message code {
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
}

/* Webhook开关容器样式 */
.switch-wrapper {
    padding: 10px;
}

.switch-card {
    background: linear-gradient(135deg, #d0d6f5 0%, #a6a5a7 100%);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    transition: all 0.3s ease;
}

.switch-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.switch-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.switch-title {
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.switch-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.switch-description {
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
}

/* 优化toggle-switch样式 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: .3s;
    border-radius: 28px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background-color: rgba(103, 150, 211, 0.6);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}
