/* AI消息名称 */
.ai-name {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

/* 消息气泡 */
.message {
  display: flex;
  margin: var(--spacing-sm) var(--spacing-lg);
  animation: fadeIn 0.3s ease;
  gap: var(--spacing-sm);
  align-items: flex-start;
}

.message.user {
  justify-content: flex-end;
}

.message.ai {
  justify-content: flex-start;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 4px;
}

.message-content-wrapper {
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 44px);
}

.bubble {
  max-width: var(--max-bubble-width);
  padding: var(--bubble-padding);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  word-wrap: break-word;
  position: relative;
}

.bubble.user {
  background: var(--user-bubble);
  color: white;
  border-bottom-right-radius: 4px;
}

.bubble.ai {
  background: var(--ai-bubble);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.bubble p {
  margin: 0;
  line-height: 1.5;
  font-size: 16px;
}

.bubble p + p {
  margin-top: var(--spacing-sm);
}

.bubble ul {
  margin: var(--spacing-sm) 0;
  padding-left: var(--spacing-lg);
  list-style: none;
}

.bubble ul li {
  margin: var(--spacing-xs) 0;
  line-height: 1.5;
}

.bubble .hint {
  font-size: 14px;
  opacity: 0.7;
  margin-top: var(--spacing-sm);
}

/* 欢迎消息 */
.welcome-message {
  margin-top: var(--spacing-xl);
}

/* 图片消息 */
.bubble-image {
  margin-top: var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.bubble-image img {
  width: 100%;
  display: block;
}

.bubble-image:active {
  transform: scale(0.98);
}

.bubble-image.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 用户消息中的图片 */
.user-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.user-image-thumbnail {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 视频消息 */
.bubble-video {
  margin-top: var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  position: relative;
}

.bubble-video video {
  width: 100%;
  display: block;
}

.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  backdrop-filter: blur(10px);
}

/* 加载状态 */
.bubble-loading {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.loading-text {
  font-size: 15px;
  color: var(--text-secondary);
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: var(--spacing-xs);
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s ease;
  border-radius: 2px;
}

.loading-spinner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.loading-dot {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

/* 时间戳 */
.message-time {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: var(--spacing-xs);
  text-align: right;
}

.message.ai .message-time {
  text-align: left;
}

/* 动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}
