/* MessageHeader 组件样式 */
.message-header-container {
  background: var(--chat-surface, #fff);
  border-bottom: 1px solid var(--chat-border, #e8e8e8);
  box-shadow: 0 12px 24px rgba(76, 111, 255, 0.08);
}

/* 导航区域样式 */
.navigation-section {
  padding: 8px 12px;
  border-bottom: 1px solid var(--chat-border, #f0f0f0);
  background: var(--chat-surface-elevated, #fafafa);
}

.navigation-section .back-button {
  color: var(--chat-primary, #1890ff);
  border: none !important;
  box-shadow: none !important;
  padding: 4px 8px;
}

.navigation-section .back-button:hover {
  color: var(--chat-primary-hover, #40a9ff);
  background: var(--chat-primary-soft, rgba(24, 144, 255, 0.1));
}

/* 群组信息区域 - 紧凑布局 */
.group-info-section {
  padding: 8px 12px; /* 减少内边距 */
  background: transparent;
}

.group-main-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.group-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap; /* 允许换行，适应移动端 */
}

.group-title-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.group-title {
  margin: 0 !important;
  font-size: 16px !important; /* 减小字体大小 */
  line-height: 20px !important; /* 减少行高 */
  color: var(--chat-muted, #262626) !important;
  font-weight: 600 !important;
}

.group-status-tag {
  font-size: 11px !important;
  padding: 2px 6px !important;
  line-height: 16px !important;
  border-radius: 4px !important;
}

.group-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-count {
  font-size: 13px !important;
  line-height: 18px !important;
  display: flex;
  align-items: center;
}

.member-icon {
  margin-right: 4px;
  font-size: 12px;
}

.group-username {
  font-size: 12px !important;
  line-height: 18px !important;
}

/* 置顶消息内联显示样式 */
.pinned-inline {
  flex: 1;
  margin-left: 16px;
  min-width: 0;
  max-width: 400px; /* 限制最大宽度 */
}

.pinned-inline .pinned-content {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--chat-warning-soft, #fff9c4);
  border: 1px solid var(--chat-warning, #ffd54f);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  max-width: 100%;
  transition: all 0.2s ease;
}

.pinned-inline .pinned-content:hover {
  background: var(--chat-warning-soft, #fff8e1);
  border-color: var(--chat-warning, #ffcc02);
}

.pinned-inline .pinned-icon {
  color: var(--chat-warning, #fa8c16);
  flex-shrink: 0;
  font-size: 12px;
}

.pinned-inline .pinned-text {
  color: var(--chat-muted, #666);
  cursor: pointer;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  font-size: 12px;
  line-height: 16px;
}

.pinned-inline .pinned-text:hover {
  color: var(--chat-primary, #1890ff);
}

.pinned-inline .pinned-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.pinned-inline .pinned-nav-btn {
  padding: 0 4px !important;
  width: 20px !important;
  height: 20px !important;
  border-radius: 2px !important;
  border: none !important;
  background: transparent !important;
  color: var(--chat-muted-soft, #999) !important;
  font-size: 10px !important;
  min-width: auto !important;
}

.pinned-inline .pinned-nav-btn:hover {
  background: rgba(250, 173, 20, 0.2) !important;
  color: var(--chat-warning, #fa8c16) !important;
}

.pinned-inline .pinned-count {
  font-size: 10px;
  color: var(--chat-muted-soft, #999);
  margin: 0 2px;
  white-space: nowrap;
}

/* 统计信息区域 - 紧凑显示 */
.stats-section {
  margin-bottom: 2px;
  padding: 2px 12px 4px 12px; /* 显著减少内边距 */
  background: var(--chat-surface-elevated, #fafafa);
  border-top: 1px solid var(--chat-border, #f0f0f0);
  border-bottom: 1px solid var(--chat-border, #f0f0f0);
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between; /* 让切换按钮靠右对齐 */
  gap: 4px;
  margin-bottom: 2px; /* 减少底部间距 */
}

.stats-header-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stats-toggle-btn {
  border: none !important;
  box-shadow: none !important;
  color: var(--chat-muted, #666) !important;
  font-size: 10px !important;
  height: 16px !important;
  width: 16px !important;
  padding: 0 !important;
  min-width: auto !important;
}

.stats-toggle-btn:hover {
  color: var(--chat-primary, #1890ff) !important;
  background: var(--chat-primary-soft, rgba(24, 144, 255, 0.1)) !important;
}

.stats-icon {
  font-size: 12px;
  color: var(--chat-muted, #666);
}

.stats-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--chat-muted, #666);
}

.stats-loading {
  text-align: center;
  padding: 12px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); /* 减小最小宽度 */
  gap: 2px; /* 减少间距 */
  margin-bottom: 0; /* 去除底部间距 */
}

.stat-item {
  text-align: center;
  min-width: 50px; /* 减小最小宽度 */
  padding: 0 1px; /* 减少内边距 */
}

.stat-value {
  font-size: 12px; /* 减小字体大小 */
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 0; /* 去除底部间距 */
}
.stat-total { color: var(--chat-primary, #1890ff); }
.stat-text { color: var(--chat-success, #52c41a); }
.stat-media { color: var(--chat-warning, #faad14); }
.stat-photo { color: #13c2c2; }
.stat-video { color: #722ed1; }
.stat-forwarded { color: var(--chat-warning, #fa8c16); }

.stat-label {
  font-size: 9px; /* 减小标签字体 */
  color: var(--chat-muted-soft, #8c8c8c);
  font-weight: 500;
  line-height: 1.1; /* 减少行高 */
}

/* 置顶消息区域 */
.pinned-section {
  margin-bottom: 6px;
  padding: 8px 16px;
  background: var(--chat-warning-soft, #fffbf0);
  border-top: 1px solid var(--chat-warning, #faad14);
  border-bottom: 1px solid var(--chat-warning, #faad14);
}

.pinned-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pinned-icon {
  color: var(--chat-warning, #faad14);
  font-size: 12px;
  flex-shrink: 0;
}

.pinned-message {
  flex: 1;
  min-width: 0;
}

.pinned-label {
  color: var(--chat-warning, #faad14) !important;
  font-size: 11px !important;
  display: block;
  margin-bottom: 2px;
}

.pinned-text {
  font-size: 11px;
  color: var(--chat-muted, #333);
  line-height: 1.4;
}

.pinned-text .ant-typography {
  font-size: 11px !important;
  color: var(--chat-muted, #333) !important;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pinned-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pinned-nav-btn {
  font-size: 9px !important;
  padding: 2px 4px !important;
  height: auto !important;
  border: none !important;
  color: var(--chat-muted, #666) !important;
}

.pinned-nav-btn:hover {
  color: var(--chat-warning, #faad14) !important;
  background: rgba(250, 173, 20, 0.1) !important;
}

.pinned-counter {
  font-size: 9px !important;
  color: var(--chat-muted-soft, #999) !important;
  margin: 0 2px !important;
}

.pinned-jump-btn {
  font-size: 9px !important;
  padding: 2px 6px !important;
  height: auto !important;
  border: none !important;
  color: var(--chat-warning, #faad14) !important;
  background: rgba(250, 173, 20, 0.1) !important;
  border-radius: 3px !important;
}

.pinned-jump-btn:hover {
  color: #fff !important;
  background: var(--chat-warning, #faad14) !important;
}

/* 移动端适配 - 进一步紧凑化 */
@media (max-width: 768px) {
  .group-info-section {
    padding: 6px 10px; /* 减少移动端内边距 */
  }
  
  .group-main-info {
    gap: 8px; /* 减少间距 */
  }
  
  .group-title {
    font-size: 14px !important; /* 减小字体 */
    line-height: 18px !important; /* 减少行高 */
  }
  
  .group-meta-row {
    gap: 6px; /* 减少间距 */
    flex-wrap: wrap;
  }
  
  .member-count {
    font-size: 11px !important; /* 减小字体 */
  }
  
  .group-username {
    font-size: 10px !important; /* 减小字体 */
  }
  
  /* 移动端置顶消息适配 */
  .group-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .pinned-inline {
    margin-left: 0;
    width: 100%;
    max-width: none;
  }
  
  .pinned-inline .pinned-content {
    padding: 3px 6px;
    font-size: 11px;
  }
  
  .pinned-inline .pinned-text {
    font-size: 11px;
    line-height: 14px;
  }
  
  .pinned-inline .pinned-nav-btn {
    width: 18px !important;
    height: 18px !important;
    font-size: 9px !important;
  }
  
  .pinned-inline .pinned-count {
    font-size: 9px;
  }
  
  .stats-section {
    padding: 2px 10px 3px 10px; /* 显著减少移动端统计区域内边距 */
  }
  
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); /* 减小移动端最小宽度 */
    gap: 1px; /* 减少移动端间距 */
    margin-bottom: 0; /* 去除底部间距 */
  }
  
  .stat-item {
    text-align: center;
    min-width: 45px; /* 减小移动端最小宽度 */
    padding: 0 1px; /* 减少移动端内边距 */
  }
  
  .stat-value {
    font-size: 11px; /* 减小移动端数值字体 */
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 0; /* 去除移动端底部间距 */
  }
  
  .stat-label {
    font-size: 8px; /* 减小移动端标签字体 */
    color: var(--chat-muted-soft, #8c8c8c);
    font-weight: 500;
    line-height: 1.1; /* 减少移动端行高 */
  }
  
  .pinned-section {
    padding: 6px 12px;
  }
  
  .pinned-content {
    gap: 6px;
  }
  
  .pinned-text .ant-typography {
    max-width: 150px;
  }
}

/* 媒体时长统计样式 */
.stats-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-duration-section {
  margin-top: 8px;
  padding: 6px 8px;
  background: var(--chat-accent-soft, #f8f9fa);
  border-radius: 4px;
  border: 1px solid var(--chat-border, #e9ecef);
}

.media-duration-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.duration-icon {
  font-size: 12px;
  color: var(--chat-danger, #f5222d);
}

.duration-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--chat-muted, #666);
}

.media-duration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 4px;
}

.duration-item {
  text-align: center;
  min-width: 50px;
  padding: 2px 4px;
}

.duration-item.total-duration {
  border: 1px solid var(--chat-danger, #ffcdd2);
  border-radius: 4px;
  background: var(--chat-danger-soft, #ffebee);
}

.duration-value {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 2px;
}
.duration-total { color: var(--chat-danger, #f5222d); }
.duration-voice { color: #722ed1; }
.duration-audio { color: var(--chat-warning, #faad14); }
.duration-video { color: #52c41a; }

.duration-label {
  font-size: 9px;
  color: var(--chat-muted-soft, #8c8c8c);
  font-weight: 500;
  line-height: 1.1;
}

/* 移动端媒体时长样式 */
@media (max-width: 768px) {
  .media-duration-section {
    margin-top: 6px;
    padding: 4px 6px;
  }
  
  .media-duration-grid {
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 2px;
  }
  
  .duration-item {
    min-width: 40px;
    padding: 1px 2px;
  }
  
  .duration-value {
    font-size: 11px;
  }
  
  .duration-label {
    font-size: 8px;
  }
}

/* 过渡动画 */
.stats-section,
.pinned-section {
  transition: all 0.3s ease;
}

.stats-section:hover,
.pinned-section:hover {
  background: var(--chat-accent-soft, #f8f8f8);
}

.pinned-section:hover {
  background: var(--chat-warning-soft, #fff8e8);
}

/* 响应式网格调整 */
@media (max-width: 1200px) {
  .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 4px;
  margin-bottom: 2px;
}
}

@media (max-width: 768px) {
  .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 4px;
  margin-bottom: 2px;
}
}

@media (max-width: 480px) {
  .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 4px;
  margin-bottom: 2px;
}
  
  .stat-item {
  text-align: center;
  min-width: 60px;
  padding: 0 2px;
}
  
  .stat-value {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 1px;
}
  
  .stat-label {
  font-size: 10px;
  color: var(--chat-muted-soft, #8c8c8c);
  font-weight: 500;
  line-height: 1.2;
}
}
