/* 消息包装器 */
.message-wrapper {
  transition: all 0.3s ease;
}

/* 紧凑统计样式 */
.compact-statistic .ant-statistic-title {
  font-size: 11px !important;
  margin-bottom: 2px !important;
  color: #8c8c8c !important;
  font-weight: 500 !important;
}

.compact-statistic .ant-statistic-content {
  font-size: 16px !important;
  line-height: 1.2 !important;
}

.compact-statistic .ant-statistic-content-value {
  font-weight: 600 !important;
}

/* 快捷操作按钮统一样式 */
.quick-actions .ant-btn {
  border-radius: 6px !important;
  font-weight: 500 !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.quick-actions .ant-btn:hover {
  background-color: rgba(24, 144, 255, 0.1) !important;
  transform: translateY(-1px) !important;
}

.quick-actions .ant-btn[style*="color: #1890ff"] {
  font-weight: 600 !important;
}

.quick-actions .ant-btn[style*="color: #1890ff"]:hover {
  background-color: rgba(24, 144, 255, 0.15) !important;
  color: #40a9ff !important;
}

/* 高亮消息 */
.message-wrapper.highlighted {
  background: linear-gradient(135deg, #fff8e1 0%, #fff3c4 100%);
  border: 2px solid #faad14;
  border-radius: 8px;
  padding: 8px;
  margin: 4px 0;
  animation: messageHighlight 0.5s ease-out;
}

@keyframes messageHighlight {
  0% {
    background: #faad14;
    transform: scale(1.02);
  }

  50% {
    background: #fff8e1;
    transform: scale(1.01);
  }

  100% {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3c4 100%);
    transform: scale(1);
  }
}

/* 消息区域 */
.message-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #f9f9f9;
  min-height: 0;
  /* 修复flex容器溢出 */
  overflow: hidden;
  /* 防止整体溢出 */
}

/* 消息区域空状态 */
.message-area-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #fff;
}

/* 消息头部 - 已迁移到 MessageHeader.css */

.header-group-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.group-details {
  flex: 1;
  min-width: 0;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.group-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.member-info {
  display: flex;
  align-items: center;
}

.group-description {
  margin-top: 4px;
  max-width: 300px;
}

.header-actions {
  display: flex;
  align-items: center;
}

/* 消息列表 */
.message-list {
  flex: 1;
  overflow: visible;
  /* 改为visible，允许内部滚动条生效 */
  padding: 0;
  /* 移除外层padding，让内部组件处理 */
  background: #f9f9f9;
  position: relative;
  min-height: 0;
  /* 修复flex子元素溢出 */
  max-height: 100%;
  /* 限制最大高度 */
  display: flex;
  /* 确保flex布局 */
  flex-direction: column;
  /* 垂直方向排列 */
}

/* 加载状态 */
.message-loading,
.load-more-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 12px;
}

.load-more-indicator {
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  animation: loadMoreFadeIn 0.3s ease-in-out;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* 加载指示器动画 */
@keyframes loadMoreFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 平滑的骨架屏效果 */
.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.loading-skeleton-item {
  height: 20px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: 4px;
}

.loading-skeleton-item:nth-child(1) {
  width: 70%;
}

.loading-skeleton-item:nth-child(2) {
  width: 90%;
}

.loading-skeleton-item:nth-child(3) {
  width: 60%;
}

@keyframes skeletonShimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

@keyframes skeletonPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* 消息空状态 */
.message-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
}

.no-more-messages {
  text-align: center;
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
}

/* 消息气泡 */
.message-bubble {
  display: flex;
  margin-bottom: 16px;
  gap: 12px;
}

.message-bubble.own {
  flex-direction: row-reverse;
}

.message-bubble.other {
  flex-direction: row;
}

/* 消息头像 */
.message-avatar {
  flex-shrink: 0;
  align-self: flex-start;
  /* 改为flex-start使头像显示在左上角 */
}

.message-bubble.own .message-avatar {
  align-self: flex-start;
  /* 自己的消息头像也显示在上方 */
}

/* 消息主体 */
.message-body {
  max-width: 70%;
  min-width: 200px;
  display: flex;
  flex-direction: column;
}

.message-bubble.own .message-body {
  align-items: flex-end;
}

.message-bubble.other .message-body {
  align-items: flex-start;
}

/* 发送者信息 */
.message-sender-info {
  margin-bottom: 4px;
  padding: 0 12px;
}

/* 消息气泡内容 */
.message-bubble-content {
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  word-wrap: break-word;
}

.own-bubble {
  background: #1890ff;
  color: white;
}

.own-bubble .ant-typography {
  color: white;
}

.other-bubble {
  background: #fff;
  color: #262626;
}

/* 气泡尖角 */
.message-bubble-content::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 6px solid transparent;
}

.other-bubble::before {
  left: -11px;
  top: 12px;
  border-right-color: #fff;
}

.own-bubble::before {
  right: -11px;
  top: 12px;
  border-left-color: #1890ff;
}

/* 回复信息 */
.reply-info {
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  margin-bottom: 8px;
  border-left: 3px solid #1890ff;
}

.own-bubble .reply-info {
  background: rgba(255, 255, 255, 0.2);
  border-left-color: white;
}

/* 消息文本 */
.message-text {
  line-height: 1.6;
  margin-bottom: 8px;
}

.message-text:last-child {
  margin-bottom: 0;
}

/* 媒体内容 */
.message-media {
  margin: 8px 0;
}

.media-info {
  flex: 1;
}

/* 消息标签 */
.message-tags,
.message-reactions,
.message-meta-tags {
  margin: 8px 0 4px 0;
}

.message-tags:empty,
.message-reactions:empty,
.message-meta-tags:empty {
  display: none;
}

/* 消息底部 */
.message-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}

.message-time {
  display: flex;
  align-items: center;
}

.view-count {
  display: flex;
  align-items: center;
}

.message-actions {
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.message-bubble:hover .message-actions,
.message-bubble:focus-within .message-actions,
.message-bubble.active .message-actions {
  opacity: 1;
  pointer-events: auto;
}

/* 点击激活状态的持久性 */
.message-bubble.active .message-actions {
  opacity: 1;
  pointer-events: auto;
}

/* 确保在触摸设备上操作按钮可见且可点击 */
@media (hover: none) and (pointer: coarse) {
  .message-actions {
    opacity: 0.8;
    pointer-events: auto;
  }

  .message-bubble.active .message-actions {
    opacity: 1;
  }
}

.action-btn {
  padding: 2px 4px;
  height: auto;
  border: none;
  background: transparent;
}

.action-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.own-bubble .action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 滚动到底部按钮 - 强化显示样式 */
.scroll-to-bottom {
  position: fixed !important;
  bottom: 30px;
  right: 30px;
  z-index: 99999 !important;
  /* 使用最高的z-index */
  pointer-events: all !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  opacity: 1 !important;
  /* 确保始终不透明 */
  background-color: transparent !important;
}

/* 添加明显的外轮廓突出按钮 */
.scroll-to-bottom:before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  z-index: -1;
  box-shadow: 0 0 10px 2px rgba(24, 144, 255, 0.4);
}

.scroll-to-bottom .ant-btn {
  box-shadow: 0 4px 16px rgba(24, 144, 255, 0.6) !important;
  /* 增强阴影 */
  border: none;
  background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
  width: 56px !important;
  height: 56px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  pointer-events: all !important;
  margin: 0 !important;
  padding: 0 !important;
  position: relative;
  z-index: 1;
  transition: transform 0.2s ease;
}

.scroll-to-bottom .ant-btn:hover {
  transform: scale(1.1) !important;
  box-shadow: 0 6px 20px rgba(24, 144, 255, 0.7) !important;
  /* 增强悬浮阴影 */
  background: linear-gradient(135deg, #40a9ff 0%, #69c0ff 100%);
}

/* 增大图标以便于点击 */
.scroll-to-bottom .ant-btn .anticon {
  font-size: 28px !important;
  color: white !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
}

/* 增强徽章样式 */
.scroll-to-bottom .ant-badge-count {
  min-width: 22px !important;
  height: 22px !important;
  padding: 0 6px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 22px !important;
  background-color: #ff4d4f !important;
  box-shadow: 0 0 0 2px white !important;
  top: -5px !important;
  right: -5px !important;
}

/* 移除自动隐藏类，避免按钮消失 */
.scroll-to-bottom.auto-hidden {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

.scroll-to-bottom.auto-hidden:hover {
  opacity: 1 !important;
  transform: none !important;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-3px);
  }

  60% {
    transform: translateY(-1px);
  }
}

/* 针对桌面和移动设备的特定样式 */
@media (min-width: 769px) {
  .scroll-to-bottom {
    bottom: 32px;
    /* 桌面端位置略高 */
    right: 32px;
  }

  .scroll-to-bottom .ant-btn {
    width: 50px;
    /* 桌面端按钮略大 */
    height: 50px;
  }
}

@media (max-width: 768px) {
  .scroll-to-bottom {
    bottom: 80px;
    /* 移动端位置更高，避免与其他控件重叠 */
    right: 20px;
    width: 52px;
    height: 52px;
  }

  .scroll-to-bottom .ant-btn {
    width: 52px !important;
    height: 52px !important;
  }
}

/* 宽屏桌面端适配 - 确保按钮显示 */
@media (min-width: 769px) {
  .scroll-to-bottom {
    display: block !important;
    position: absolute !important;
    z-index: 1001 !important;
    /* 在宽屏下进一步提高层级 */
    bottom: 24px !important;
    right: 24px !important;
  }

  .scroll-to-bottom .ant-btn {
    box-shadow: 0 4px 16px rgba(24, 144, 255, 0.4) !important;
  }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .message-header {
    padding: 12px 16px;
  }

  .header-group-info {
    gap: 8px;
  }

  .group-meta {
    flex-wrap: wrap;
  }

  .group-description {
    display: none;
  }

  .message-list {
    padding: 12px 16px;
  }

  .message-bubble {
    margin-bottom: 12px;
    gap: 8px;
  }

  .message-body {
    max-width: 85%;
    min-width: 150px;
  }

  .message-bubble-content {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .message-sender-info {
    padding: 0 8px;
  }

  .scroll-to-bottom {
    bottom: 16px;
    right: 16px;
  }

  .scroll-to-bottom .ant-btn {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  .message-actions {
    opacity: 1;
  }
}

/* 滚动条样式 */
.message-list::-webkit-scrollbar {
  width: 4px;
}

.message-list::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.message-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 2px;
}

.message-list::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 动画效果 */
.message-bubble {
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 消息高亮效果 */
.message-wrapper.highlighted {
  background: linear-gradient(135deg, #fff7e6 0%, #ffd666 50%, #fff7e6 100%);
  border-radius: 8px;
  margin: 4px 0;
  padding: 4px;
  animation: highlight-pulse 2s ease-in-out;
  transition: background 0.3s ease;
}

@keyframes highlight-pulse {

  0%,
  100% {
    background: linear-gradient(135deg, #fff7e6 0%, #ffd666 50%, #fff7e6 100%);
  }

  50% {
    background: linear-gradient(135deg, #fadb14 0%, #ffc53d 50%, #fadb14 100%);
  }
}

/* 回复消息预览在消息气泡中的样式 */
.message-bubble .message-reply-preview {
  margin: 4px 0 8px 0;
}

.message-bubble.own .message-reply-preview {
  margin-left: auto;
  margin-right: 0;
}

.message-bubble.other .message-reply-preview {
  margin-left: 0;
  margin-right: auto;
}

/* 顶部导航区域 */
.message-area-navigation {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background-color: #fff;
  border-bottom: 1px solid #f0f0f0;
  height: 48px;
  z-index: 10; /* 添加z-index确保在顶层 */
}

.message-area-navigation .back-button {
  margin-right: 12px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.message-area-navigation .back-button:hover {
  background-color: #f0f0f0;
  transform: translateX(-2px);
}

.message-area-navigation .group-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.message-area-navigation .group-title .ant-typography {
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-area-navigation .group-username {
  font-size: 12px;
}

/* 移动端样式调整 */
@media (max-width: 768px) {
  .message-area-navigation {
    padding: 6px 8px;
    height: 40px;
  }

  .message-area-navigation .back-button {
    width: 28px;
    height: 28px;
    margin-right: 8px;
  }

  .message-area-navigation .group-title .ant-typography {
    font-size: 14px;
  }

  .message-area-navigation .group-username {
    font-size: 11px;
  }
}

/* 消息区域容器样式 */
.message-area-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: #f5f5f5;
  position: relative;
}

/* 确保消息列表和输入框布局正确 */
.message-list {
  flex: 1;
  overflow-y: auto !important; /* 强制启用垂直滚动 */
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0; /* 允许flex子元素收缩 */
  max-height: calc(100vh - 150px); /* 设置最大高度，留出输入框空间 */
}