/* 消息树侧边栏样式 */
.message-tree-sidebar {
  height: 100%;
  background: #fafafa;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.message-tree-sidebar-collapsed {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
}

/* Resize Handle 样式 */
.resize-handle {
  position: absolute;
  top: 0;
  right: -2px;
  width: 4px;
  height: 100%;
  background: transparent;
  cursor: col-resize;
  z-index: 10;
  transition: all 0.2s;
  border-radius: 2px;
}

.resize-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 40px;
  background: #d9d9d9;
  border-radius: 1px;
  opacity: 0;
  transition: opacity 0.2s;
}

.resize-handle:hover::before {
  opacity: 1;
}

.resize-handle:hover {
  background: rgba(24, 144, 255, 0.1);
}

.resize-handle:active {
  background: rgba(9, 109, 217, 0.2);
}

.resize-handle:active::before {
  background: #1890ff;
}

/* 拖拽时的全局样式 */
.resizing * {
  user-select: none !important;
  pointer-events: none !important;
}

.resizing .resize-handle {
  pointer-events: auto !important;
}

/* 侧边栏头部 */
.tree-sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e8e8e8;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.tree-sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.tree-sidebar-title .anticon {
  color: #1890ff;
}

/* 统计信息 */
.tree-sidebar-stats {
  padding: 8px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-item .anticon {
  font-size: 12px;
  color: #666;
}

.stat-item .anticon-book {
  color: #ffc107;
}

/* 书签消息导航样式 */
.stat-item-bookmarked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.bookmarked-info {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.bookmarked-position {
  font-size: 10px;
  color: #999;
}

.bookmarked-navigation {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.bookmarked-navigation .nav-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 3px;
  transition: all 0.2s;
}

.bookmarked-navigation .nav-btn:hover {
  background-color: #f0f0f0;
  color: #ffc107;
}

.bookmarked-navigation .nav-btn .anticon {
  font-size: 10px;
}

/* 路径导航按钮样式 - 与收藏导航按钮保持一致 */
.path-nav-btn {
  width: 20px !important;
  height: 20px !important;
  padding: 0 !important;
  border-radius: 3px !important;
  transition: all 0.2s !important;
}

.path-nav-btn:hover {
  background-color: #f0f0f0 !important;
  color: #1890ff !important;
}

.path-nav-btn .anticon {
  font-size: 10px !important;
}

/* 折叠状态下的统计信息 */
.tree-sidebar-content-collapsed {
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tree-stats-collapsed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tree-stats-collapsed .stat-item {
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

.tree-stats-collapsed .stat-item .anticon {
  font-size: 14px;
}

.tree-stats-collapsed .stat-item .anticon-book {
  color: #ffc107;
}

.tree-stats-collapsed .stat-item .ant-typography {
  font-size: 10px;
}

/* 折叠状态下的书签导航 */
.stat-item-bookmarked-collapsed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  position: relative;
}

.bookmarked-navigation-collapsed {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
}

.bookmarked-navigation-collapsed .nav-btn-collapsed {
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 2px;
  transition: all 0.2s;
}

.bookmarked-navigation-collapsed .nav-btn-collapsed:hover {
  background-color: #f0f0f0;
  color: #ffc107;
}

.bookmarked-navigation-collapsed .nav-btn-collapsed .anticon {
  font-size: 8px;
}


/* 侧边栏内容 */
.tree-sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
}

.tree-empty {
  padding: 20px;
  text-align: center;
  color: #999;
}

/* 消息路径列表样式 */
.message-path-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.path-node-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 路径节点样式 */
.path-node {
  padding: 8px 12px;
  border-radius: 6px;
  min-height: 50px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.path-node:hover {
  background: #fafafa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.path-node.selected {
  background: #e6f7ff;
  border-color: #1890ff;
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

.path-node-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 20px;
}

.path-node-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f0f0f0;
  flex-shrink: 0;
}

.path-node-icon .anticon {
  font-size: 11px;
  color: #666;
}

.path-node-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.path-node-role {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.path-node-time {
  font-size: 11px;
  color: #999;
  flex-shrink: 0;
}

.path-node-preview {
  line-height: 1.3;
  width: 100%;
}

.path-node-preview .ant-typography {
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  display: block;
  width: 100%;
}

/* 兄弟分支切换按钮 */
.siblings-toggle {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.siblings-toggle:hover {
  background: rgba(24, 144, 255, 0.1);
  color: #1890ff;
}

.siblings-toggle .anticon {
  font-size: 12px;
}

/* 用户消息节点样式 */
.path-node[data-role='user'] {
  border-left: 4px solid #52c41a;
}

.path-node[data-role='user'] .path-node-icon {
  background: #52c41a;
}

.path-node[data-role='user'] .path-node-icon .anticon {
  color: #fff;
}

/* AI消息节点样式 */
.path-node[data-role='assistant'] {
  border-left: 4px solid #1890ff;
}

.path-node[data-role='assistant'] .path-node-icon {
  background: #1890ff;
}

.path-node[data-role='assistant'] .path-node-icon .anticon {
  color: #fff;
}

/* 书签消息样式 */
.path-node.bookmarked {
  border-right: 4px solid #ffc107;
  background: rgba(255, 193, 7, 0.05);
}

.path-node.bookmarked:hover {
  background: rgba(255, 193, 7, 0.08);
}

.path-node.bookmarked.selected {
  background: linear-gradient(135deg, rgba(24, 144, 255, 0.08) 0%, rgba(255, 193, 7, 0.08) 100%);
}

/* 书签图标样式 */
.path-node-role .bookmark-icon {
  color: #ffc107;
  font-size: 11px;
  animation: bookmark-pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes bookmark-pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 兄弟节点列表样式 */
.siblings-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  border-left: 2px solid #e8e8e8;
  position: relative;
}

.sibling-node {
  padding: 6px 10px;
  border-radius: 4px;
  min-height: 40px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s ease;
  background: #fafafa;
  border: 1px solid #f0f0f0;
}

.sibling-node:hover {
  background: #f5f5f5;
  border-color: #d9d9d9;
  transform: translateX(2px);
}

.sibling-node.selected {
  background: #e6f7ff;
  border-color: #1890ff;
}

.sibling-node-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 16px;
}

.sibling-node-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f0f0f0;
  flex-shrink: 0;
}

.sibling-node-icon .anticon {
  font-size: 10px;
  color: #666;
}

.sibling-node-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sibling-node-role {
  font-size: 11px;
  font-weight: 500;
  color: #333;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.sibling-node-time {
  font-size: 10px;
  color: #999;
  flex-shrink: 0;
}

.sibling-node-preview {
  line-height: 1.2;
  width: 100%;
}

.sibling-node-preview .ant-typography {
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  display: block;
  width: 100%;
}

/* 兄弟节点角色样式 */
.sibling-node[data-role='user'] {
  border-left: 3px solid #52c41a;
}

.sibling-node[data-role='user'] .sibling-node-icon {
  background: #52c41a;
}

.sibling-node[data-role='user'] .sibling-node-icon .anticon {
  color: #fff;
}

.sibling-node[data-role='assistant'] {
  border-left: 3px solid #1890ff;
}

.sibling-node[data-role='assistant'] .sibling-node-icon {
  background: #1890ff;
}

.sibling-node[data-role='assistant'] .sibling-node-icon .anticon {
  color: #fff;
}

/* 兄弟节点书签样式 */
.sibling-node.bookmarked {
  border-right: 3px solid #ffc107;
  background: rgba(255, 193, 7, 0.05);
}

.sibling-node.bookmarked:hover {
  background: rgba(255, 193, 7, 0.08);
}

.sibling-node.bookmarked.selected {
  background: linear-gradient(135deg, rgba(24, 144, 255, 0.08) 0%, rgba(255, 193, 7, 0.08) 100%);
}

.sibling-node-role .bookmark-icon {
  color: #ffc107;
  font-size: 10px;
  animation: bookmark-pulse 2s infinite;
  flex-shrink: 0;
}

/* 聊天窗口布局 */
.chat-window {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-window-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.chat-main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .message-tree-sidebar {
    max-width: 50vw;
  }

  .message-tree-sidebar-collapsed {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
  }

  .resize-handle {
    width: 6px;
  }
}

/* 滚动条样式 */
.tree-sidebar-content::-webkit-scrollbar {
  width: 4px;
}

.tree-sidebar-content::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.tree-sidebar-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 2px;
}

.tree-sidebar-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 动画效果 */
.message-tree-sidebar {
  transition: width 0.3s ease;
}

/* 空状态 */
.tree-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  color: #999;
  font-size: 12px;
  padding: 20px;
  text-align: center;
}
