/* 用户消息气泡样式 */
.user-message-bubble-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px; /* 增加底部间距，与AI消息保持一致 */
  opacity: 1;
  animation: fadeInUp 0.3s ease forwards;
}

.user-message-bubble-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 80%;
  min-width: 0;
  gap: 8px; /* 增加间距 */
}

.user-message-bubble {
  background: #ffffff;
  color: #333333;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  width: 100%;
  /* 使用Source Sans Pro作为聊天内容字体 */
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  font-weight: 400;
  line-height: 1.5;
}

.user-message-bubble::after {
  content: '';
  position: absolute;
  top: 12px;
  right: -6px;
  width: 0;
  height: 0;
  border-left: 6px solid #ffffff;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  filter: drop-shadow(1px 0 1px rgba(0, 0, 0, 0.1));
}

.user-message-content {
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
  /* 使用Source Sans Pro作为聊天内容字体 */
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  color: #333333;
}

.user-message-edit-container {
  background: white;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  padding: 8px;
  color: #333;
}

.user-message-edit-textarea {
  border: none;
  box-shadow: none;
  padding: 0;
  resize: none;
  /* 使用Source Sans Pro作为聊天内容字体 */
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

.user-message-edit-textarea:focus {
  border: none;
  box-shadow: none;
}

.user-message-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

/* 新的工具栏样式 - 参考AssistantMessageBubble */
.user-message-toolbar {
  display: flex;
  justify-content: flex-end; /* 右对齐，因为是用户消息 */
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 4px 8px;
  margin-right: 0;
  min-height: 32px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(229, 231, 235, 0.6);
  gap: 4px;
}

.user-message-bubble-container:hover .user-message-toolbar {
  opacity: 1;
}

.user-message-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* 统一的按钮样式 - 参考AssistantMessageBubble */
.user-message-action-btn {
  font-size: 14px;
  height: 28px;
  width: 28px;
  padding: 0;
  color: #6b7280;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  cursor: pointer;
  /* 使用Inter作为UI元素字体 */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

.user-message-action-btn:hover {
  color: #374151;
  background-color: rgba(107, 114, 128, 0.1);
  transform: translateY(-1px);
}

.user-message-action-btn:active {
  transform: translateY(0);
}

.user-message-action-btn:focus {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  outline: none;
}

/* 编辑按钮特殊样式 */
.user-message-action-btn:first-child:hover {
  color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.1);
}

/* 自定义 Tooltip 样式 - 参考AssistantMessageBubble */
.user-message-tooltip .ant-tooltip-inner {
  background-color: #1f2937;
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 12px;
  /* 使用Inter作为UI元素字体 */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  font-weight: 500;
}

.user-message-tooltip .ant-tooltip-arrow {
  border-top-color: #1f2937;
}

.user-message-tooltip .ant-tooltip-arrow::before {
  border-top-color: #1f2937;
}

/* 编辑面板样式 - 更宽的横向长条状 */
.user-message-edit-panel {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid #e5e7eb;
  padding: 12px 32px; /* 增加左右内边距，让面板更宽 */
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  margin: 8px 0;
  width: 100%;
  min-width: 800px; /* 设置最小宽度，确保足够宽 */
  min-height: 40px;
}

.user-message-edit-panel:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.06);
  border-color: #d1d5db;
}

.user-message-edit-panel:focus-within {
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.12), 0 1px 4px rgba(59, 130, 246, 0.08);
  border-color: #3b82f6;
}

/* 输入区域样式 - 极简垂直间距 */
.user-message-edit-input-section {
  margin-bottom: 8px; /* 进一步减少底部间距 */
}

.user-message-edit-input {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 4px !important;
  padding: 6px 12px !important; /* 进一步减少内边距 */
  font-size: 14px !important;
  line-height: 1.3 !important; /* 进一步减少行高 */
  resize: none !important;
  min-height: 32px !important; /* 减少最小高度 */
  /* 使用Source Sans Pro作为聊天内容字体 */
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif !important;
}

.user-message-edit-input:focus {
  box-shadow: none !important;
  border-color: transparent !important;
}

.user-message-edit-input::placeholder {
  color: #9ca3af !important;
  font-size: 14px !important;
}

/* 控制面板样式 - 调整右边距 */
.user-message-edit-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: nowrap;
  height: 28px;
  padding: 0 4px; /* 减少左右内边距 */
}

.edit-controls-left {
  display: flex;
  align-items: center;
  gap: 20px; /* 增加左侧元素间距 */
  flex: 1;
  min-width: 0;
}

.edit-controls-right {
  display: flex;
  align-items: center;
  gap: 8px; /* 增加按钮间距，防止挤在一起 */
  flex-shrink: 0;
  margin-left: auto; /* 确保靠右对齐 */
  padding-right: 0; /* 移除额外的右边距 */
}

/* 字符计数样式 */
.edit-char-count {
  font-size: 12px !important;
  color: #9ca3af !important;
  /* 使用Inter作为UI元素字体 */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif !important;
}

/* 编辑按钮样式 - 更扁平紧凑 */
.edit-cancel-btn {
  background: #ffffff !important;
  border: 1px solid #d1d5db !important;
  color: #374151 !important;
  border-radius: 6px !important;
  height: 32px !important; /* 稍微增加高度 */
  padding: 0 16px !important; /* 增加内边距 */
  font-weight: 500 !important;
  font-size: 13px !important;
  transition: all 0.2s ease !important;
  min-width: 64px !important; /* 设置最小宽度 */
  /* 使用Inter作为UI元素字体 */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif !important;
}

.edit-cancel-btn:hover {
  background: #f9fafb !important;
  border-color: #9ca3af !important;
  color: #111827 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* 保存按钮样式 - 黑底白字 */
.edit-save-btn {
  background: #111827 !important;
  border: 1px solid #111827 !important;
  color: #ffffff !important;
  border-radius: 6px !important;
  height: 32px !important; /* 稍微增加高度 */
  padding: 0 20px !important; /* 增加内边距 */
  font-weight: 500 !important;
  font-size: 13px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  transition: all 0.2s ease !important;
  min-width: 72px !important; /* 设置最小宽度 */
  /* 使用Inter作为UI元素字体 */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif !important;
}

.edit-save-btn:hover {
  background: #1f2937 !important;
  border-color: #1f2937 !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2) !important;
}

.edit-save-btn:active {
  transform: translateY(0) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.edit-save-btn:disabled {
  background: #e5e7eb !important;
  border-color: #e5e7eb !important;
  color: #9ca3af !important;
  transform: none !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
}

/* 用户消息附件样式 */
.user-message-attachments {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.user-attachment-item:hover {
  background: #f1f5f9;
  border-color: #d1d5db;
}

.attachment-icon {
  color: #6b7280;
  font-size: 14px;
  flex-shrink: 0;
}

.attachment-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.attachment-size {
  font-size: 11px;
  color: #9ca3af;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .user-message-edit-panel {
    padding: 10px 20px;
    border-radius: 6px;
    min-height: 56px;
    min-width: 350px; /* 减少但仍保持足够宽度 */
  }
  
  .user-message-edit-controls {
    gap: 24px;
    height: 30px;
  }
  
  .edit-controls-right {
    gap: 6px;
  }
  
  .edit-cancel-btn,
  .edit-save-btn {
    height: 30px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 480px) {
  .user-message-edit-panel {
    padding: 8px 16px;
    min-height: 52px;
    min-width: 300px; /* 小屏幕仍保持最小宽度 */
  }
  
  .user-message-edit-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    height: auto;
    padding: 0;
  }
  
  .edit-controls-left {
    justify-content: center;
  }
  
  .edit-controls-right {
    width: 100%;
    justify-content: flex-end; /* 保持靠右对齐 */
    margin-left: 0;
  }
}

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