/**
 * Voice Input Button Styles
 * Professional microphone button with listening animation
 */

.voice-input-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: 8px;
    border: 2px solid var(--border-primary, #e2e8f0);
    border-radius: 12px;
    background: white;
    color: var(--text-secondary, #475569);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.voice-input-btn:hover {
    background: var(--bg-tertiary, #f6f8fa);
    border-color: var(--accent-primary, #C41E3A);
    color: var(--accent-primary, #C41E3A);
    transform: scale(1.05);
}

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

/* Listening state */
.voice-input-btn.listening {
    background: var(--accent-primary, #C41E3A);
    border-color: var(--accent-primary, #C41E3A);
    color: white;
    animation: voicePulse 1.5s ease-in-out infinite;
}

.voice-input-btn.listening::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: voiceRipple 1.5s ease-out infinite;
}

@keyframes voicePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(196, 30, 58, 0.4);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(196, 30, 58, 0);
    }
}

@keyframes voiceRipple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Disabled state (when not supported) */
.voice-input-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-input-btn:disabled:hover {
    background: white;
    border-color: var(--border-primary, #e2e8f0);
    color: var(--text-secondary, #475569);
    transform: scale(1);
}

/* Listening indicator overlay */
.voice-listening-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-primary, #C41E3A);
    color: white;
    padding: 16px 24px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(196, 30, 58, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    animation: slideUpFade 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.voice-listening-indicator i {
    font-size: 20px;
    animation: voiceBounce 1s ease-in-out infinite;
}

@keyframes voiceBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.voice-listening-indicator .voice-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
}

.voice-listening-indicator .voice-wave span {
    width: 3px;
    background: white;
    border-radius: 2px;
    animation: voiceWave 1s ease-in-out infinite;
}

.voice-listening-indicator .voice-wave span:nth-child(1) {
    animation-delay: 0s;
}

.voice-listening-indicator .voice-wave span:nth-child(2) {
    animation-delay: 0.1s;
}

.voice-listening-indicator .voice-wave span:nth-child(3) {
    animation-delay: 0.2s;
}

.voice-listening-indicator .voice-wave span:nth-child(4) {
    animation-delay: 0.3s;
}

.voice-listening-indicator .voice-wave span:nth-child(5) {
    animation-delay: 0.4s;
}

@keyframes voiceWave {
    0%, 100% {
        height: 8px;
    }
    50% {
        height: 20px;
    }
}

/* Tooltip for browser not supported */
.voice-not-supported-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.voice-input-btn:disabled:hover .voice-not-supported-tooltip {
    opacity: 1;
}

.voice-not-supported-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1f2937;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .voice-input-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
        margin-right: 6px;
    }

    .voice-listening-indicator {
        bottom: 80px;
        padding: 12px 20px;
        font-size: 13px;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .voice-input-btn {
        background: #374151;
        border-color: #4b5563;
        color: #9ca3af;
    }

    .voice-input-btn:hover {
        background: #4b5563;
    }

    .voice-input-btn.listening {
        background: var(--accent-primary, #C41E3A);
        border-color: var(--accent-primary, #C41E3A);
    }
}
