/**
 * 语音录入功能样式
 * @author ningning.cheng
 */

/* 内容输入区域包装器 */
.content-input-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.content-input-wrapper textarea {
    padding-right: 50px;
}

/* 语音按钮 */
.btn-voice {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--color-bg-tertiary, #f0f0f0);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--color-text-secondary, #666);
}

.btn-voice:hover {
    background: var(--color-primary, #e91e63);
    color: white;
    transform: scale(1.1);
}

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

.btn-voice:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* 录音中状态 */
.btn-voice.recording {
    background: #f44336;
    color: white;
    animation: pulse 1.5s infinite;
}

/* 处理中状态 */
.btn-voice.processing {
    background: var(--color-primary, #e91e63);
    color: white;
}

/* 脉冲动画 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

/* 录音中动画 */
.voice-recording-animation {
    display: flex;
    gap: 3px;
    align-items: center;
    justify-content: center;
}

.voice-dot {
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    animation: voiceDot 1s ease-in-out infinite;
}

.voice-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.voice-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes voiceDot {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(2);
    }
}

/* 处理中加载图标 */
.voice-processing svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 录音状态提示 */
.voice-status {
    margin-top: 8px;
    font-size: 13px;
    color: var(--color-text-secondary, #666);
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-duration {
    color: #f44336;
    font-weight: 500;
}

.voice-processing-text {
    color: var(--color-primary, #e91e63);
    display: flex;
    align-items: center;
    gap: 6px;
}

.voice-processing-text::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary, #e91e63);
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* 语音错误提示 */
.voice-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: #ffebee;
    border-left: 3px solid #f44336;
    border-radius: 4px;
    font-size: 13px;
    color: #c62828;
}

/* 暗色主题适配 */
[data-theme="dark"] .btn-voice {
    background: var(--color-bg-tertiary, #333);
    color: var(--color-text-secondary, #aaa);
}

[data-theme="dark"] .btn-voice:hover {
    background: var(--color-primary, #e91e63);
    color: white;
}

[data-theme="dark"] .voice-error {
    background: #3c1a1a;
    color: #ef9a9a;
}

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

    .content-input-wrapper textarea {
        padding-right: 54px;
    }
}

/* 浏览器不支持时的提示样式 */
.voice-not-supported {
    padding: 12px;
    background: #fff3e0;
    border-radius: 8px;
    font-size: 13px;
    color: #e65100;
    text-align: center;
    margin-top: 8px;
}

[data-theme="dark"] .voice-not-supported {
    background: #3d2a14;
    color: #ffb74d;
}
