/* ============================================================
 * 帧叙AI助手 - 语音输入模块 CSS
 * ============================================================ */

/* ========== 双语音切换器 ========== */
.voice-switcher {
    max-width: 860px;
    margin: 0 auto 8px;
    display: flex;
    justify-content: center;
}

.voice-switcher-inner {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.voice-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: none;
    border-radius: 16px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.voice-mode-btn:hover:not(.disabled):not(.active) {
    background: #f3f4f6;
    color: var(--text-primary);
}

.voice-mode-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.3);
}

.voice-mode-btn.active svg {
    stroke: #fff;
}

.voice-mode-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    color: var(--text-muted);
}

.voice-mode-btn svg {
    flex-shrink: 0;
}

/* ========== 麦克风按钮（录音状态） ========== */
.btn-mic {
    padding: 8px;
}

.btn-mic.recording {
    color: #fff;
    background: var(--error);
    animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ========== 录音指示条 ========== */
.voice-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 860px;
    margin: 0 auto 8px;
    padding: 8px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #991b1b;
}

.voice-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--error);
    animation: voiceDot 1s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes voiceDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* ========== 音量可视化条 ========== */
.voice-volume-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 860px;
    margin: 0 auto 8px;
    padding: 8px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.voice-volume-label {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 30px;
}

.voice-volume-track {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.voice-volume-fill {
    height: 100%;
    width: 0%;
    background: #22c55e;
    border-radius: 4px;
    transition: width 0.1s ease, background 0.2s ease;
}

.voice-volume-value {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ========== 错误弹窗 ========== */
.voice-error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
}

.voice-error-dialog {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 28px 24px 20px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: voiceErrorIn 0.2s ease;
}

@keyframes voiceErrorIn {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.voice-error-icon {
    margin-bottom: 16px;
}

.voice-error-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
}

.voice-error-message {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.7;
    margin-bottom: 20px;
    text-align: left;
    white-space: pre-wrap;
}

.voice-error-close-btn {
    padding: 8px 28px;
    border: none;
    border-radius: 8px;
    background: var(--primary, #6366f1);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    font-family: inherit;
}

.voice-error-close-btn:hover {
    opacity: 0.85;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .voice-switcher-inner {
        width: 100%;
        justify-content: space-between;
    }
    .voice-mode-btn {
        flex: 1;
        justify-content: center;
        padding: 6px 8px;
        font-size: 11px;
    }
    .voice-mode-btn span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .voice-volume-bar {
        padding: 6px 12px;
    }
    .voice-error-dialog {
        padding: 20px 16px 16px;
    }
}
