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

/* 录音按钮 */
.voice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--color-border, #e0e0e0);
    background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 100%);
    border-radius: var(--radius-md, 12px);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--color-text-secondary, #666);
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08));
    position: relative;
    overflow: hidden;
}

.voice-btn svg {
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.voice-btn:hover {
    background: linear-gradient(135deg, #f0f0f0 0%, #e8e8e8 100%);
    border-color: var(--color-accent, #7c5c3a);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.12));
    color: var(--color-accent, #7c5c3a);
}

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

/* 录音中状态 */
.voice-btn.recording {
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    border-color: #cc0000;
    color: #fff;
    animation: pulse 1.5s ease-in-out infinite;
}

.voice-btn.recording svg {
    animation: mic-pulse 1s ease-in-out infinite;
}

/* 脉冲动画 */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
    }
}

@keyframes mic-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 禁用状态 */
.voice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f0f0f0;
}

.voice-btn:disabled:hover {
    transform: none;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08));
}

/* 语音状态提示 */
.voice-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 1px solid #ffb74d;
    border-radius: var(--radius-md, 12px);
    font-size: 14px;
    color: #e65100;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 语音指示器（动态波形） */
.voice-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff5722;
    animation: voice-wave 1.2s ease-in-out infinite;
}

@keyframes voice-wave {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

.voice-text {
    font-weight: 500;
}

/* 识别中状态 */
.voice-status.recognizing {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #42a5f5;
    color: #1565c0;
}

.voice-status.recognizing .voice-indicator {
    background: #2196f3;
    animation: recognizing-spin 1s linear infinite;
}

@keyframes recognizing-spin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* 错误状态 */
.voice-status.error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-color: #ef5350;
    color: #c62828;
}

.voice-status.error .voice-indicator {
    background: #f44336;
    animation: error-shake 0.5s ease;
}

@keyframes error-shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* 音频播放器 */
.audio-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-top: 8px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--color-border, #e0e0e0);
}

.audio-player .play-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-accent, #7c5c3a);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.audio-player .play-btn:hover {
    background: var(--color-accent-dark, #5a3f2a);
    transform: scale(1.1);
}

.audio-player .play-btn:active {
    transform: scale(0.95);
}

.audio-player .audio-progress {
    flex: 1;
    height: 4px;
    background: #d0d0d0;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.audio-player .audio-progress-bar {
    height: 100%;
    background: var(--color-accent, #7c5c3a);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.audio-player .audio-time {
    font-size: 12px;
    color: var(--color-text-secondary, #666);
    min-width: 40px;
    text-align: right;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .voice-btn {
        width: 40px;
        height: 40px;
    }

    .voice-status {
        font-size: 13px;
        padding: 10px 14px;
    }

    .audio-player {
        padding: 10px 12px;
    }
}

/* 权限提示弹窗 */
.permission-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.permission-content {
    background: #fff;
    padding: 32px;
    border-radius: var(--radius-lg, 16px);
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.15));
    text-align: center;
}

.permission-content h3 {
    margin: 0 0 16px 0;
    color: var(--color-text-primary, #333);
    font-size: 20px;
}

.permission-content p {
    margin: 0 0 24px 0;
    color: var(--color-text-secondary, #666);
    line-height: 1.6;
}

.permission-actions {
    display: flex;
    gap: 12px;
}

.permission-actions button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md, 12px);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.permission-actions .primary-btn {
    background: var(--color-accent, #7c5c3a);
    color: #fff;
}

.permission-actions .primary-btn:hover {
    background: var(--color-accent-dark, #5a3f2a);
}

.permission-actions .secondary-btn {
    background: #f0f0f0;
    color: var(--color-text-primary, #333);
}

.permission-actions .secondary-btn:hover {
    background: #e0e0e0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
