/* ========== MiniMax 语音气泡样式 ========== */

.voice-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 18px;
  min-width: 160px;
  max-width: 240px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  user-select: none;
}

.voice-bubble:active {
  transform: scale(0.97);
}

/* 左侧（对方）语音气泡 */
.msg-item.left .voice-bubble {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 右侧（自己）语音气泡 */
.msg-item.right .voice-bubble {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 播放按钮 */
.voice-bubble-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.msg-item.left .voice-bubble-play-btn {
  background: #e0e0e0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.msg-item.right .voice-bubble-play-btn {
  background: #e0e0e0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.voice-bubble-play-btn svg {
  width: 14px;
  height: 14px;
  fill: #666;
}

/* 波形动画区域 */
.voice-bubble-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  flex: 1;
}

.voice-bubble-waveform .wave-bar {
  width: 3px;
  border-radius: 2px;
  transition: height 0.15s ease;
}

.msg-item.left .voice-bubble-waveform .wave-bar {
  background: #bbb;
}

.msg-item.right .voice-bubble-waveform .wave-bar {
  background: #bbb;
}

/* 静态波形 */
.voice-bubble-waveform.static .wave-bar {
  animation: none;
}

/* 播放中波形动画 */
.voice-bubble-waveform.playing .wave-bar {
  animation: voiceWave 0.8s ease-in-out infinite alternate;
}

.voice-bubble-waveform.playing .wave-bar:nth-child(1) { animation-delay: 0s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(4) { animation-delay: 0.15s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(5) { animation-delay: 0.25s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(6) { animation-delay: 0.05s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(7) { animation-delay: 0.3s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(8) { animation-delay: 0.12s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(9) { animation-delay: 0.22s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(10) { animation-delay: 0.08s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(11) { animation-delay: 0.18s; }
.voice-bubble-waveform.playing .wave-bar:nth-child(12) { animation-delay: 0.28s; }

@keyframes voiceWave {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1); }
}

/* 时长显示 */
.voice-bubble-duration {
  font-size: 11px;
  opacity: 0.7;
  white-space: nowrap;
  min-width: 28px;
  text-align: right;
}

.msg-item.left .voice-bubble-duration {
  color: #666;
}

.msg-item.right .voice-bubble-duration {
  color: #666;
}

/* 语音加载中状态 */
.voice-bubble.loading {
  opacity: 0.7;
}

.voice-bubble.loading .voice-bubble-play-btn {
  animation: voicePulse 1.2s ease-in-out infinite;
}

@keyframes voicePulse {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* 语音气泡下方的文字（可展开） */
.voice-bubble-text-toggle {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
}

.voice-bubble-text-toggle:hover {
  color: #7c5cbf;
}

.voice-bubble-text-content {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
  padding: 6px 10px;
  background: none;
  border-radius: 0;
  line-height: 1.5;
  display: none;
}

.voice-bubble-text-content.show {
  display: block;
}

/* 语音消息容器去掉外层气泡框 */
.msg-bubble.voice-msg-container {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* 深色主题适配 */
.theme-dark .msg-item.left .voice-bubble {
  background: linear-gradient(135deg, rgba(60, 50, 80, 0.9), rgba(50, 40, 70, 0.85));
  border-color: rgba(120, 100, 160, 0.3);
}

.theme-dark .msg-item.left .voice-bubble-duration {
  color: rgba(255, 255, 255, 0.6);
}

.theme-dark .voice-bubble-text-content {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
}

.theme-dark .voice-bubble-text-toggle {
  color: rgba(255, 255, 255, 0.5);
}
