.chat-panel-content {
    padding-top: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative; /* 确保子元素的 absolute 定位相对于此 */
    background-color: #3b3a3a; /* 深色背景 */
    color: #abb2bf; /* 默认文字颜色 */
    height: 100%; /* 确保完全填充父容器高度 */
    width: 100%; /* 确保完全填充父容器宽度 */
}

#chatDisplay {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    background-color: #333333; /* 聊天区背景色 */
    border-bottom: 1px solid #444444; /* 底部边框 */
    min-height: 0; /* 允许flex子元素收缩 */
}

/* 重置聊天按钮样式 */
.reset-chat-button {
    position: absolute;
    top: 70px; /* 距离顶部 */
    right: 10px; /* 距离右侧 */
    background-color: var(--panel-bg-color-alt); /* 改为深灰色系 */
    color: white;
    border: none;
    border-radius: 50%; /* 圆形按钮 */
    width: 25px; /* 宽度 */
    height: 25px; /* 高度 */
    font-size: 16px;
    line-height: 25px; /* 垂直居中 */
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 10; /* 确保在其他内容之上 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.reset-chat-button:hover {
    background-color: var(--hover-bg-color); /* 改为悬停背景色 */
}

#chatDisplay .message {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 15px;
    max-width: 70%;
}

#chatDisplay .message.user {
    background-color: #66bb6a; /* 绿色点缀 */
    color: #ffffff; /* 白色文字 */
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 3px;
}

#chatDisplay .message.ai {
    background-color: #555555; /* 灰色背景 */
    color: #ffffff; /* 白色文字 */
    align-self: flex-start;
    margin-right: auto;
    text-align: left;
    border-bottom-left-radius: 3px;
}

#chatDisplay .message.system-message {
    background-color: #444444; /* 深灰色背景 */
    border-color: #666666;
    color: #cccccc; /* 浅灰色文字 */
    text-align: center;
    width: 100%;
    max-width: none;
    font-weight: bold;
    border-radius: 5px;
}

.chat-input-group {
    display: flex;
    flex-direction: column; /* 使输入框和发送按钮垂直排列 */
    padding: 10px;
    border-top: 1px solid #444444; /* 边框颜色 */
    background-color: #333333; /* 背景颜色 */
    flex-shrink: 0; /* 防止输入区域被压缩 */
}

#chatInput {
    flex-grow: 1;
    width: 100%; /* 使输入框占满整个宽度 */
    padding: 10px;
    border: 1px solid #666666; /* 边框颜色 */
    border-radius: 5px;
    /* 移除 margin-right，因为现在输入框会占据整行 */
    background-color: #444444; /* 输入框背景 */
    color: #ffffff; /* 输入文字颜色 */
    resize: vertical; /* 允许垂直拖动调整大小 */
    min-height: 80px; /* 确保至少四行的高度 */
    line-height: 20px; /* 设置行高 */
    box-sizing: border-box; /* 确保内边距和边框包含在元素的总宽度和高度内 */
    margin-bottom: 10px; /* 在输入框和发送按钮之间添加间距 */
}

#sendMessage {
    background-color: #4CAF50; /* 绿色点缀 */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    width: 100%; /* 确保与停止按钮宽度一致 */
    display: flex;
    align-items: center;
    justify-content: center;
}

#sendMessage:hover {
    background-color: #66bb6a; /* 绿色点缀 hover */
}

/* Tool Suggestions */
#batch-tool-suggestions-container {
    padding: 15px;
    background-color: var(--panel-bg-color); /* 改为深灰色系 */
    border-top: 1px solid var(--border-color); /* 改为深灰色边框 */
    text-align: center;
}

.tool-cards-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.tool-suggestion {
    background-color: var(--panel-bg-color); /* 改为深灰色系 */
    border: 1px solid var(--border-color); /* 改为深灰色边框 */
    border-radius: 8px;
    padding: 15px;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: left;
    display: flex;
    flex-direction: column;
}

.tool-suggestion p {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.tool-params-details {
    margin-bottom: 15px;
    border: 1px dashed #cccccc;
    padding: 5px;
    border-radius: 5px;
    cursor: pointer;
    background-color: var(--panel-bg-color-alt); /* 改为深灰色系 */
}

.tool-params-summary {
    font-weight: bold;
    color: var(--text-color-primary); /* 改为文本主色 */
    list-style: none; /* 移除默认的箭头 */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tool-params-summary::-webkit-details-marker {
    display: none; /* 移除Chrome/Safari的默认箭头 */
}

/* 自定义展开/折叠图标 */
.tool-params-summary .collapse-icon {
    display: inline-block;
    width: 0; 
    height: 0; 
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--primary-color); /* 改为绿色 */
    transition: transform 0.2s ease-in-out;
}

.tool-params-details[open] .collapse-icon {
    transform: rotate(180deg);
}

.tool-params-details pre {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 0.85em;
    background-color: var(--panel-bg-color-alt); /* 改为深灰色系 */
    padding: 10px;
    border-radius: 3px;
    overflow-x: auto; /* 允许水平滚动 */
}

.tool-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

.tool-actions button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.tool-actions .approve-button {
    background-color: var(--primary-color); /* 改为主题绿色 */
    color: white;
}

.tool-actions .approve-button:hover:not(:disabled) {
    background-color: var(--primary-color-dark); /* 改为主题深绿色 */
}

.tool-actions .reject-button {
    background-color: var(--panel-bg-color); /* 改为深灰色系 */
    color: white;
}

.tool-actions .reject-button:hover:not(:disabled) {
    background-color: var(--hover-bg-color); /* 改为悬停背景色 */
}

.tool-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tool-status-text {
    font-size: 0.8em;
    color: var(--text-color-secondary);
    text-align: center;
}

/* Tool status colors */
.tool-suggestion.executed {
    border-color: var(--primary-color); /* 改为主题绿色 */
    background-color: rgba(0, 173, 98, 0.1); /* 绿色点缀，浅色透明 */
}

.tool-suggestion.failed {
    border-color: var(--border-color); /* 改为深灰色边框 */
    background-color: var(--panel-bg-color-alt); /* 改为深灰色系 */
}

.tool-suggestion.rejected {
    border-color: var(--border-color); /* 改为深灰色边框 */
    background-color: var(--panel-bg-color-alt); /* 改为深灰色系 */
}

.batch-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.batch-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.batch-actions .approve-all-button {
    background-color: var(--primary-color); /* 改为主题绿色 */
    color: white;
}

.batch-actions .approve-all-button:hover {
    background-color: var(--primary-color-dark); /* 改为主题深绿色 */
}

.batch-actions .reject-all-button {
    background-color: var(--panel-bg-color); /* 改为深灰色系 */
    color: white;
}

.batch-actions .reject-all-button:hover {
    background-color: var(--hover-bg-color); /* 改为悬停背景色 */
}

/* AI Question Card */
.ai.ask-question {
    background-color: var(--panel-bg-color); /* 改为深灰色系 */
    border: 1px solid var(--border-color); /* 改为深灰色边框 */
    padding: 15px;
    margin: 10px;
    border-radius: 8px;
    text-align: left;
}

.ai.ask-question p {
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--text-color-primary); /* 改为文本主色 */
}

.question-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.question-actions button {
    padding: 8px 15px;
    border: 1px solid var(--primary-color); /* 改为主题绿色 */
    background-color: var(--primary-color); /* 改为主题绿色 */
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.question-actions button:hover {
    background-color: var(--primary-color-dark); /* 改为主题深绿色 */
    border-color: var(--primary-color-dark); /* 改为主题深绿色 */
}

.question-actions input {
    flex-grow: 1;
    padding: 8px 10px;
    border: 1px solid var(--border-color); /* 改为深灰色边框 */
    border-radius: 5px;
}

/* DeepSeek History Panel styles */
.chat-panel-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative; /* For positioning absolute children like history panel */
}

/* 设置模态框样式 */
.settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7); /* 半透明黑色背景 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000; /* 确保在其他内容之上 */
}

.settings-modal-content {
    background-color: #333333; /* 模态框背景色，与聊天区背景一致 */
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 500px;
    color: #ffffff; /* 模态框文字颜色 */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.settings-modal-content h2 {
    color: var(--primary-color); /* 标题使用绿色 */
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: bold;
    color: #ffffff; /* 标签文字颜色为白色 */
}

.setting-item input[type="text"],
.setting-item select {
    padding: 10px;
    border: 1px solid #555555; /* 边框颜色 */
    border-radius: 5px;
    background-color: #444444; /* 输入框/选择框背景色 */
    color: #ffffff; /* 输入框/选择框文字颜色 */
    font-size: 1em;
    width: 100%;
    box-sizing: border-box; /* 确保内边距和边框包含在元素的总宽度内 */
}

/* 针对选择框下拉箭头的样式调整，如果需要的话 */
.setting-item select {
    -webkit-appearance: none; /* 移除默认的下拉箭头 */
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M5%206l5%205%205-5%202%202-7%207-7-7z%22%2F%3E%3C%2Fsvg%3E'); /* 自定义白色箭头 */
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px; /* 为箭头留出空间 */
}

.setting-item select option {
    background-color: #444444; /* 下拉选项背景色 */
    color: #ffffff; /* 下拉选项文字颜色 */
}

.setting-item input[type="text"]::placeholder {
    color: #aaaaaa; /* 占位符颜色 */
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.modal-actions .save-button {
    background-color: var(--primary-color); /* 保存按钮使用绿色 */
    color: white;
}

.modal-actions .save-button:hover {
    background-color: var(--primary-color-dark); /* 悬停时深绿色 */
}

.modal-actions .cancel-button {
    background-color: #555555; /* 取消按钮使用深灰色 */
    color: white;
}

.modal-actions .cancel-button:hover {
    background-color: #666666; /* 悬停时浅灰色 */
}

.chat-header-actions {
    display: flex;
    justify-content: flex-start; /* 将按钮靠左对齐 */
    padding: 10px;
    background-color: #222222; /* 深色背景 */
    border-bottom: 1px solid #444444; /* 底部边框 */
}

.settings-button { /* 新增设置按钮样式 */
    background-color: #3a3f4b;
    color: #abb2bf;
    border: 1px solid #5c6370;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-right: 10px; /* 与其他按钮之间留有间距 */
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.settings-button:hover {
    background-color: #4a4f5b;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.history-button,
.clear-history-button {
    background-color: #3a3f4b; /* 与刷新按钮背景色一致 */
    color: #abb2bf; /* 与刷新按钮文字颜色一致 */
    border: 1px solid #5c6370; /* 与刷新按钮边框一致 */
    padding: 5px 10px; /* 与刷新按钮内边距一致 */
    border-radius: 4px; /* 与刷新按钮圆角一致 */
    cursor: pointer;
    font-size: 0.9em; /* 调整字体大小以适应图标 */
    display: flex; /* 使图标居中 */
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-left: 10px; /* 按钮之间留有间距 */
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.history-button:hover,
.clear-history-button:hover {
    background-color: #4a4f5b; /* 与刷新按钮悬停背景色一致 */
    border-color: var(--primary-color); /* 悬停时边框变为绿色 */
    color: var(--primary-color); /* 悬停时文字变为绿色 */
}

/* DeepSeek Reasoning Content Styles */
.reasoning-details {
    background-color: #4a4a4a; /* 比主消息浅一点的背景色 */
    border: 1px solid #666666;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.reasoning-summary {
    font-weight: bold;
    color: #ffffff;
    cursor: pointer;
    list-style: none; /* 移除默认的箭头 */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.reasoning-summary::-webkit-details-marker {
    display: none; /* 移除Chrome/Safari的默认箭头 */
}

/* 自定义展开/折叠图标 */
.reasoning-summary::after {
    content: '▼'; /* 向下的三角形 */
    font-size: 0.8em;
    margin-left: 5px;
    transition: transform 0.2s ease-in-out;
}

.reasoning-details[open] .reasoning-summary::after {
    content: '▲'; /* 向上的三角形 */
    transform: rotate(180deg); /* 旋转图标 */
}

.reasoning-content {
    margin-top: 10px;
    padding: 10px;
    background-color: #3e3e3e; /* 比 details 稍深的背景色 */
    border-radius: 5px;
    white-space: pre-wrap; /* 保留空白符和换行 */
    word-break: break-all; /* 长单词自动换行 */
    font-size: 0.9em;
    color: #cccccc;
    overflow-x: auto; /* 允许水平滚动 */
}
/* Switch toggle styles */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
  -webkit-transform: translateX(20px);
  -ms-transform: translateX(20px);
  transform: translateX(20px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}
/* Tool Action Bar Styles */
/* Tool Action Bar Styles */
.tool-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px; /* 减小垂直内边距以降低高度 */
  background-color: #2c2c2e; /* 改为深灰色背景 */
  border-top: 1px solid #444;
  border-bottom: 1px solid #444;
  margin-bottom: 0;
}

.tool-action-bar span {
  font-weight: bold;
  color: #abb2bf; /* 改为浅灰色文字 */
  font-size: 0.9em;
}

.tool-action-buttons {
    display: flex;
    gap: 10px;
}

.tool-action-buttons .approve-all-button,
.tool-action-buttons .reject-all-button {
  padding: 4px 10px; /* 减小按钮内边距 */
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s ease;
}

.tool-action-buttons .approve-all-button {
  background-color: #357abd; /* 批准按钮改为蓝色 */
  color: white;
}

.tool-action-buttons .approve-all-button:hover {
  background-color: #4a90e2; /* 悬停时颜色变亮 */
}

.tool-action-buttons .reject-all-button {
  background-color: #555555; /* 拒绝按钮改为中性灰色 */
  color: white;
}

.tool-action-buttons .reject-all-button:hover {
  background-color: #666666;
}

.tool-action-buttons button:disabled {
  background-color: #444;
  color: #888;
  cursor: not-allowed;
}

/* 新增：为工具调用消息设置特定样式 */
.message-content.is-tool-call {
    color: #28a745; /* A nice green color for tool calls */
    white-space: pre-wrap; /* Ensures formatted JSON is displayed correctly */
    background-color: #333; /* Match AI message background */
    font-family: 'Courier New', Courier, monospace; /* Use a monospace font for code-like text */
}
.message {
  position: relative;
}

.checkpoint-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  color: #888;
  font-size: 0.9em;
}

.checkpoint-icon:hover {
  color: #333;
}
.checkpoint-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: #f0f4f8;
  border-radius: 8px;
  margin: 5px 0;
}

.checkpoint-restore-button {
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s;
}

.checkpoint-restore-button:hover {
  background-color: #357abd;
}

.checkpoint-id-display {
  font-family: monospace;
  font-size: 0.8em;
  color: #777;
}
/* AI Question Card Styles */
.ai-question-card {
  background-color: #2c2c2e;
  border-radius: 8px;
  padding: 16px;
  margin: 10px 0;
  border: 1px solid #444;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-question-text {
  color: #f0f0f0;
  font-size: 1em;
  margin: 0;
  line-height: 1.5;
}

.ai-question-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-question-option-button {
  background-color: #3a3a3c;
  color: #f0f0f0;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: normal; /* Allow text to wrap */
  word-wrap: break-word; /* Break long words */
  width: 100%;
  font-size: 0.95em;
}

.ai-question-option-button:hover {
  background-color: #4a4a4c;
}

/* Styles for .ai-question-input-area, .ai-question-input, and .ai-question-send-button have been removed as this functionality is now handled by the main chat input. */

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

.fa-spin {
  animation: fa-spin 1s infinite linear;
}
.message .message-actions {
  opacity: 0;
  transition: opacity 0.3s, height 0.3s;
  display: flex;
  gap: 5px;
  justify-content: flex-end; /* Align buttons to the right */
  padding-top: 5px; /* Add some space between content and buttons */
  height: 0; /* Collapse by default */
  overflow: hidden; /* Hide the buttons when collapsed */
}

.message:hover .message-actions {
  opacity: 1;
  height: auto; /* Expand to fit content on hover */
  padding-bottom: 5px; /* Add some space below the buttons */
}

.message-actions button {
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 5px;
}

.message-actions button:hover {
  background: #e0e0e0;
}

.message-content textarea {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px;
}

/* 存档点消息样式 */
.checkpoint-message {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  margin: 10px 0;
  width: 100%;
}

.checkpoint-restore-button {
  background-color: #f0f0f0; /* 浅灰色背景 */
  color: #555; /* 深灰色文字 */
  border: 1px solid #ccc; /* 灰色边框 */
  padding: 8px 15px;
  border-radius: 15px; /* 圆角 */
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px; /* 图标和文字的间距 */
  font-size: 13px;
  transition: background-color 0.3s, color 0.3s;
}

.checkpoint-restore-button:hover {
  background-color: #e0e0e0; /* 悬停时颜色变深 */
  color: #333;
}

.checkpoint-id-display {
  margin-left: 10px;
  font-size: 11px;
  color: #999;
  font-family: monospace;
}
/* Tool Call Collapsible Section */
.tool-call-details {
    background-color: #4a4a4a; /* 与 "思考过程" 颜色一致 */
    border: 1px solid #666666;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.tool-call-summary {
    font-weight: bold;
    color: #ffffff;
    cursor: pointer;
    list-style: none; /* 移除默认的箭头 */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tool-call-summary::-webkit-details-marker {
    display: none; /* 移除 Chrome/Safari 的默认箭头 */
}

/* 自定义展开/折叠图标 */
.tool-call-summary::after {
    content: '▼'; /* 默认是向下的三角形 */
    font-size: 0.8em;
    margin-left: 5px;
    transition: transform 0.2s ease-in-out;
}

.tool-call-details[open] > .tool-call-summary::after {
    transform: rotate(180deg); /* 展开时旋转图标 */
}

.tool-calls-container {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #666666;
    display: flex;
    flex-direction: column;
    gap: 10px; /* 卡片之间的间距 */
}
/* AI Typing Spinner Style */
.ai-typing-spinner {
    margin-right: 8px; /* 在图标和文本之间添加一些间距 */
    vertical-align: middle; /* 确保图标和文本垂直对齐 */
}

.message-content {
    display: flex;
    align-items: flex-start; /* 顶部对齐，以防文本换行 */
    word-wrap: break-word; /* 确保长单词可以换行 */
    overflow-wrap: break-word; /* 现代浏览器的换行支持 */
    white-space: pre-wrap; /* 保留空格和换行，但允许自动换行 */
    max-width: 100%; /* 确保内容不会超出容器 */
}

/* 确保消息气泡内的文本正确换行 */
.message-bubble .message-content span {
    word-break: break-word; /* 在任意字符处断行 */
    overflow: hidden; /* 隐藏溢出内容 */
    display: inline-block; /* 确保换行属性生效 */
    max-width: 100%; /* 限制最大宽度 */
}
/* Tool Call Card specific styles */
.tool-call-card {
    background-color: #3e3e3e;
    border: 1px solid #555555;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px; /* 与其他卡片保持间距 */
}

.tool-call-card .tool-call-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: #e0e0e0;
    margin-bottom: 8px;
}

.tool-call-card .tool-icon {
    color: #66b2ff; /* A light blue to signify 'tool' */
}

.tool-call-card .historical-badge {
    background-color: #555555;
    color: #cccccc;
    font-size: 0.7em;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: auto; /* Push badge to the right */
}

.tool-call-card .tool-args {
    background-color: #2e2e2e;
    padding: 8px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    color: #d0d0d0;
    /* Core fix for the wrapping issue */
    white-space: pre-wrap;   /* Allows text to wrap */
    word-break: break-all;     /* Breaks long words or strings */
    overflow-x: auto;        /* Adds horizontal scroll for very long unbreakable lines if needed */
}


/* 新增：模式选择器下拉菜单样式 */
.mode-selector-dropdown {
  position: relative;
  margin-bottom: 8px;
}

.mode-dropdown-toggle {
  padding: 8px 16px;
  border: 1px solid #555;
  background-color: #3a3a3e;
  color: #ccc;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mode-dropdown-toggle:hover {
  background-color: #4a4a4e;
  border-color: #777;
}

.mode-dropdown-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background-color: #3a3a3e;
  border: 1px solid #555;
  border-radius: 6px;
  margin-bottom: 4px;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.mode-dropdown-menu button {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: none;
  border: none;
  color: #ccc;
  text-align: left;
  cursor: pointer;
  font-weight: normal;
}

.mode-dropdown-menu button:hover {
  background-color: #4a4a4e;
}

.mode-dropdown-menu button.active {
  background-color: #357abd;
  color: white;
}

.dropdown-divider {
  height: 1px;
  background-color: #555;
  margin: 4px 0;
}

.prompt-manager-button {
  color: #4a90e2 !important;
  font-weight: bold !important;
}

.prompt-manager-button:hover {
  background-color: #2a4e7a !important;
}

/* 功能切换按钮样式 */
.feature-toggle-button {
  background-color: #3a3f4b;
  color: #abb2bf;
  border: 1px solid #5c6370;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-right: 10px;
  transition: all 0.2s ease;
}

.feature-toggle-button.active {
  background-color: #4CAF50;
  border-color: #4CAF50;
  color: white;
}

.feature-toggle-button.inactive {
  background-color: #f44336;
  border-color: #f44336;
  color: white;
}

.feature-toggle-button:hover {
  background-color: #4a4f5b;
  border-color: var(--primary-color);
  color: var(--primary-color);
}


/* 正文生成选项按钮样式 */
.writing-options {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.writing-options button {
  padding: 8px 16px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;

/* 模型选择器样式 */
.model-selector-wrapper {
  margin-bottom: 8px;
}

.model-selector-container {
  position: relative;
  width: 100%;
}

.model-selector-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: #3a3a3e;
  border: 1px solid #555;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: #ccc;
}

.model-selector-bar:hover {
  background-color: #4a4a4e;
  border-color: #777;
}

.selected-model-name {
  font-weight: 500;
}

.expand-icon {
  font-size: 12px;
  color: #888;
}

.model-selector-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background-color: #3a3a3e;
  border: 1px solid #555;
  border-radius: 6px;
  margin-bottom: 4px;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  max-height: 500px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.model-selector-dropdown .embedding-model-selector-panel {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.model-selector-dropdown .embedding-model-list-container {
  flex: 1;
  overflow-y: auto;
}

.model-search-container {
  padding: 8px;
  border-bottom: 1px solid #555;
}

.model-search-input {
  width: 100%;
  padding: 6px 8px;
  background-color: #2a2a2e;
  border: 1px solid #444;
  border-radius: 4px;
  color: #ccc;
  font-size: 13px;
}

.model-search-input:focus {
  outline: none;
  border-color: #357abd;
}

.model-list {
  max-height: 200px;
  overflow-y: auto;
}

.model-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #444;
  transition: background-color 0.2s ease;
}

.model-item:hover {
  background-color: #4a4a4e;
}

.model-item.selected {
  background-color: #357abd;
  color: white;
}

.model-name {
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 2px;
}

.model-provider {
  font-size: 11px;
  color: #888;
}

.model-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
  border-top: 1px solid #555;
  gap: 20px;
}

.model-pagination .pagination-btn {
  padding: 0;
  background-color: transparent !important;
  border: none !important;
  color: #cccccc;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  width: 24px;
  height: 24px;
}

.model-pagination .pagination-btn:hover:not(:disabled) {
  color: #fff;
  background-color: transparent !important;
}

.model-pagination .pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background-color: transparent !important;
}

/* 确保FontAwesome图标没有背景色 */
.model-pagination .pagination-btn svg {
  background-color: transparent !important;
  border: none !important;
}

.page-info {
  font-size: 12px;
  color: #888;
  min-width: 40px;
  text-align: center;
}

.search-results-info {
  padding: 4px 8px;
  font-size: 11px;
  color: #888;
  text-align: center;
  border-top: 1px solid #555;
}
  transition: background-color 0.2s;
}

.writing-options button:hover {
  background: #218838;
}

.writing-options button:first-child {
  background: #dc3545;
}

.writing-options button:first-child:hover {
  background: #c82333;
}

/* 重新检测按钮样式 */
.redetect-button {
  padding: 10px 16px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
  margin-top: 5px;
}

.redetect-button:hover {
  background-color: #357abd;
}

.redetect-button:active {
  background-color: #2a4e7a;
}

/* 头部模型选择器样式 */
.model-selector-header-wrapper {
  margin-left: 10px;
  flex: 1;
  max-width: 200px;
  position: relative; /* 为绝对定位的子元素提供参考 */
  z-index: 1001; /* 确保在其他内容之上 */
}

.model-selector-header-wrapper .model-selector-container {
  width: 100%;
  position: relative; /* 为下拉菜单提供定位上下文 */
}

.model-selector-header-wrapper .model-selector-bar {
  padding: 5px 8px;
  font-size: 12px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative; /* 确保下拉菜单相对于此定位 */
  z-index: 1; /* 确保在正常层级 */
}

/* 模型选择栏中的搜索输入框样式 */
.model-search-input-bar {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #ccc;
  font-size: 11px;
  padding: 0;
  margin: 0;
  font-family: inherit;
}

.model-search-input-bar::placeholder {
  color: #888;
  font-style: italic;
}

.model-search-input-bar:focus {
  outline: none;
  border: none;
}

.model-selector-header-wrapper .selected-model-name {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.model-selector-header-wrapper .model-selector-dropdown {
  position: absolute; /* 使用绝对定位，相对于容器 */
  top: 100%; /* 从容器底部开始 */
  left: 0;
  width: 180px; /* 增加宽度到180px */
  max-height: 350px; /* 增加最大高度 */
  margin-top: 4px; /* 与容器保持一点间距 */
  z-index: 2000; /* 更高的z-index确保在最上层 */
  overflow: visible; /* 允许内容溢出 */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); /* 添加阴影增强视觉效果 */
}

/* 确保聊天头部容器不会限制下拉菜单 */
.chat-header-actions {
  position: relative; /* 为绝对定位的子元素提供参考 */
  z-index: 1000; /* 确保头部按钮在正常层级 */
  overflow: visible; /* 允许子元素溢出 */
  min-height: 50px; /* 确保有足够的高度 */
}

/* 确保聊天面板内容不会限制下拉菜单 */
.chat-panel-content {
  overflow: visible; /* 允许内容溢出 */
  position: relative; /* 为绝对定位提供参考 */
}

/* 知识库按钮样式 */
.knowledgebase-button {
  background-color: #3a3f4b; /* 与其他按钮一致的背景色 */
  color: #abb2bf; /* 与其他按钮一致的文字颜色 */
  border: 1px solid #5c6370; /* 与其他按钮一致的边框 */
  padding: 5px 10px; /* 与其他按钮一致的内边距 */
  border-radius: 4px; /* 与其他按钮一致的圆角 */
  cursor: pointer;
  font-size: 0.9em; /* 调整字体大小以适应图标 */
  display: flex; /* 使图标居中 */
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-left: 10px; /* 按钮之间留有间距 */
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.knowledgebase-button:hover {
  background-color: #4a4f5b; /* 与其他按钮一致的悬停背景色 */
  border-color: var(--primary-color); /* 悬停时边框变为绿色 */
  color: var(--primary-color); /* 悬停时文字变为绿色 */
}

/* 模型选择按钮样式 */
.model-selector-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  background-color: #3a3a3e;
  border: 1px solid #555;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #ccc;
  transition: all 0.2s ease;
  width: 100%;
  min-width: 120px;
}

/* 停止按钮样式 */
.stop-button {
    background-color: #f44336; /* 红色背景 */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    width: 100%; /* 确保与发送按钮宽度一致 */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.stop-button:hover {
    background-color: #d32f2f; /* 悬停时深红色 */
}

.stop-button:active {
    background-color: #b71c1c; /* 点击时更深红色 */
}

.model-selector-button:hover {
  background-color: #4a4a4e;
  border-color: #777;
}

.model-selector-button .selected-model-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.model-selector-button .expand-icon {
  font-size: 10px;
  color: #888;
  margin-left: 5px;
}

/* 知识库面板容器样式 */
.knowledge-base-panel {
  position: absolute;
  top: 60px; /* 从聊天头部下方开始 */
  left: 0px;
  right: 0px;
  bottom: 0px;
  background-color: #333333; /* 与聊天区背景一致 */
  border: 1px solid #444444;
  border-radius: 8px;
  z-index: 100; /* 确保在其他内容之上 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* 模型选择面板容器样式 */
.model-selector-panel {
  position: absolute;
  top: 60px; /* 从聊天头部下方开始 */
  left: 0px;
  right: 0px;
  bottom: 0px;
  background-color: #333333; /* 与聊天区背景一致 */
  border: 1px solid #444444;
  border-radius: 8px;
  z-index: 101; /* 比知识库面板更高，确保在最上层 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* 知识库面板头部样式 */
.kb-header {
  padding: 15px;
  background-color: #222222; /* 深色背景 */
  border-bottom: 1px solid #444444;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kb-header h2 {
  color: #ffffff;
  margin: 0;
  font-size: 1.2em;
}

.kb-actions {
  display: flex;
  gap: 10px;
}

.kb-actions button {
  padding: 8px 16px;
  border: 1px solid #555555;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.2s ease;
}

.kb-actions .add-btn {
  background-color: #4CAF50; /* 绿色添加按钮 */
  color: white;
}

.kb-actions .add-btn:hover {
  background-color: #66bb6a;
}

.kb-actions .refresh-btn {
  background-color: #3a3f4b; /* 灰色刷新按钮 */
  color: #abb2bf;
}

.kb-actions .refresh-btn:hover {
  background-color: #4a4f5b;
}

.kb-actions .close-btn {
  background-color: #555555; /* 深灰色关闭按钮 */
  color: white;
}

.kb-actions .close-btn:hover {
  background-color: #666666;
}


.file-details {
  display: flex;
  gap: 15px;
  color: #aaaaaa;
  font-size: 0.85em;
}

.file-actions .delete-btn {
  background-color: #f44336; /* 红色删除按钮 */
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
}

.file-actions .delete-btn:hover {
  background-color: #e53935;
}

.file-actions .delete-btn:disabled {
  background-color: #666666;
  cursor: not-allowed;
}

/* 加载和空状态样式 */
.loading-state, .empty-state {
  text-align: center;
  color: #aaaaaa;
  padding: 40px;
  font-style: italic;
}

.error-message {
  background-color: #f44336;
  color: white;
  padding: 10px;
  margin: 15px;
  border-radius: 4px;
  text-align: center;
}

.error-message button {
  background-color: white;
  color: #f44336;
  border: none;
  padding: 5px 10px;
  border-radius: 3px;
  margin-left: 10px;
  cursor: pointer;
}
