/* ================================================================
 * 语音输入功能样式
 * ================================================================ */

/* 语音输入包装容器 */
.voice-input-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.voice-textarea-wrapper {
  display: block;
}

/* 麦克风按钮 */
.voice-input-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  background: transparent;
  color: #6c757d;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 5;
}

.voice-input-btn:hover {
  background: rgba(74, 95, 193, 0.1);
  color: #4A5FC1;
}

.voice-input-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.voice-input-btn i {
  font-size: 16px;
}

/* 文本域的麦克风按钮 */
.voice-textarea-btn {
  top: 8px;
  transform: none;
}

.voice-textarea-btn:active {
  transform: scale(0.95);
}

/* 录音中状态 */
.voice-input-btn.recording {
  background: #dc3545;
  color: #fff;
  animation: voicePulse 1.5s ease-in-out infinite;
}

.voice-input-btn.recording:hover {
  background: #c82333;
  color: #fff;
}

/* 录音脉冲动画 */
.recording-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(220, 53, 69, 0.4);
  animation: voiceRipple 1.5s ease-out infinite;
  z-index: -1;
}

@keyframes voicePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(220, 53, 69, 0);
  }
}

@keyframes voiceRipple {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

/* 提示 Toast */
.voice-input-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(33, 37, 41, 0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 80%;
  text-align: center;
}

.voice-input-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 输入框聚焦时的样式优化 */
.voice-input-wrapper input:focus,
.voice-input-wrapper textarea:focus {
  border-color: #4A5FC1;
  box-shadow: 0 0 0 0.2rem rgba(74, 95, 193, 0.15);
}

/* 深色模式适配 */
[data-bs-theme="dark"] .voice-input-btn {
  color: #adb5bd;
}

[data-bs-theme="dark"] .voice-input-btn:hover {
  background: rgba(74, 95, 193, 0.2);
  color: #6B7FD7;
}

[data-bs-theme="dark"] .voice-input-toast {
  background: rgba(52, 58, 64, 0.95);
}

/* 顶栏语音输入开关按钮 */
#voiceInputToggle {
  transition: all 0.2s ease;
}

#voiceInputToggle.voice-toggle-active {
  background: rgba(74, 95, 193, 0.1);
}

#voiceInputToggle:hover {
  background: rgba(74, 95, 193, 0.15);
}

[data-bs-theme="dark"] #voiceInputToggle.voice-toggle-active {
  background: rgba(74, 95, 193, 0.2);
}

[data-bs-theme="dark"] #voiceInputToggle:hover {
  background: rgba(74, 95, 193, 0.25);
}
