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

/* 语音输入按钮 */
.voice-input-btn {
    margin-left: 8px;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.voice-input-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.voice-input-btn.active {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    animation: voice-pulse 1s infinite;
}

.voice-input-btn.active i {
    animation: mic-shake 0.5s infinite;
}

@keyframes voice-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
}

@keyframes mic-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* 语音输入状态指示器 */
.voice-input-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 30px 50px;
    border-radius: 16px;
    text-align: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.voice-input-indicator p {
    color: white;
    margin-top: 15px;
    font-size: 14px;
}

/* 音波动画 */
.voice-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
}

.voice-wave span {
    display: block;
    width: 4px;
    background: linear-gradient(to top, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.voice-wave span:nth-child(1) { animation-delay: 0s; height: 20%; }
.voice-wave span:nth-child(2) { animation-delay: 0.1s; height: 40%; }
.voice-wave span:nth-child(3) { animation-delay: 0.2s; height: 60%; }
.voice-wave span:nth-child(4) { animation-delay: 0.3s; height: 40%; }
.voice-wave span:nth-child(5) { animation-delay: 0.4s; height: 20%; }

@keyframes wave {
    0%, 100% {
        transform: scaleY(0.5);
        opacity: 0.5;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* 语音输入提示 */
.voice-input-tip {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9998;
    max-width: 400px;
}

/* 语音识别结果预览 */
.voice-result-preview {
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
    font-size: 14px;
}

.voice-result-preview .parsed-data {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.voice-result-preview .data-tag {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

/* 输入框语音按钮组合 */
.input-with-voice {
    display: flex;
    align-items: center;
}

.input-with-voice input {
    flex: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .voice-input-btn {
        padding: 0.5rem;
    }
    
    .voice-input-indicator {
        padding: 20px 30px;
        width: 80%;
        max-width: 300px;
    }
    
    .voice-wave {
        height: 30px;
    }
    
    .voice-wave span {
        width: 3px;
    }
}

/* 房间表单中的语音输入 */
.room-form .voice-input-wrapper,
.dimension-group .voice-input-wrapper {
    position: relative;
}

.room-form .voice-input-btn,
.dimension-group .voice-input-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 0.25rem 0.5rem;
    font-size: 12px;
}

/* 语音识别置信度指示 */
.confidence-bar {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.confidence-bar .fill {
    height: 100%;
    background: linear-gradient(to right, #28a745, #20c997);
    transition: width 0.3s ease;
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .voice-result-preview {
        background: #2d333b;
        border-color: #444c56;
        color: #adbac7;
    }
}
