/* 基础全局设置 */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
  font-family: Arial, sans-serif;
}
body.dragging,
.layout-wrapper.dragging {
  user-select: none;
}

/* 页面整体布局容器 */
.layout-wrapper {
  display: flex;
  height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

/* 布局类型 */
.layout-wrapper.with-sidebar {
  flex-direction: row;
}

.layout-wrapper.no-sidebar {
  flex-direction: row;
}

/* 侧边栏样式 */
.sidebar {
   position: relative; /* 必须为 relative 以定位 resizer */
  width: 300px;
   max-width: 50vw; /* ✅ 加上这行：最多占屏幕一半 */
   min-width: 220px;
  background-color: #ffffff;
  border-right: 1px solid #ccc;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  overflow: hidden;
  z-index: 100;
}
.sidebar-resizer {
  width: 5px;
  cursor: ew-resize;
  background-color: transparent; /* 可调为灰色更明显 */
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
}

/* .sidebar.collapsed {
  width: 0;
  pointer-events: none;
} */
.sidebar.collapsed {
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

/* 移动端样式：侧边栏作为抽屉浮动 */
@media (max-width: 767px) {
  .layout-wrapper {
    position: relative;
  }

  .sidebar {
    position: absolute;
    top: 0;
    left: -220px;
    height: 100%;
    width: 220px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    background-color: #fff;
    transition: left 0.3s ease;
  }

  .sidebar.mobile-open {
    left: 0 !important;
    display: flex;
  }

  .sidebar.mobile-collapsed {
    left: -220px !important;
    display: flex;
  }

  .sidebar.collapsed {
    display: none;
  }
}

/* 顶部栏 */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
}

/* 折叠按钮 */
.sidebar-toggle-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  margin-right: 10px;
  padding: 4px;
  z-index: 1100;
}

/* 顶部左侧组合 */
.top-left-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 模型选择器 */
.model-selector select {
  font-size: 14px;
  padding: 4px 8px;
  background-color: transparent;
  border: none;
  outline: none;
}

/* 侧边栏头部 */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background-color: #ffffff;
  font-weight: bold;
}

/* 侧边栏列表 */
.record-list {
  list-style: none;
  padding: 0 10px;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.record-list li {
  padding: 8px;
  border-bottom: 1px solid #ffffff;
  cursor: pointer;
}

.record-list li:hover {
  background-color: #ffffff;
}

/* 主体内容区域 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* 主体包裹容器 */
.container {
  flex: 1;
  width: 100%;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  background-color: white;
  margin-top: 60px;
}

/* 标题 */
.title {
  text-align: center;
  padding: 10px;
  font-size: 24px;
  font-weight: bold;
  background-color: #ececec;
  border-bottom: 1px solid #ddd;
}

/* 聊天框 */
#chat-box, .chat-box {
  flex: 1;
  min-width: 0;
  padding: 10px;
  background-color: #fff;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  padding-bottom: 100px;
}

/* 消息样式 */
.message-wrapper {
  margin: 20px 0;
  display: flex;
  align-items: flex-start;
}

.message {
  max-width: 100%;
  word-wrap: break-word;
  word-break: break-word;
}

.message img {
  max-width: 100%;
  height: auto;
  margin-bottom: 10px;
}

.message.user {
  align-items: flex-end;
}

.message.bot {
  align-items: flex-start;
}
.message.user p {
  margin: 8px 0;
  line-height: 1.6;
  color: #333;
}
.message.bot p {
  margin: 8px 0;
  line-height: 1.6;
  color: #333;
}
.message.bot h1, .message.bot h2, .message.bot h3,
.message.bot h4, .message.bot h5, .message.bot h6 {
  margin: 10px 0;
  font-weight: bold;
}
.message.bot h1 { font-size: 1.5em; color: #0056b3; }
.message.bot h2 { font-size: 1.4em; color: #0066cc; }
.message.bot h3 { font-size: 1.3em; color: #007BFF; }
.message.bot h4 { font-size: 1.2em; color: #3399ff; }
.message.bot h5 { font-size: 1.1em; color: #66b3ff; }
.message.bot h6 { font-size: 1em;   color: #99ccff; }

.message.bot strong {
  font-weight: bold;
  color: #000;
}
.message.bot hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 12px 0;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin: 0 10px;
}

.message-wrapper.user {
  justify-content: flex-end;
}

.message-wrapper.user .avatar {
  order: 2;
  margin-left: 10px;
  margin-right: 0;
}

.message-wrapper.bot {
  justify-content: flex-start;
}

.message-wrapper.bot .avatar {
  order: -1;
  margin-right: 10px;
  margin-left: 0;
}

/* 输入框区域 */
.input-box {
  display: flex;
  flex-direction: column;
  position: sticky;
  bottom: 0;
  background-color: white;
  padding: 10px;
  /* border-top: 1px solid #ddd; */
}

.input-box input[type="text"],
.input-box input[type="file"],
.input-box button {
  font-size: 16px;
}
.input-box input[type="text"]:focus {
  border-color: #409EFF; /* 聚焦时变成蓝色 */
  outline: none;         /* 去掉默认蓝边 */
  box-shadow: 0 0 5px rgba(64, 158, 255, 0.5); /* 添加阴影 */
}
.input-box input[type="text"] {
  flex: 1;
  padding: 24px 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.input-box input[type="file"] {
  display: none;
}

.input-box .error-message {
  color: red;
  font-size: 16px;
  margin-bottom: 5px;
  display: none;
}

.input-box button {
  padding: 10px;
  border: none;
  background-color: transparent;
  cursor: pointer;
  width: 48px;
  height: 48px;
}

.input-box button img,
.upload-button img {
  max-width: 100%;
  max-height: 100%;
}

/* 上传按钮 */
.upload-button {
  background-color: transparent;
  border: none;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-button-icon {
  width: 24px;
  height: 24px;
}

.upload-button img.uploaded {
  width: 96px;
  height: 96px;
}

/* 默认提示语 */
.default-messages {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 10px 0;
}

.default-message {
  background-color: #ececec;
  padding: 10px;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  flex: 0 0 calc(50% - 10px);
  margin: 0 5px 10px;
  box-sizing: border-box;
}

.default-message:hover {
  background-color: #d0d0d0;
}

/* 移动端适配 */
@media (max-width: 600px) {
  .message {
    max-width: 100%;
  }

  .default-messages {
    flex-direction: column;
    align-items: center;
  }

  .default-message {
    width: 90%;
    margin-bottom: 10px;
  }

  .input-box {
    padding-bottom: 25px;
  }

  input, textarea {
    font-size: 16px;
  }
}

/* 代码块 */
.code-container {
  position: relative;
  margin: 10px 0;
}

.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background-color: #eee;
  border: none;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.copy-btn:hover {
  background-color: #ddd;
}

pre {
  background: #f4f4f4;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 14px;
  max-width: 100%;
}
.sidebar-search {
  padding: 12px 10px;
  background-color: #ffffff;
  /* border-bottom: 1px solid #ddd; */
}

.search-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

#search-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s;
}

#search-input:focus {
  border-color: #007bff;
}

#search-button {
  background-color: #ffffff;
  border: 0px solid #ccc;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

#search-button:hover {
  background-color: #f0f0f0;
}

.search-icon {
  width: 16px;
  height: 16px;
}
.add-button {
  padding: 6px 10px;
  font-size: 14px;
  border: none;
  background-color: #007bff;
  color: white;
  border-radius: 6px;
  cursor: pointer;
}

.add-button:hover {
  background-color: #0056b3;
}

.dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3); /* 背景半透明 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.dialog {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}


.dialog h3 {
  margin-top: 0;
}

.dialog label {
  display: block;
  margin: 10px 0 4px;
}

.dialog input {
  width: 100%;
  padding: 6px;
  box-sizing: border-box;
}

.dialog-buttons {
  margin-top: 15px;
  text-align: right;
}

.primary-button, .cancel-button, .small-button {
  padding: 6px 10px;
  margin-left: 8px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

.primary-button {
  background-color: #28a745;
  color: white;
}

.cancel-button {
  background-color: #ccc;
}

.small-button {
  margin-top: 8px;
  background-color: #e0e0e0;
}
.user-info {
  position: relative;
  cursor: pointer;
}
.user-dropdown-wrapper {
    position: relative;
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 5px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 1000;
    min-width: 120px;
}

.dropdown-item {
    padding: 8px 16px;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #f0f0f0;
}
.record-list li.empty {
  color: #aaa;
  text-align: center;
  padding: 20px;
  font-style: italic;
}
/* 选中项高亮 */
.record-list li.selected {
  background-color: #d0eaff;
  cursor: pointer;
}

/* 按钮间距调整 */
.toggle-button {
  margin-left: 10px;
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
}
.pagination-controls {
  margin-top: 10px;
  padding: 10px;
  text-align: center;
  font-size: 14px;
}

.pagination-controls button {
  margin: 0 5px;
  padding: 4px 10px;
}

.pagination-controls input {
  margin-left: 10px;
  padding: 4px;
}
.clear-search {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #888;
  margin-left: -25px;
  z-index: 2;
}
.btn {
  padding: 2px 8px;
  border-radius: 3px;
  background-color: #6ea8fe;  /* 淡蓝色 */
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

.btn:hover {
  background-color: #5b9bfd;  /* hover 更深一点 */
}

.btn-secondary {
  background-color: #b0b8c2;  /* 淡灰蓝 */
  color: #fff;
}

.btn-secondary:hover {
  background-color: #9fa8b3;
}

.btn-success {
  background-color: #7bd8b0; /* 淡绿色 */
  color: white;
}

.btn-success:hover {
  background-color: #5acb9e;
}

.btn-danger {
  background-color: #f5a3a3; /* 淡红 */
  color: white;
}

.btn-danger:hover {
  background-color: #ec8888;
}
.btn-outline {
  padding: 2px 8px;
  border-radius: 3px;
  background-color: transparent;
  border: 1px solid #6ea8fe; /* 默认边框蓝 */
  color: #181818;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.btn-outline:hover {
  background-color: #e6f0ff;
}

.btn-outline-secondary {
  border-color: #b0b8c2;
  color: #6c757d;
}

.btn-outline-secondary:hover {
  background-color: #f1f1f1;
}

.btn-outline-success {
  border-color: #7bd8b0;
  color: #45b58c;
}

.btn-outline-success:hover {
  background-color: #e4f9f0;
}

.btn-outline-danger {
  border-color: #f5a3a3;
  color: #dd5b5b;
}

.btn-outline-danger:hover {
  background-color: #fff1f1;
}
#dialog-prompt {
  width: 100%;
  max-height: 400px;
  overflow-y: auto;         /* 竖向滚动 */
  resize: vertical;
  box-sizing: border-box;
}
.dialog-prompt {
  display: flex;
  flex-direction: column;
  gap: 10px;
}


