/* ====== Chat Page - 侧边栏 + 聊天区布局 ====== */

/* 覆盖 body 样式，使用全屏布局 */
body {
  overflow: hidden;
}

/* ====== 整体布局 ====== */
.chat-layout {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* ====== 左侧边栏 ====== */
.chat-sidebar {
  width: 260px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  transition: all var(--transition-base);
  z-index: 10;
}

/* 侧边栏折叠状态 */
.chat-sidebar.collapsed {
  width: 56px;
  min-width: 56px;
}

.chat-sidebar.collapsed .sidebar-brand-text,
.chat-sidebar.collapsed span:not(.badge-new):not(.user-avatar-sm):not(.user-name-sm),
.chat-sidebar.collapsed .sidebar-empty-hint,
.chat-sidebar.collapsed .footer-mode-label span:last-child,
.chat-sidebar.collapsed .user-name-sm {
  display: none;
}

/* ----- 侧边栏顶部：品牌 + 折叠按钮 ----- */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--color-primary);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-brand svg {
  width: 20px;
  height: 20px;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-base);
}

.chat-sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* ----- 侧边栏导航区（可滚动）----- */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

/* 操作按钮（新对话、清空历史） */
.sidebar-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.sidebar-action:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.sidebar-action svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-action:hover svg {
  opacity: 1;
}

/* 分组标题 */
.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 12px 8px;
  color: var(--color-text-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-section-title svg {
  opacity: 0.5;
}

/* 列表项（如创建技能） */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-item:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.sidebar-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-item:hover svg {
  opacity: 1;
}

/* 新功能角标 */
.badge-new {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* 历史列表区域 */
.sidebar-history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-empty-hint {
  padding: 24px 12px 12px;
  color: var(--color-text-muted);
  font-size: 12.5px;
  text-align: center;
  opacity: 0.7;
}

/* 历史记录项 */
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.history-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- 侧边栏底部：用户信息 ----- */
.sidebar-footer {
  border-top: 1px solid var(--color-border);
  padding: 12px 16px;
  flex-shrink: 0;
}

.footer-mode-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--color-text-muted);
  font-size: 11px;
  margin-bottom: 10px;
}

.footer-mode-label svg {
  opacity: 0.5;
}

.footer-user-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name-sm {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-toggle-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.theme-toggle-sm:hover {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-primary);
}

.theme-toggle-sm svg {
  width: 14px;
  height: 14px;
}


/* ====== 右侧主内容区（白色背景）====== */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #FFFFFF; /* 聊天页面统一白色背景 */
  position: relative;
}

/* ----- 消息列表区域（白色背景）----- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  background: #FFFFFF; /* 消息区白色背景 */
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }


/* ====== 空状态：居中输入框（DeepSeek 极简风格 - 白色背景）====== */
.chat-welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 32px 48px;
  background: #FFFFFF; /* 欢迎区白色背景 */
}

.welcome-content {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ========== DeepSeek 风格输入框容器 ========== */
.ds-input-box {
  width: 100%;
  background: var(--color-surface);
  border: 1.5px solid #D1D5DB; /* 浅灰边框 */
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* 聚焦状态：蓝色边框 + 轻微阴影（DeepSeek 风格） */
.ds-input-box:focus-within {
  border-color: #4F6EF7; /* DeepSeek 品牌蓝 */
  box-shadow: 0 2px 12px rgba(79, 110, 247, 0.10);
}

/* 暗色模式适配 */
[data-theme="dark"] .ds-input-box {
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .ds-input-box:focus-within {
  border-color: #4F6EF7;
  box-shadow: 0 2px 16px rgba(79, 110, 247, 0.18);
}

/* 输入文本域 */
.ds-textarea {
  width: 100%;
  padding: 20px 22px 14px;
  background: transparent;
  border: none;
  outline: none !important;
  font-size: 15px;
  line-height: 1.65;
  color: var(--color-text);
  font-family: var(--font-sans);
  resize: none;
  min-height: 80px;
  max-height: 220px;
  box-shadow: none !important;
}

.ds-textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.55;
}

/* ========== DeepSeek 风格工具栏 ========== */
.ds-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 12px;
}

.ds-toolbar-left,
.ds-toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 工具按钮：极简线条图标风格 */
.ds-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #9CA3AF; /* 中灰色，类似 DeepSeek 的 muted 图标色 */
  cursor: pointer;
  transition: all 0.15s ease;
}

.ds-tool-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #374151;
}

[data-theme="dark"] .ds-tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #E5E7EB;
}

.ds-tool-btn svg {
  width: 19px;
  height: 19px;
}

/* 搜索激活态：蓝色高亮 */
.ds-tool-btn.search-active {
  background: rgba(79, 110, 247, 0.08);
  color: #4F6EF7;
}

/* 搜索引擎下拉选择器 */
.ds-select {
  height: 28px;
  padding: 0 22px 0 8px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: #F9FAFB;
  color: #374151;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  /* 下拉箭头 SVG */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 13px;
}

[data-theme="dark"] .ds-select {
  border-color: rgba(255, 255, 255, 0.12);
  background-color: rgba(255, 255, 255, 0.05);
  color: #D1D5DB;
}

.ds-select:focus {
  border-color: #4F6EF7;
}

/* 上传文件名提示 */
.ds-filename {
  font-size: 12px;
  color: #4F6EF7;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
  font-weight: 500;
}

/* 字符计数（隐藏） */
.ds-char-count {
  display: none;
}

/* 发送按钮：圆形 + 简洁蓝色 */
.ds-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #E5E7EB; /* 禁用时浅灰 */
  color: #9CA3AF;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ds-send-btn:not(:disabled) {
  background: #4F6EF7; /* DeepSeek 蓝 */
  color: #FFFFFF;
  box-shadow: 0 1px 6px rgba(79, 110, 247, 0.25);
}

.ds-send-btn:not(:disabled):hover {
  transform: scale(1.07);
  box-shadow: 0 2px 12px rgba(79, 110, 247, 0.35);
  background: #3B5CE8;
}

.ds-send-btn:not(:disabled):active {
  transform: scale(0.95);
}

.ds-send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ds-send-btn svg {
  width: 17px;
  height: 17px;
}

/* ========== 技能选择面板（DeepSeek 风格）========== */
.ds-skill-panel {
  max-height: 240px;
  overflow-y: auto;
  padding-bottom: 4px;
}

.ds-skill-list {
  padding: 6px 8px 8px;
}

.ds-skill-empty {
  padding: 18px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* 技能列表项（复用原有样式） */
.skill-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.skill-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text);
}

[data-theme="dark"] .skill-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.skill-item.selected {
  background: rgba(79, 110, 247, 0.08);
  color: #4F6EF7;
}

.skill-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.skill-item-name {
  flex: 1;
  font-weight: 500;
}

.skill-item-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}


/* ====== 消息气泡样式（DeepSeek 极简风格）====== */

/* 消息容器 */
.chat-message {
  display: flex;
  gap: 0; /* DeepSeek 无头像间距 */
  max-width: 80%; /* 稍宽一点 */
  margin: 0 auto 20px;
  animation: msgFadeIn 0.25s ease-out;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 用户消息（右对齐）- DeepSeek 风格：深蓝底 + 小圆角 */
.chat-message.user {
  align-self: flex-end;
  justify-content: flex-end; /* 内容靠右 */
  margin-right: 24px;
}

/* 用户气泡：DeepSeek 深色调 + 扁平设计 */
.chat-message.user .chat-bubble {
  background: #2B4F8C; /* DeepSeek 用户消息深蓝 */
  color: #FFFFFF;
  border-radius: 14px 14px 4px 14px; /* 右下角尖角 */
  padding: 13px 18px;
  box-shadow: none; /* 无阴影，扁平 */
  font-size: 15px;
  line-height: 1.7;
}

/* AI 消息（左对齐）- DeepSeek 风格：浅色底 + 细边框 */
.chat-message.assistant {
  align-self: flex-start;
  margin-left: 24px;
}

/* AI 气泡：DeepSeek 浅色 + 细边框 + 微阴影 */
.chat-message.assistant .chat-bubble {
  background: #F7F8FA; /* DeepSeek AI 消息浅灰白 */
  color: #1A1A2E; /* 深色文字确保可读性 */
  border: 1px solid #E8EAED; /* 极细边框 */
  border-radius: 14px 14px 14px 4px; /* 左下角尖角 */
  padding: 13px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); /* 极微阴影 */
  font-size: 15px;
  line-height: 1.7;
}

/* 暗色模式 - 聊天页面保持白色/浅色背景 */
[data-theme="dark"] .chat-main {
  background: #FFFFFF; /* 暗色模式下聊天区仍为白底 */
}

[data-theme="dark"] .chat-messages {
  background: #FFFFFF;
}

[data-theme="dark"] .chat-welcome {
  background: #FFFFFF;
}

[data-theme="dark"] .chat-input-bottom {
  background: #FFFFFF;
}

/* 暗色模式适配 - 用户消息保持深色 */
[data-theme="dark"] .chat-message.user .chat-bubble {
  background: #3B5998; /* 暗色模式稍亮一点的深蓝 */
}

/* 暗色模式适配 - AI 消息 */
[data-theme="dark"] .chat-message.assistant .chat-bubble {
  background: #2A2D35; /* 暗色模式深灰底 */
  color: #E5E7EB; /* 浅色文字 */
  border-color: #3A3F4B; /* 暗色边框 */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* 头像 - 当前版本统一不显示 */
.chat-avatar {
  display: none;
}

/* 气泡基础样式（公共部分，具体颜色/圆角由 user/assistant 覆盖） */
.chat-bubble {
  word-break: break-word;
  white-space: pre-wrap;
}

/* 代码块样式 */
.chat-bubble code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

[data-theme="dark"] .chat-bubble code {
  background: rgba(255, 255, 255, 0.1);
}

.chat-bubble pre {
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid var(--color-border);
}

.chat-bubble pre code {
  background: none;
  padding: 0;
}

[data-theme="dark"] .chat-bubble pre {
  background: rgba(0, 0, 0, 0.25);
}

/* 用户消息内的代码块 - DeepSeek 深色底适配 */
.chat-message.user .chat-bubble code {
  background: rgba(255, 255, 255, 0.18); /* 半透明白 */
  color: #E8F0FE;
}

.chat-message.user .chat-bubble pre {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.12);
}


/* ====== 加载指示器（DeepSeek 极简风格）====== */
.chat-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  align-self: flex-start;
  margin-left: 24px;
}

.chat-loading-dots {
  display: flex;
  gap: 5px;
}

.chat-loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0.35;
  animation: dotBounce 1.4s ease-in-out infinite;
}

.chat-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.65); opacity: 0.25; }
  40% { transform: scale(1); opacity: 1; }
}

.chat-loading-text {
  font-size: 13px;
  color: var(--color-text-muted);
}


/* ====== 底部输入框（有消息时显示，DeepSeek 风格 - 白色背景）====== */
.chat-input-bottom {
  border-top: 1px solid var(--color-border);
  background: #FFFFFF; /* 输入区白色背景 */
  padding: 14px 24px;
  flex-shrink: 0;
}

.ds-bottom-wrapper {
  max-width: 760px;
  margin: 0 auto;
}

/* 底部输入框复用 ds-input-box 样式（已在上方定义） */


/* ====== 打字机效果 ====== */

/* 正在打字的气泡（保持最小高度避免闪烁） */
.chat-bubble-typing {
  min-height: 24px;
}

/* 闪烁光标 */
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background-color: var(--color-primary, #4F6EF7);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: blink-cursor 0.8s step-end infinite;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ====== Markdown 渲染样式（AI 回复内容）====== */

/* 气泡内的 Markdown 内容 */
.chat-bubble p { margin: 0 0 8px; line-height: 1.7; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble h1,.chat-bubble h2,.chat-bubble h3,
.chat-bubble h4,.chat-bubble h5,.chat-bubble h6 {
  margin: 14px 0 8px; font-weight: 600; line-height: 1.4;
}
.chat-bubble h1 { font-size: 1.25em; }
.chat-bubble h2 { font-size: 1.15em; }
.chat-bubble h3 { font-size: 1.08em; }
.chat-bubble ul,.chat-bubble ol { margin: 8px 0; padding-left: 20px; }
.chat-bubble li { margin-bottom: 3px; line-height: 1.65; }
.chat-bubble strong { font-weight: 600; color: var(--color-text); }
.chat-bubble em { font-style: italic; }

/* 表格 */
.chat-bubble table {
  width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px;
}
.chat-bubble th,.chat-bubble td {
  border: 1px solid var(--color-border); padding: 7px 10px; text-align: left;
}
.chat-bubble th { background: rgba(0,0,0,0.03); font-weight: 600; }
[data-theme="dark"] .chat-bubble th { background: rgba(255,255,255,0.05); }

/* 引用块 */
.chat-bubble blockquote {
  border-left: 3px solid #4F6EF7; padding: 8px 14px; margin: 10px 0;
  background: rgba(79,110,247,0.05); border-radius: 0 6px 6px 0;
  color: var(--color-text-secondary); font-size: 0.93em;
}

/* 行内代码 */
.chat-bubble code:not([class]) {
  background: rgba(79,110,247,0.08);
  color: #4F6EF7; padding: 2px 6px; border-radius: 4px;
  font-size: 0.88em; font-family: 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* 代码块 */
.chat-bubble pre {
  margin: 10px 0; border-radius: 8px; overflow-x: auto;
  background: #f6f8fa; border: 1px solid #e1e4e8;
}
[data-theme="dark"] .chat-bubble pre { background: #161b22; border-color: #30363d; }
.chat-bubble pre code {
  display: block; padding: 12px 16px; font-size: 13px; line-height: 1.55;
  font-family: 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  background: transparent !important; color: inherit;
}
/* 覆盖 highlight.js 默认背景 */
.chat-bubble pre code.hljs { background: transparent !important; }

/* 分割线 */
.chat-bubble hr { border: none; border-top: 1px solid var(--color-border); margin: 14px 0; }

/* 链接 */
.chat-bubble a { color: #4F6EF7; text-decoration: none; }
.chat-bubble a:hover { text-decoration: underline; }

/* Mermaid 图表容器 */
.chat-bubble .mermaid {
  margin: 12px 0; text-align: center; background: #fafbfc;
  border-radius: 8px; padding: 16px; border: 1px solid #e1e4e8;
}
[data-theme="dark"] .chat-bubble .mermaid { background: #161b22; border-color: #30363d; }

/* ====== 引用源区域（logo + 跳转链接）====== */
.source-footer {
  margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--color-border);
}

.source-header {
  font-size: 11px; font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px;
}

.source-list {
  display: flex; flex-wrap: wrap; gap: 6px;
}

.source-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 20px;
  background: rgba(0,0,0,0.03); border: 1px solid var(--color-border);
  color: var(--color-text-secondary); font-size: 12px; text-decoration: none;
  transition: all 0.15s ease; cursor: pointer; max-width: 220px;
}
[data-theme="dark"] .source-item { background: rgba(255,255,255,0.04); }

.source-item:hover {
  background: rgba(79,110,247,0.06); border-color: #4F6EF7; color: #4F6EF7;
  transform: translateY(-1px); box-shadow: 0 2px 6px rgba(79,110,247,0.12);
}

.source-icon {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0;
}
.source-icon svg { width: 100%; height: 100%; }

.source-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500;
}

/* ====== 复制按钮 ====== */
.copy-wrapper {
  display: flex; justify-content: flex-end; margin-top: 10px;
}

.copy-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 1px solid var(--color-border);
  border-radius: 6px; background: transparent;
  color: var(--color-text-muted); cursor: pointer;
  transition: all 0.15s ease; padding: 0;
}

.copy-btn:hover {
  background: rgba(79,110,247,0.06); border-color: #4F6EF7; color: #4F6EF7;
}

.copy-btn svg { width: 15px; height: 15px; }

.copy-btn.copied {
  background: rgba(34,197,94,0.08); border-color: #22c55e; color: #22c55e;
}

/* ====== AI 降级提示 ====== */
.ai-fallback-hint {
  margin-top: 10px; padding: 8px 12px; border-radius: 6px;
  background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.2);
  color: #b45309; font-size: 12px; line-height: 1.5;
}

/* 移动端汉堡菜单按钮 - 桌面端隐藏 */
.mobile-menu-btn {
  display: none;
}

@media (max-width: 768px) {
  .chat-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .chat-sidebar.open {
    transform: translateX(0);
  }

  /* 移动端遮罩层 */
  .mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 99;
    backdrop-filter: blur(2px);
  }

  .mobile-overlay.show {
    display: block;
  }

  /* 移动端汉堡菜单按钮 */
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    z-index: 20;
    transition: all var(--transition-fast);
  }

  .mobile-menu-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-primary);
    border-color: var(--color-primary);
  }

  .mobile-menu-btn svg {
    width: 18px;
    height: 18px;
  }

  /* 消息气泡响应式 - DeepSeek 风格 */
  .chat-message {
    max-width: 90%;
  }
  .chat-message.user { margin-right: 14px; }
  .chat-message.assistant { margin-left: 14px; }
  .chat-loading { margin-left: 14px; padding: 12px 18px; }

  /* 输入框响应式 */
  .ds-input-box { border-radius: 14px; }
  .ds-textarea { font-size: 14px; padding: 16px 18px 12px; min-height: 64px; }
  .ds-tool-btn { width: 32px; height: 32px; }
  .ds-tool-btn svg { width: 17px; height: 17px; }
  .ds-send-btn { width: 34px; height: 34px; }

  .chat-input-bottom {
    padding: 10px 14px;
  }

  .ds-bottom-wrapper {
    max-width: 100%;
  }
}

/* 480px 及以下 - 移动端 */
@media (max-width: 480px) {
  .chat-welcome {
    padding: 16px 16px 32px;
  }
  .welcome-content {
    max-width: 100%;
  }
  .ds-input-box {
    border-radius: 12px;
    border-width: 1px;
  }
  .ds-textarea {
    padding: 14px 14px 10px;
    font-size: 14px;
    min-height: 56px;
  }
  .ds-toolbar {
    padding: 6px 10px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .ds-toolbar-left {
    flex-wrap: wrap;
    gap: 2px;
    flex: 1;
    min-width: 0;
  }
  .ds-tool-btn {
    width: 30px;
    height: 30px;
  }
  .ds-tool-btn svg {
    width: 16px;
    height: 16px;
  }
  .ds-filename {
    max-width: 80px;
    font-size: 11px;
  }
  .ds-send-btn {
    width: 32px;
    height: 32px;
  }
  .ds-send-btn svg {
    width: 15px;
    height: 15px;
  }
  .ds-bottom-wrapper {
    padding: 0;
  }
  .chat-input-bottom {
    padding: 8px 12px;
  }
  .chat-message {
    max-width: 95%;
  }
  .chat-message.user { margin-right: 8px; }
  .chat-message.assistant { margin-left: 8px; }
  .chat-bubble {
    font-size: 14px !important;
    padding: 11px 14px !important;
  }
  .chat-loading {
    margin-left: 8px;
    padding: 10px 14px;
  }
  .mobile-menu-btn {
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
  }
  .chat-sidebar {
    width: 240px;
    min-width: 240px;
  }
}

/* 360px 及以下 - 极小屏 */
@media (max-width: 360px) {
  .chat-sidebar { width: 220px; min-width: 220px; }
  .chat-welcome { padding: 12px 10px 24px; }
  .ds-textarea { padding: 12px 12px 8px; font-size: 13px; min-height: 48px; }
  .ds-toolbar { padding: 4px 8px 8px; }
  .ds-tool-btn { width: 28px; height: 28px; }
  .ds-tool-btn svg { width: 14px; height: 14px; }
  .ds-send-btn { width: 30px; height: 30px; }
  .ds-send-btn svg { width: 14px; height: 14px; }
  .mobile-menu-btn { top: 8px; left: 8px; width: 30px; height: 30px; }
  .chat-message { max-width: 98%; }
  .chat-message.user .chat-bubble { font-size: 13px !important; padding: 10px 12px !important; }
  .chat-message.assistant .chat-bubble { font-size: 13px !important; padding: 10px 12px !important; }
  .ds-select { max-width: 90px; font-size: 11px; }
}