/**
 * 语音输入按钮样式
 */

/* 语音按钮基础样式 */
.voice-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #667eea;
    overflow: hidden;
    margin-left: auto;
}

.voice-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

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

/* 激活状态样式 (连接中或录音中) */
.voice-btn.voice-active {
    background: #3b82f6 !important;
    /* 鲜艳的蓝色 */
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    color: white !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: scale(1.05);
    /* 稍微放大一点点 */
}

.voice-btn.voice-active i {
    color: white !important;
}

.voice-btn .voice-icon {
    width: 20px;
    height: 20px;
    transition: all 0.3s ease;
}

/* 连接中状态 */
.voice-btn.voice-connecting {
    pointer-events: none;
}

.voice-btn.voice-connecting i {
    font-size: 18px;
}

/* 录音中状态 */
.voice-btn.voice-recording {
    background: #3b82f6 !important;
    /* 修改为蓝色，与激活态保持一致或更深 */
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.2);
    /* 增加类似图片中的外延圈效果 */
}

/* 录音中脉冲动画 */
@keyframes voice-btn-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(59, 130, 246, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.voice-btn.voice-recording {
    animation: voice-btn-pulse 1.5s infinite;
}

/* 语音图标波形样式 */
.voice-icon-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 16px;
    z-index: 2;
}

.voice-bar {
    width: 2px;
    background-color: white;
    border-radius: 1px;
    transition: all 0.2s ease;
}

/* 基础高度 */
.voice-bar:nth-child(1),
.voice-bar:nth-child(5) {
    height: 6px;
}

.voice-bar:nth-child(2),
.voice-bar:nth-child(4) {
    height: 11px;
}

.voice-bar:nth-child(3) {
    height: 16px;
}

/* 录音中的波动动画 */
.voice-btn.voice-recording .voice-bar {
    animation: voice-bar-dance 0.7s infinite ease-in-out;
}

.voice-btn.voice-recording .voice-bar:nth-child(1) {
    animation-delay: 0.0s;
}

.voice-btn.voice-recording .voice-bar:nth-child(2) {
    animation-delay: 0.1s;
}

.voice-btn.voice-recording .voice-bar:nth-child(3) {
    animation-delay: 0.2s;
}

.voice-btn.voice-recording .voice-bar:nth-child(4) {
    animation-delay: 0.1s;
}

.voice-btn.voice-recording .voice-bar:nth-child(5) {
    animation-delay: 0.0s;
}

@keyframes voice-bar-dance {

    0%,
    100% {
        height: 6px;
    }

    50% {
        height: 16px;
    }
}

/* 麦克风图标脉冲动画 */
.voice-pulse {
    animation: pulse-scale 0.8s ease-in-out infinite;
}

@keyframes pulse-scale {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* 错误状态 */
.voice-btn.voice-error {
    background: rgba(255, 107, 107, 0.2);
}

.voice-btn.voice-error i {
    color: #ff6b6b;
}

/* 语音输入模态框 */
.voice-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.voice-modal.active {
    opacity: 1;
    visibility: visible;
}

.voice-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.voice-modal.active .voice-modal-content {
    transform: scale(1);
}

/* 语音波形显示 */
.voice-waveform {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    height: 60px;
    margin: 20px 0;
}

.voice-waveform .bar {
    width: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    animation: wave 0.5s ease-in-out infinite;
}

.voice-waveform .bar:nth-child(1) {
    height: 20px;
    animation-delay: 0s;
}

.voice-waveform .bar:nth-child(2) {
    height: 35px;
    animation-delay: 0.1s;
}

.voice-waveform .bar:nth-child(3) {
    height: 50px;
    animation-delay: 0.2s;
}

.voice-waveform .bar:nth-child(4) {
    height: 35px;
    animation-delay: 0.3s;
}

.voice-waveform .bar:nth-child(5) {
    height: 20px;
    animation-delay: 0.4s;
}

.voice-waveform .bar:nth-child(6) {
    height: 40px;
    animation-delay: 0.2s;
}

.voice-waveform .bar:nth-child(7) {
    height: 25px;
    animation-delay: 0.3s;
}

@keyframes wave {

    0%,
    100% {
        transform: scaleY(0.5);
    }

    50% {
        transform: scaleY(1);
    }
}

/* 语音状态文字 */
.voice-status {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

.voice-status.recording {
    color: #ff6b6b;
}

/* 识别结果预览 */
.voice-result-preview {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    min-height: 50px;
    max-height: 150px;
    overflow-y: auto;
    text-align: left;
    font-size: 14px;
    line-height: 1.6;
}

.voice-result-preview .final {
    color: #333;
}

.voice-result-preview .interim {
    color: #999;
    font-style: italic;
}

/* 语音控制按钮 */
.voice-control-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.voice-control-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.4);
}

.voice-control-btn.stop {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 提示文字 */
.voice-tip {
    font-size: 12px;
    color: #999;
    margin-top: 15px;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .voice-modal-content {
        width: 90%;
        padding: 30px 20px;
    }

    .voice-control-btn {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}

/* ========================================
   TTS 语音播报波形动画
   ======================================== */

/* TTS 播放中状态 */
.message-action-btn.tts-playing {
    background: #3b82f6 !important;
    /* 修改为蓝色背景 */
    position: relative;
    padding: 8px;
    color: white !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.message-action-btn.tts-playing i {
    /* 播放时隐藏原始图标，避免与波形动画冲突 */
    opacity: 0;
}

/* TTS 波形容器 */
/* TTS 波形容器 */
.tts-waveform-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
    width: 24px;
    height: 18px;
    pointer-events: none;
}

/* TTS 波形条 - 增强其高度变化和颜色对比 */
/* TTS 波形条 - 增强其高度变化和律动感 */
.tts-waveform-container .bar {
    width: 2.5px;
    background: white;
    /* 蓝色背景下使用白色波形条 */
    border-radius: 2px;
    animation: tts-wave-dynamic 0.8s ease-in-out infinite;
    transform-origin: center;
    /* 采用中心缩放，模拟声波向两端扩散 */
}

/* 精确控制每一根波形条的基础高度和动画延迟，营造自然的节奏感 */
.tts-waveform-container .bar:nth-child(1) {
    height: 6px;
    animation-delay: -0.6s;
}

.tts-waveform-container .bar:nth-child(2) {
    height: 13px;
    animation-delay: -0.4s;
}

.tts-waveform-container .bar:nth-child(3) {
    height: 9px;
    animation-delay: -0.2s;
}

.tts-waveform-container .bar:nth-child(4) {
    height: 16px;
    animation-delay: -0.5s;
}

.tts-waveform-container .bar:nth-child(5) {
    height: 7px;
    animation-delay: -0.3s;
}

@keyframes tts-wave {

    0%,
    100% {
        transform: scaleY(0.5);
        opacity: 0.7;
    }

    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* TTS 播放时隐藏麦克风图标 */
.message-action-btn.tts-playing i.fa-microphone {
    opacity: 0;
}

/* TTS 按钮脉冲效果 */
.message-action-btn.tts-playing {
    animation: tts-btn-pulse 1.5s ease-in-out infinite;
}

/* 增强版：喇叭震动动画 */
@keyframes tts-speaker-vibrate {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.15);
        opacity: 0.8;
    }
}

/* 增强版：动态波形动画 */
@keyframes tts-wave-dynamic {

    0%,
    100% {
        transform: scaleY(0.4);
        opacity: 0.5;
    }

    50% {
        transform: scaleY(1.2);
        opacity: 1;
    }
}

@keyframes tts-btn-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(59, 130, 246, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}