/* ==========================================
   聊天室样式（优化版）
   ========================================== */

.chat-section {
  padding: 0;
}

.chat-layout {
  display: flex;
  height: calc(100vh - 120px);
  background: #00000000;
  margin: 30px 20px 20px 20px;
}

/* 左侧边栏 */
.chat-sidebar {
  width: 320px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-tabs {
  display: flex;
  padding: 16px;
  gap: 8px;
}

.chat-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-tab-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: 50px;
}

.chat-tab-btn.active {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border-radius: 50px;
}

.chat-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 3px 5px 0px 5px;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 9px;
  margin-left: 4px;
}

.chat-list-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  font-size: 1.2rem;
  font-weight: 600;
  color: #bdc2a2;
  background: linear-gradient(89deg, #284f4c, #10161f);
  border-radius: 0px 15px 0px 15px;
}

.chat-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.chat-item:hover {
  background: var(--bg-tertiary);
}

.chat-item.active {
  background: var(--accent-primary);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.chat-item.active .chat-item-name,
.chat-item.active .chat-item-meta {
  color: #fff;
}

.chat-item-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 12px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.chat-item.active .chat-item-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.chat-item-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.chat-item-avatar img,
.chat-item-avatar span {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 1rem;
}

.chat-item-badge {
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 9px;
}

.chat-item-info {
  flex: 1;
  min-width: 0;
}

.chat-item-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-preview {
  color: var(--text-muted);
}

/* 私信列表富文本预览样式 */
.chat-item-preview.rich-preview {
  max-height: 24px;
  overflow: hidden;
  line-height: 1.4;
}

.chat-item-preview.rich-preview p {
  margin: 0;
  display: inline;
}

.chat-item-preview.rich-preview strong,
.chat-item-preview.rich-preview b {
  font-weight: 600;
}

.chat-item-preview.rich-preview em,
.chat-item-preview.rich-preview i {
  font-style: italic;
}

.chat-item-preview.rich-preview code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  padding: 1px 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-radius: 3px;
}

.chat-item-preview.rich-preview img {
  max-width: 60px;
  max-height: 20px;
  border-radius: 4px;
  vertical-align: middle;
}

/* 好友列表未读角标（右侧） */
.friend-unread-badge {
  position: static;
  margin-left: auto;
  background: var(--accent-red);
  color: white;
  padding: 0px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  font-weight: 600;
}

.chat-empty-list {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.chat-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

/* 主聊天区域 */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  min-width: 0;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.chat-empty-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 20px;
  margin-bottom: 16px;
  color: var(--accent-primary);
}

.chat-empty-icon svg {
  width: 40px;
  height: 40px;
}

.chat-empty-text {
  font-size: 1rem;
}

/* 聊天头部 */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 24px;
  background: var(--bg-secondary);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.chat-header-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 14px;
  color: #fff;
}

.chat-header-avatar {
  width: 48px;
  height: 48px;
}

.chat-header-avatar img,
.chat-header-avatar span {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 1.2rem;
}

.chat-header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.chat-header-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 4px 0 0 0;
}

/* 消息区域 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 50px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-empty-messages {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.chat-msg {
  display: flex;
  gap: 12px;
  max-width: 70%;
  animation: msgSlideIn 0.3s ease;
}

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

.chat-msg.mine {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.chat-msg-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.chat-msg-avatar img,
.chat-msg-avatar span {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

/* 聊天室头像可右键 */
.chat-msg-avatar {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.chat-msg-avatar:hover {
  transform: scale(1.05);
}

.chat-msg-content {
  flex: 1;
  min-width: 0;
}

.chat-msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.chat-msg.mine .chat-msg-header {
  flex-direction: row-reverse;
}

.chat-msg-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-msg-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-msg-reply {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 6px;
  border-left: 3px solid var(--accent-primary);
}

.chat-msg-text {
  background: #1118209e;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

/* 聊天消息中富文本内容样式 */
.chat-msg-text p {
  margin: 0 0 8px 0;
}

.chat-msg-text p:last-child {
  margin-bottom: 0;
}

.chat-msg-text strong {
  font-weight: 600;
  color: var(--text-primary);
}

.chat-msg-text em {
  font-style: italic;
}

.chat-msg-text img {
  max-width: 300px;
  max-height: 300px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  margin: 8px 0;
  display: block;
}

.chat-msg-text img:hover {
  transform: scale(1.02);
}

.chat-msg-text ul,
.chat-msg-text ol {
  margin: 8px 0;
  padding-left: 20px;
}

.chat-msg-text li {
  margin: 4px 0;
}

.chat-msg-text code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
}

.chat-msg-text pre {
  background: var(--bg-tertiary);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.chat-msg-text pre code {
  background: transparent;
  padding: 0;
}

.chat-msg-text blockquote {
  border-left: 3px solid var(--accent-primary);
  margin: 8px 0;
  padding-left: 12px;
  color: var(--text-muted);
}

.chat-msg.mine .chat-msg-text {
  background: #9580ee14;
  color: #fff;
}

.chat-msg-delete,
.chat-msg-reply-btn {
  position: absolute;
  /* right: -40px; */
  top: 60px;
  transform: translateY(-50%);
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.chat-msg {
  position: relative;
}

.chat-msg:hover .chat-msg-delete,
.chat-msg:hover .chat-msg-reply-btn {
  opacity: 1;
}

.chat-msg-delete:hover {
  background: var(--accent-red);
  color: #fff;
}

/* 输入区域 */
.chat-input-area {
  padding: 0px 10px 0px 0px; /* 上 右 下 左 */
  background: var(--bg-secondary);
  position: relative;
}

/* 输入行布局 */
.chat-input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  position: relative;
  padding: 10px 0px 10px 0px; /* 上 右 下 左 */
}

/* 右侧按钮区域 */
.chat-input-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* 工具按钮 */
.chat-tool-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-tool-btn:hover {
  background: var(--accent-primary);
  transform: scale(1.05);
}

/* WangEditor 编辑器容器 */
.chat-editor-wrapper {
  flex: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-primary);
}

.chat-editor {
  min-height: 140px;
  max-height: 140px;
  overflow-y: auto;
  background: var(--bg-primary);
}

/* WangEditor 编辑区域样式覆盖 */
.chat-editor .w-e-text-container {
  background: transparent !important;
  min-height: 48px !important;
  border: none !important;
}

.chat-editor .w-e-text-container [data-slate-editor] {
  padding: 12px 16px !important;
  min-height: 140px !important;
  color: var(--text-primary) !important;
}

.chat-editor .w-e-text-container [data-slate-editor] p {
  margin: 0 !important;
  line-height: 1.5 !important;
}

.chat-editor .w-e-text-container [data-slate-editor] img {
  max-height: 140px !important;
  border-radius: 8px !important;
  margin: 4px 0 !important;
}

.chat-editor .w-e-text-container [data-slate-editor] strong {
  color: var(--text-primary) !important;
}

/* WangEditor placeholder 样式 */
.chat-editor .w-e-text-container [data-slate-editor]::before {
  color: var(--text-muted) !important;
}



.emoji-categories {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.emoji-cat-btn {
  padding: 6px 12px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.emoji-cat-btn:hover,
.emoji-cat-btn.active {
  background: var(--accent-primary);
  color: #fff;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}

/* 表情网格滚动条样式 */
.emoji-grid::-webkit-scrollbar {
  width: 6px;
}

.emoji-grid::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.emoji-grid::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

.emoji-item {
  padding: 8px;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}

.emoji-item:hover {
  background: var(--bg-tertiary);
}

.chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chat-reply-close {
  margin-left: auto;
  padding: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
}

.chat-reply-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.chat-input-box {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  min-height: 48px;
  max-height: 120px;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  transition: border-color 0.2s ease;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* 好友搜索 */
.friend-search-item,
.friend-request-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  margin-bottom: 8px;
}

.friend-search-avatar,
.friend-request-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.friend-search-avatar img,
.friend-search-avatar span,
.friend-request-avatar img,
.friend-request-avatar span {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: var(--accent-primary);
  font-weight: 600;
}

.friend-search-info,
.friend-request-info {
  flex: 1;
  min-width: 0;
}

.friend-search-name,
.friend-request-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.friend-search-id,
.friend-request-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.friend-request-actions {
  display: flex;
  gap: 8px;
}

/* 响应式 */
@media (max-width: 768px) {
  .chat-layout {
    height: calc(100vh - 127px);
	margin: 0px !important;
  }
  
  .chat-sidebar {
    width: 100%;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 10;
    height: 100%;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .chat-sidebar.mobile-show {
    transform: translateX(0);
  }
  
  .chat-main {
    width: 100%;
  }
  
  .chat-msg {
    max-width: 85%;
  }
  
  .chat-input-area {
    padding: 12px 16px;
  }
  
  .chat-messages {
    padding: 16px;
  }
  
  /* 返回按钮 - 只在手机端显示 */
  .chat-back-btn {
    display: flex;
    position: absolute;
    top: 23px;
    left: 12px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    z-index: 5;
  }
  
  /* 聊天头部添加左侧padding */
  .chat-header {
    padding-left: 60px;
  }
}

/* 桌面端隐藏返回按钮 */
@media (min-width: 769px) {
  .chat-back-btn {
    display: none;
  }
}

/* 表情选择器 */
.chat-emoji-btn {
  padding: 8px;
  border: none;
  background: transparent;
  font-size: 1.3rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.chat-emoji-btn:hover {
  background: var(--bg-tertiary);
}


/* 表情选择器 */
.chat-emoji-picker {
  position: absolute;
  bottom: calc(100% + 20px);
  right: 20px;
  width: calc(100% - 40px);
  max-height: 300px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.emoji-categories {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.emoji-cat-btn {
  padding: 6px 12px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.emoji-cat-btn:hover,
.emoji-cat-btn.active {
  background: var(--accent-primary);
  color: #fff;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.emoji-item {
  padding: 8px;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}

.emoji-item:hover {
  background: var(--bg-tertiary);
}

/* 输入框操作区 */
.chat-input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-char-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
}

/* 消息展开/收起 */
.chat-msg-expand {
  display: block;
  margin-top: 8px;
  padding: 4px 12px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}

.chat-msg-preview {
  opacity: 0.8;
}

.chat-msg-full {
  max-height: 400px;
  overflow-y: auto;
}

/* 长消息提示 */
.chat-msg-long-info {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chat-msg-download {
  background: none;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 0;
}

.chat-msg-download:hover {
  color: var(--accent-secondary);
}

/* 图片上传按钮 */
.chat-image-btn {
  padding: 8px;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.chat-image-btn:hover {
  background: var(--bg-tertiary);
}

/* 聊天图片 */
.chat-msg-image {
  max-width: 300px;
  max-height: 300px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.chat-msg-image:hover {
  transform: scale(1.02);
}

/* 图片预览 */
.image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
}

.image-preview-img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.image-preview-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 机器人输入指示器 */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-style: italic;
}

.typing-indicator .dot {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.bot-message {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-left: 3px solid var(--accent-emerald);
}

/* 代码块样式 */
.code-block-wrapper {
  margin: 8px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #1e1e1e;
  border: 1px solid #333;
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #2d2d2d;
  border-bottom: 1px solid #333;
}

.code-block-lang {
  color: #888;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.code-block-copy {
  background: transparent;
  border: 1px solid #444;
  color: #aaa;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.code-block-copy:hover {
  background: #444;
  color: #fff;
}

.code-block-copy.copied {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}

.code-block-content {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
}

.code-block-content code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #d4d4d4;
}

.inline-code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  color: #f0f0f0;
}

/* 消息复制按钮 */
.chat-msg-text-wrapper {
  position: relative;
}

.chat-msg-copy {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  transition: all 0.2s;
  opacity: 0;
  z-index: 10;
}

.chat-msg-text-wrapper:hover .chat-msg-copy {
  opacity: 1;
}

.chat-msg-copy:hover {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}

/* Markdown 内容样式 */
.markdown-content {
  line-height: 1.6;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  color: var(--text-primary);
}

.markdown-content h1 { font-size: 1.5em; }
.markdown-content h2 { font-size: 1.3em; }
.markdown-content h3 { font-size: 1.1em; }

.markdown-content p {
  margin: 8px 0;
}

.markdown-content ul,
.markdown-content ol {
  margin: 8px 0;
  padding-left: 24px;
}

.markdown-content li {
  margin: 4px 0;
}

.markdown-content a {
  color: var(--accent-emerald);
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content blockquote {
  margin: 8px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  color: var(--text-muted);
}

.markdown-content hr {
  margin: 16px 0;
  border: none;
  border-top: 1px solid var(--border-color);
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.markdown-content th,
.markdown-content td {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.markdown-content th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

/* 机器人名称提示下拉菜单 */
#bot-mention-dropdown {
  animation: botMentionFadeIn 0.15s ease;
}

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

.bot-mention-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary, #cdd6f4);
  font-size: 0.9rem;
  transition: background 0.2s;
  user-select: none;
}

.bot-mention-item:hover,
.bot-mention-item.selected {
  background: var(--bg-hover, #313244) !important;
}

.bot-mention-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bot-mention-item .bot-name {
  font-weight: 500;
}

.bot-mention-item .bot-label {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted, #6c7086);
}
