/**
 * Zencia Voice Button Styles - Enhanced AI Voice Agent Design
 * Advanced animations and futuristic design
 */

/* Main Voice Button Styles */
#zenciaMainVoiceBtn {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 220px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    padding: 18px 36px;
    border-radius: 50px;
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 
        0 8px 32px rgba(16, 185, 129, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Animated Border Effect */
#zenciaMainVoiceBtn::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #10b981, #059669, #06d6a0, #10b981);
    border-radius: 50px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: borderRotate 3s linear infinite;
}

#zenciaMainVoiceBtn:hover::before {
    opacity: 1;
}

@keyframes borderRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ripple Effect */
#zenciaMainVoiceBtn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.6s ease;
    z-index: 1;
}

#zenciaMainVoiceBtn:hover::after {
    width: 300px;
    height: 300px;
}

#zenciaMainVoiceBtn:hover {
    transform: scale(1.05);
    box-shadow: 
        0 15px 50px rgba(16, 185, 129, 0.4),
        0 0 0 3px rgba(16, 185, 129, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Icon and Text Positioning */
#zenciaMainVoiceBtn #zenciaVoiceIcon {
    margin-right: 10px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    font-size: 18px;
}

#zenciaMainVoiceBtn #zenciaVoiceText {
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* CONNECTING STATE - Futuristic Loading */
#zenciaMainVoiceBtn.connecting {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    animation: connectingPulse 2s ease-in-out infinite;
    border: 2px solid rgba(245, 158, 11, 0.3);
}

#zenciaMainVoiceBtn.connecting::before {
    background: linear-gradient(45deg, #f59e0b, #d97706, #fbbf24, #f59e0b);
    opacity: 1;
    animation: borderRotate 2s linear infinite;
}

#zenciaMainVoiceBtn.connecting #zenciaVoiceIcon {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes connectingPulse {
    0%, 100% { 
        box-shadow: 
            0 8px 32px rgba(245, 158, 11, 0.4), 
            0 0 0 0 rgba(245, 158, 11, 0.7),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
        transform: scale(1);
    }
    50% { 
        box-shadow: 
            0 15px 50px rgba(245, 158, 11, 0.6), 
            0 0 0 20px rgba(245, 158, 11, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        transform: scale(1.02);
    }
}

/* ACTIVE STATE - Call in Progress */
#zenciaMainVoiceBtn.active {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    animation: activePulse 2s ease-in-out infinite;
    border: 2px solid rgba(220, 38, 38, 0.3);
}

#zenciaMainVoiceBtn.active::before {
    background: linear-gradient(45deg, #dc2626, #b91c1c, #ef4444, #dc2626);
    opacity: 1;
    animation: borderRotate 2s linear infinite;
}

@keyframes activePulse {
    0%, 100% { 
        box-shadow: 
            0 8px 32px rgba(220, 38, 38, 0.4), 
            0 0 0 0 rgba(220, 38, 38, 0.7),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
        transform: scale(1);
    }
    50% { 
        box-shadow: 
            0 15px 50px rgba(220, 38, 38, 0.6), 
            0 0 0 20px rgba(220, 38, 38, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        transform: scale(1.02);
    }
}

/* LISTENING STATE - AI Processing */
#zenciaMainVoiceBtn.listening {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    animation: listeningPulse 1s ease-in-out infinite alternate;
    border: 2px solid rgba(139, 92, 246, 0.3);
}

#zenciaMainVoiceBtn.listening::before {
    background: linear-gradient(45deg, #8b5cf6, #7c3aed, #a855f7, #8b5cf6);
    opacity: 1;
    animation: borderRotate 1.5s linear infinite;
}

#zenciaMainVoiceBtn.listening #zenciaVoiceIcon {
    animation: voiceWave 0.8s ease-in-out infinite;
}

@keyframes listeningPulse {
    from { 
        transform: scale(1);
        filter: brightness(1);
        box-shadow: 
            0 8px 32px rgba(139, 92, 246, 0.4), 
            0 0 0 0 rgba(139, 92, 246, 0.7);
    }
    to { 
        transform: scale(1.05);
        filter: brightness(1.1);
        box-shadow: 
            0 15px 50px rgba(139, 92, 246, 0.6), 
            0 0 0 15px rgba(139, 92, 246, 0.2);
    }
}

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

/* Icon Animations */
@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Voice Visualizer Inside Button */
.voice-visualizer {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    gap: 2px;
    z-index: 3;
}

.voice-visualizer.active {
    display: flex;
}

.voice-bar {
    width: 3px;
    height: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
    animation: voiceBarWave 0.6s ease-in-out infinite;
}

.voice-bar:nth-child(1) { animation-delay: 0s; }
.voice-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-bar:nth-child(4) { animation-delay: 0.3s; }

@keyframes voiceBarWave {
    0%, 100% { 
        height: 4px;
        opacity: 0.6;
    }
    50% { 
        height: 16px;
        opacity: 1;
    }
}

/* Hidden Widget Holder */
.zencia-widget-holder {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: auto;
    width: 0;
    height: 0;
    overflow: hidden;
}

.zencia-widget-holder.active {
    opacity: 0;
    visibility: hidden;
    pointer-events: auto;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Enhanced Status Messages */
.zencia-status-message {
    position: fixed;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 32px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transform: translateX(-50%) translateY(-30px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    max-width: 450px;
    text-align: center;
    font-family: 'Inter', sans-serif;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.zencia-status-message.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.zencia-status-message.connecting {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #d97706;
    animation: statusPulse 2s ease-in-out infinite;
}

.zencia-status-message.connected {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    animation: connectedGlow 3s ease-in-out infinite;
}

.zencia-status-message.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(185, 28, 28, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

@keyframes statusPulse {
    0%, 100% { 
        box-shadow: 0 8px 32px rgba(245, 158, 11, 0.1);
    }
    50% { 
        box-shadow: 0 12px 40px rgba(245, 158, 11, 0.2);
    }
}

@keyframes connectedGlow {
    0%, 100% { 
        box-shadow: 0 8px 32px rgba(16, 185, 129, 0.1);
    }
    50% { 
        box-shadow: 0 12px 40px rgba(16, 185, 129, 0.2);
    }
}

/* AI Thinking Indicator */
.ai-thinking {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: thinkingDots 1.5s ease-in-out infinite;
}

.thinking-dot:nth-child(1) { animation-delay: 0s; }
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkingDots {
    0%, 20%, 80%, 100% { 
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    #zenciaMainVoiceBtn {
        min-width: 200px;
        padding: 16px 32px;
        font-size: 15px;
    }
    
    .zencia-status-message {
        max-width: 350px;
        padding: 14px 28px;
        font-size: 13px;
        top: 100px;
    }
}

@media (max-width: 480px) {
    #zenciaMainVoiceBtn {
        min-width: 180px;
        padding: 14px 28px;
        font-size: 14px;
        border-radius: 40px;
    }
    
    #zenciaMainVoiceBtn #zenciaVoiceIcon {
        margin-right: 8px;
        font-size: 16px;
    }
    
    .zencia-status-message {
        max-width: 280px;
        padding: 12px 24px;
        font-size: 12px;
        top: 80px;
        border-radius: 20px;
    }
    
    .voice-visualizer {
        right: 15px;
    }
    
    .voice-bar {
        width: 2px;
        height: 10px;
    }
}