/* Modern Voice Chat Styles - Ultra Modern Design */
.voice-chat-section {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 30%, rgba(51, 65, 85, 0.95) 60%, rgba(71, 85, 105, 0.95) 100%),
        radial-gradient(circle at 30% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    gap: 12px;
    min-height: 400px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.4),
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.voice-chat-section.active {
    transform: scale(1.01);
    box-shadow: 
        0 32px 64px rgba(0, 0, 0, 0.5),
        0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.voice-chat-section.listening {
    background: 
        linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(245, 158, 11, 0.2) 40%, rgba(245, 158, 11, 0.1) 100%),
        radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.2) 0%, transparent 70%);
    animation: listeningPulse 2s ease-in-out infinite;
    border-color: rgba(245, 158, 11, 0.3);
}

.voice-chat-section.speaking {
    background: 
        linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(139, 92, 246, 0.2) 40%, rgba(139, 92, 246, 0.1) 100%),
        radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    animation: speakingPulse 1.5s ease-in-out infinite;
    border-color: rgba(139, 92, 246, 0.3);
}

@keyframes listeningPulse {
    0%, 100% {
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.4),
            0 0 60px rgba(245, 158, 11, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
        filter: brightness(1) saturate(1);
    }
    50% {
        box-shadow: 
            0 32px 64px rgba(0, 0, 0, 0.5),
            0 0 100px rgba(245, 158, 11, 0.7),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        filter: brightness(1.05) saturate(1.2);
    }
}

@keyframes speakingPulse {
    0%, 100% {
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.4),
            0 0 60px rgba(139, 92, 246, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
        filter: brightness(1) saturate(1);
    }
    50% {
        box-shadow: 
            0 32px 64px rgba(0, 0, 0, 0.5),
            0 0 100px rgba(139, 92, 246, 0.7),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        filter: brightness(1.05) saturate(1.2);
    }
}

/* Voice Animation Bubble at Top */
.voice-bubble-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 0 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px 16px 0 0;
    margin: -16px -16px 0 -16px;
    padding: 20px 16px 16px 16px;
}

.voice-main-bubble {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    animation: gentleFloat 4s ease-in-out infinite;
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2) 0%, transparent 60%),
        radial-gradient(circle at 70% 70%, rgba(59, 130, 246, 0.1) 0%, transparent 60%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 4px 16px rgba(59, 130, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.voice-main-bubble:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.4),
        0 6px 24px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.voice-main-bubble.listening {
    animation: bubbleListening 2s ease-in-out infinite;
}

.voice-main-bubble.speaking {
    animation: bubbleSpeaking 1.5s ease-in-out infinite;
}

@keyframes bubbleListening {
    0%, 100% {
        transform: scale(1);
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.3),
            0 0 40px rgba(245, 158, 11, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 
            0 25px 80px rgba(0, 0, 0, 0.4),
            0 0 80px rgba(245, 158, 11, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

@keyframes bubbleSpeaking {
    0%, 100% {
        transform: scale(1);
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.3),
            0 0 40px rgba(139, 92, 246, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 
            0 25px 80px rgba(0, 0, 0, 0.4),
            0 0 80px rgba(139, 92, 246, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

/* Gentle floating animation for bubble */
@keyframes gentleFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Light pulsing animation */
@keyframes lightPulse {
    0%, 100% {
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.3),
            0 0 30px rgba(59, 130, 246, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.3),
            0 0 60px rgba(59, 130, 246, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

/* Central Chat Area */
.voice-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
    min-height: 120px;
    max-height: 180px;
}

.voice-chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 120px;
    min-height: 80px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.voice-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.voice-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.voice-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.voice-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.voice-message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.voice-message.user {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: rgba(255, 255, 255, 0.9);
    align-self: flex-end;
}

.voice-message.ai {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    align-self: flex-start;
}

.voice-status-area {
    padding: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
    flex-shrink: 0;
}

.voice-status-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin: 0;
}

/* Voice Bubble Core */
.voice-bubble-core {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: 
        radial-gradient(circle at 30% 30%, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
    position: relative;
    z-index: 3;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 
        0 4px 16px rgba(59, 130, 246, 0.6),
        0 2px 8px rgba(59, 130, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Animated Circles Around Core */
.voice-bubble-circle {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.3);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.voice-bubble-circle:nth-child(1) {
    width: 40px;
    height: 40px;
    animation: ripple 2s infinite;
    animation-delay: 0s;
}

.voice-bubble-circle:nth-child(2) {
    width: 55px;
    height: 55px;
    animation: ripple 2s infinite;
    animation-delay: 0.5s;
}

.voice-bubble-circle:nth-child(3) {
    width: 70px;
    height: 70px;
    animation: ripple 2s infinite;
    animation-delay: 1s;
}

.voice-bubble-circle:nth-child(4) {
    width: 85px;
    height: 85px;
    animation: ripple 2s infinite;
    animation-delay: 1.5s;
}

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

/* Listening State - Orange ripples */
.voice-main-bubble.listening .voice-bubble-circle {
    border-color: rgba(245, 158, 11, 0.6);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.voice-main-bubble.listening .voice-bubble-core {
    background: 
        radial-gradient(circle at 30% 30%, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    box-shadow: 
        0 6px 24px rgba(245, 158, 11, 0.8),
        0 3px 12px rgba(245, 158, 11, 0.6),
        0 0 40px rgba(245, 158, 11, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transform: scale(1.15);
    animation: coreListeningPulse 1.5s ease-in-out infinite;
}

/* Speaking State - Purple ripples */
.voice-main-bubble.speaking .voice-bubble-circle {
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.voice-main-bubble.speaking .voice-bubble-core {
    background: 
        radial-gradient(circle at 30% 30%, #a78bfa 0%, #8b5cf6 50%, #7c3aed 100%);
    box-shadow: 
        0 6px 24px rgba(139, 92, 246, 0.8),
        0 3px 12px rgba(139, 92, 246, 0.6),
        0 0 40px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transform: scale(1.15);
    animation: coreSpeakingPulse 1.2s ease-in-out infinite;
}





/* Modern Audio Visualizer */
.voice-bubble-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 24px;
    margin: 8px 0 4px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.voice-bubble-visualizer.active {
    opacity: 1;
}

.voice-bubble-bar {
    width: 3px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.9));
    border-radius: 2px;
    height: 4px;
    transition: height 0.05s ease;
    transform-origin: bottom;
}

.voice-bubble-visualizer.listening .voice-bubble-bar:nth-child(1) {
    animation: bubbleBarListening1 0.8s ease-in-out infinite;
    height: 16px;
    background: linear-gradient(to top, rgba(59, 130, 246, 0.6), rgba(147, 197, 253, 0.9));
}

.voice-bubble-visualizer.listening .voice-bubble-bar:nth-child(2) {
    animation: bubbleBarListening2 0.9s ease-in-out infinite;
    height: 16px;
    background: linear-gradient(to top, rgba(59, 130, 246, 0.6), rgba(147, 197, 253, 0.9));
}

.voice-bubble-visualizer.listening .voice-bubble-bar:nth-child(3) {
    animation: bubbleBarListening3 0.7s ease-in-out infinite;
    height: 16px;
    background: linear-gradient(to top, rgba(59, 130, 246, 0.6), rgba(147, 197, 253, 0.9));
}

.voice-bubble-visualizer.listening .voice-bubble-bar:nth-child(4) {
    animation: bubbleBarListening4 1.0s ease-in-out infinite;
    height: 16px;
    background: linear-gradient(to top, rgba(59, 130, 246, 0.6), rgba(147, 197, 253, 0.9));
}

.voice-bubble-visualizer.listening .voice-bubble-bar:nth-child(5) {
    animation: bubbleBarListening5 0.6s ease-in-out infinite;
    height: 16px;
    background: linear-gradient(to top, rgba(59, 130, 246, 0.6), rgba(147, 197, 253, 0.9));
}

.voice-bubble-visualizer.listening .voice-bubble-bar:nth-child(6) {
    animation: bubbleBarListening6 0.85s ease-in-out infinite;
    height: 16px;
    background: linear-gradient(to top, rgba(59, 130, 246, 0.6), rgba(147, 197, 253, 0.9));
}

.voice-bubble-visualizer.listening .voice-bubble-bar:nth-child(7) {
    animation: bubbleBarListening7 0.75s ease-in-out infinite;
    height: 16px;
    background: linear-gradient(to top, rgba(59, 130, 246, 0.6), rgba(147, 197, 253, 0.9));
}

.voice-bubble-visualizer.listening .voice-bubble-bar:nth-child(8) {
    animation: bubbleBarListening8 0.95s ease-in-out infinite;
    height: 16px;
    background: linear-gradient(to top, rgba(59, 130, 246, 0.6), rgba(147, 197, 253, 0.9));
}

.voice-bubble-visualizer.speaking .voice-bubble-bar:nth-child(1) {
    animation: bubbleBarSpeaking1 0.6s ease-in-out infinite;
    height: 18px;
    background: linear-gradient(to top, rgba(37, 99, 235, 0.6), rgba(255, 255, 255, 0.9));
}

.voice-bubble-visualizer.speaking .voice-bubble-bar:nth-child(2) {
    animation: bubbleBarSpeaking2 0.7s ease-in-out infinite;
    height: 18px;
    background: linear-gradient(to top, rgba(37, 99, 235, 0.6), rgba(255, 255, 255, 0.9));
}

.voice-bubble-visualizer.speaking .voice-bubble-bar:nth-child(3) {
    animation: bubbleBarSpeaking3 0.5s ease-in-out infinite;
    height: 18px;
    background: linear-gradient(to top, rgba(37, 99, 235, 0.6), rgba(255, 255, 255, 0.9));
}

.voice-bubble-visualizer.speaking .voice-bubble-bar:nth-child(4) {
    animation: bubbleBarSpeaking4 0.8s ease-in-out infinite;
    height: 18px;
    background: linear-gradient(to top, rgba(37, 99, 235, 0.6), rgba(255, 255, 255, 0.9));
}

.voice-bubble-visualizer.speaking .voice-bubble-bar:nth-child(5) {
    animation: bubbleBarSpeaking5 0.65s ease-in-out infinite;
    height: 18px;
    background: linear-gradient(to top, rgba(37, 99, 235, 0.6), rgba(255, 255, 255, 0.9));
}

.voice-bubble-visualizer.speaking .voice-bubble-bar:nth-child(6) {
    animation: bubbleBarSpeaking6 0.75s ease-in-out infinite;
    height: 18px;
    background: linear-gradient(to top, rgba(37, 99, 235, 0.6), rgba(255, 255, 255, 0.9));
}

.voice-bubble-visualizer.speaking .voice-bubble-bar:nth-child(7) {
    animation: bubbleBarSpeaking7 0.55s ease-in-out infinite;
    height: 18px;
    background: linear-gradient(to top, rgba(37, 99, 235, 0.6), rgba(255, 255, 255, 0.9));
}

.voice-bubble-visualizer.speaking .voice-bubble-bar:nth-child(8) {
    animation: bubbleBarSpeaking8 0.85s ease-in-out infinite;
    height: 18px;
    background: linear-gradient(to top, rgba(37, 99, 235, 0.6), rgba(255, 255, 255, 0.9));
}

/* Base bar styling - delays now handled by individual animations */
.voice-bubble-bar:nth-child(1) { animation-delay: 0s; }
.voice-bubble-bar:nth-child(2) { animation-delay: 0.05s; }
.voice-bubble-bar:nth-child(3) { animation-delay: 0.1s; }
.voice-bubble-bar:nth-child(4) { animation-delay: 0.15s; }
.voice-bubble-bar:nth-child(5) { animation-delay: 0.2s; }
.voice-bubble-bar:nth-child(6) { animation-delay: 0.15s; }
.voice-bubble-bar:nth-child(7) { animation-delay: 0.1s; }
.voice-bubble-bar:nth-child(8) { animation-delay: 0.05s; }

/* Individual bar animations for listening */
@keyframes bubbleBarListening1 {
    0% { transform: scaleY(0.3); }
    15% { transform: scaleY(1.2); }
    30% { transform: scaleY(0.8); }
    45% { transform: scaleY(1.8); }
    60% { transform: scaleY(0.5); }
    75% { transform: scaleY(1.4); }
    90% { transform: scaleY(0.7); }
    100% { transform: scaleY(0.3); }
}

@keyframes bubbleBarListening2 {
    0% { transform: scaleY(0.5); }
    12% { transform: scaleY(0.8); }
    25% { transform: scaleY(1.6); }
    40% { transform: scaleY(0.9); }
    55% { transform: scaleY(2.0); }
    70% { transform: scaleY(0.6); }
    85% { transform: scaleY(1.3); }
    100% { transform: scaleY(0.5); }
}

@keyframes bubbleBarListening3 {
    0% { transform: scaleY(0.8); }
    18% { transform: scaleY(1.5); }
    35% { transform: scaleY(0.4); }
    50% { transform: scaleY(1.9); }
    65% { transform: scaleY(1.1); }
    80% { transform: scaleY(0.7); }
    95% { transform: scaleY(1.6); }
    100% { transform: scaleY(0.8); }
}

@keyframes bubbleBarListening4 {
    0% { transform: scaleY(1.1); }
    20% { transform: scaleY(0.6); }
    40% { transform: scaleY(2.2); }
    60% { transform: scaleY(0.8); }
    80% { transform: scaleY(1.7); }
    100% { transform: scaleY(1.1); }
}

@keyframes bubbleBarListening5 {
    0% { transform: scaleY(0.4); }
    25% { transform: scaleY(1.8); }
    50% { transform: scaleY(0.9); }
    75% { transform: scaleY(2.1); }
    100% { transform: scaleY(0.4); }
}

@keyframes bubbleBarListening6 {
    0% { transform: scaleY(1.3); }
    22% { transform: scaleY(0.7); }
    44% { transform: scaleY(1.4); }
    66% { transform: scaleY(1.9); }
    88% { transform: scaleY(0.5); }
    100% { transform: scaleY(1.3); }
}

@keyframes bubbleBarListening7 {
    0% { transform: scaleY(0.6); }
    16% { transform: scaleY(1.7); }
    33% { transform: scaleY(1.0); }
    50% { transform: scaleY(0.3); }
    66% { transform: scaleY(1.5); }
    83% { transform: scaleY(0.8); }
    100% { transform: scaleY(0.6); }
}

@keyframes bubbleBarListening8 {
    0% { transform: scaleY(0.9); }
    14% { transform: scaleY(0.4); }
    28% { transform: scaleY(1.6); }
    42% { transform: scaleY(1.2); }
    56% { transform: scaleY(0.7); }
    70% { transform: scaleY(2.0); }
    84% { transform: scaleY(1.1); }
    100% { transform: scaleY(0.9); }
}

/* Individual bar animations for speaking */
@keyframes bubbleBarSpeaking1 {
    0% { transform: scaleY(0.4); }
    10% { transform: scaleY(1.8); }
    20% { transform: scaleY(0.9); }
    30% { transform: scaleY(2.1); }
    40% { transform: scaleY(0.6); }
    50% { transform: scaleY(1.5); }
    60% { transform: scaleY(1.0); }
    70% { transform: scaleY(0.3); }
    80% { transform: scaleY(1.7); }
    90% { transform: scaleY(0.8); }
    100% { transform: scaleY(0.4); }
}

@keyframes bubbleBarSpeaking2 {
    0% { transform: scaleY(0.8); }
    12% { transform: scaleY(0.5); }
    24% { transform: scaleY(1.9); }
    36% { transform: scaleY(1.2); }
    48% { transform: scaleY(0.7); }
    60% { transform: scaleY(2.0); }
    72% { transform: scaleY(0.9); }
    84% { transform: scaleY(1.4); }
    96% { transform: scaleY(0.6); }
    100% { transform: scaleY(0.8); }
}

@keyframes bubbleBarSpeaking3 {
    0% { transform: scaleY(1.2); }
    15% { transform: scaleY(0.7); }
    30% { transform: scaleY(1.6); }
    45% { transform: scaleY(0.4); }
    60% { transform: scaleY(2.2); }
    75% { transform: scaleY(1.0); }
    90% { transform: scaleY(0.5); }
    100% { transform: scaleY(1.2); }
}

@keyframes bubbleBarSpeaking4 {
    0% { transform: scaleY(0.6); }
    18% { transform: scaleY(1.9); }
    36% { transform: scaleY(0.8); }
    54% { transform: scaleY(1.3); }
    72% { transform: scaleY(2.1); }
    90% { transform: scaleY(0.9); }
    100% { transform: scaleY(0.6); }
}

@keyframes bubbleBarSpeaking5 {
    0% { transform: scaleY(1.5); }
    16% { transform: scaleY(0.3); }
    32% { transform: scaleY(1.8); }
    48% { transform: scaleY(1.1); }
    64% { transform: scaleY(0.6); }
    80% { transform: scaleY(2.0); }
    96% { transform: scaleY(1.3); }
    100% { transform: scaleY(1.5); }
}

@keyframes bubbleBarSpeaking6 {
    0% { transform: scaleY(0.9); }
    14% { transform: scaleY(1.4); }
    28% { transform: scaleY(0.5); }
    42% { transform: scaleY(1.9); }
    56% { transform: scaleY(1.2); }
    70% { transform: scaleY(0.7); }
    84% { transform: scaleY(1.6); }
    100% { transform: scaleY(0.9); }
}

@keyframes bubbleBarSpeaking7 {
    0% { transform: scaleY(0.7); }
    12% { transform: scaleY(2.1); }
    24% { transform: scaleY(1.0); }
    36% { transform: scaleY(0.4); }
    48% { transform: scaleY(1.7); }
    60% { transform: scaleY(0.8); }
    72% { transform: scaleY(1.5); }
    84% { transform: scaleY(0.6); }
    96% { transform: scaleY(1.8); }
    100% { transform: scaleY(0.7); }
}

@keyframes bubbleBarSpeaking8 {
    0% { transform: scaleY(1.1); }
    11% { transform: scaleY(0.5); }
    22% { transform: scaleY(1.4); }
    33% { transform: scaleY(0.8); }
    44% { transform: scaleY(2.0); }
    55% { transform: scaleY(1.3); }
    66% { transform: scaleY(0.4); }
    77% { transform: scaleY(1.7); }
    88% { transform: scaleY(0.9); }
    100% { transform: scaleY(1.1); }
}

/* Bottom Controls */
.voice-bottom-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    min-height: 48px;
}

.voice-control-btn {
    padding: 8px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.voice-control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.voice-control-btn svg {
    width: 14px;
    height: 14px;
    color: rgba(255, 255, 255, 0.9);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.voice-control-btn.close-btn {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.1) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.voice-control-btn.close-btn::after {
    content: 'Exit Chat';
    margin-left: 4px;
}

.voice-control-btn.close-btn:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(220, 38, 38, 0.2) 100%);
    border-color: rgba(239, 68, 68, 0.5);
}

.voice-control-btn.mute-btn::after {
    content: 'Mute';
    margin-left: 4px;
}

.voice-control-btn.mute-btn.active::after {
    content: 'Unmute';
    margin-left: 4px;
}

.voice-control-btn.mute-btn.active {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.1) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Voice Visualizer */
.voice-visualizer {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px;
    margin: 20px 0;
    padding: 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.voice-visualizer.hidden {
    display: none;
}

.voice-bars {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 60px;
}

.voice-bar {
    width: 4px;
    background: linear-gradient(to top, #0ea5e9, #60a5fa);
    border-radius: 2px;
    transition: height 0.1s ease;
    height: 8px;
    opacity: 0.3;
}

.voice-bars.listening .voice-bar {
    animation: voiceBarListening 0.6s ease-in-out infinite;
}

.voice-bars.speaking .voice-bar {
    animation: voiceBarSpeaking 0.8s 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; }
.voice-bar:nth-child(5) { animation-delay: 0.4s; }
.voice-bar:nth-child(6) { animation-delay: 0.3s; }
.voice-bar:nth-child(7) { animation-delay: 0.2s; }
.voice-bar:nth-child(8) { animation-delay: 0.1s; }

@keyframes voiceBarListening {
    0%, 100% {
        height: 8px;
        opacity: 0.3;
        background: linear-gradient(to top, #f59e0b, #fbbf24);
    }
    50% {
        height: 40px;
        opacity: 1;
        background: linear-gradient(to top, #f59e0b, #fde047);
    }
}

@keyframes voiceBarSpeaking {
    0%, 100% {
        height: 8px;
        opacity: 0.3;
        background: linear-gradient(to top, #8b5cf6, #a78bfa);
    }
    50% {
        height: 50px;
        opacity: 1;
        background: linear-gradient(to top, #8b5cf6, #c4b5fd);
    }
}

/* Voice Status */
.voice-status {
    text-align: center;
    margin: 16px 0;
}

.voice-status-text {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.voice-status-text.listening {
    color: #f59e0b;
}

.voice-status-text.speaking {
    color: #8b5cf6;
}

.voice-status-text.processing {
    color: #0ea5e9;
}

.voice-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: statusPulse 2s ease-in-out infinite;
}

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

/* Voice Permission Alert */
.voice-permission-alert {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #92400e;
}

.voice-permission-alert.hidden {
    display: none;
}

.permission-icon {
    width: 24px;
    height: 24px;
    color: #f59e0b;
    flex-shrink: 0;
}

.permission-content {
    flex: 1;
}

.permission-content h5 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
}

.permission-content p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
}

.enable-permission-btn {
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.enable-permission-btn:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* Enhanced Full Window Mode */
.chat-window.full-window .voice-chat-section {
    padding: 30px;
    margin: 20px 0;
    border-radius: 24px;
}

.chat-window.full-window .voice-chat-title h4 {
    font-size: 22px;
}

.chat-window.full-window .voice-toggle-btn {
    width: 56px;
    height: 56px;
}

.chat-window.full-window .voice-visualizer {
    height: 100px;
    margin: 30px 0;
    padding: 30px;
    border-radius: 20px;
}

.chat-window.full-window .voice-bars {
    height: 80px;
    gap: 6px;
}

.chat-window.full-window .voice-bar {
    width: 6px;
}

.chat-window.full-window .voice-control-btn {
    padding: 16px 20px;
    font-size: 16px;
    gap: 10px;
    border-radius: 16px;
}

/* Responsive Design for Modern Bubble */
@media (max-width: 768px) {
    .voice-chat-section {
        padding: 10px;
        gap: 6px;
    }
    
    .voice-main-bubble {
        width: 90px;
        height: 90px;
    }
    
    .voice-bubble-core {
        width: 18px;
        height: 18px;
    }
    
    .voice-bubble-circle:nth-child(1) {
        width: 35px;
        height: 35px;
    }
    
    .voice-bubble-circle:nth-child(2) {
        width: 50px;
        height: 50px;
    }
    
    .voice-bubble-circle:nth-child(3) {
        width: 65px;
        height: 65px;
    }
    
    .voice-bubble-circle:nth-child(4) {
        width: 80px;
        height: 80px;
    }
    
    .voice-chat-area {
        max-height: 160px;
        min-height: 100px;
    }
    
    .voice-chat-messages {
        max-height: 100px;
        min-height: 60px;
        padding: 10px;
    }
    
    .voice-bottom-controls {
        padding: 10px;
        gap: 12px;
        min-height: 40px;
    }
    
    .voice-control-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .voice-control-btn svg {
        width: 12px;
        height: 12px;
    }
}

/* Animated Gradient Border Effects - Edge Only */
.voice-chat-section.audio-border-active {
    position: relative;
    overflow: visible;
}

.voice-chat-section.audio-border-active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        rgba(59, 130, 246, 0.8), 
        rgba(147, 197, 253, 0.6),
        rgba(255, 255, 255, 0.8),
        rgba(59, 130, 246, 0.6),
        rgba(147, 197, 253, 0.8)
    );
    background-size: 400% 400%;
    border-radius: 26px;
    z-index: -1;
    animation: gradientBorderBase 3s ease-in-out infinite;
    mask: 
        radial-gradient(farthest-side, transparent calc(100% - 4px), white calc(100% - 3px)),
        linear-gradient(white, white);
    mask-composite: subtract;
    -webkit-mask: 
        radial-gradient(farthest-side, transparent calc(100% - 4px), white calc(100% - 3px)),
        linear-gradient(white, white);
    -webkit-mask-composite: subtract;
}

.voice-chat-section.audio-border-active.listening-border::before {
    background: linear-gradient(45deg, 
        rgba(59, 130, 246, 0.9), 
        rgba(147, 197, 253, 0.7),
        rgba(255, 255, 255, 0.9),
        rgba(59, 130, 246, 0.7),
        rgba(147, 197, 253, 0.9)
    );
    animation: gradientBorderListening 2s ease-in-out infinite;
}

.voice-chat-section.audio-border-active.speaking-border::before {
    background: linear-gradient(45deg, 
        rgba(37, 99, 235, 0.9), 
        rgba(96, 165, 250, 0.7),
        rgba(255, 255, 255, 0.9),
        rgba(37, 99, 235, 0.7),
        rgba(96, 165, 250, 0.9)
    );
    animation: gradientBorderSpeaking 1.5s ease-in-out infinite;
}

.voice-chat-section.audio-border-active::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(45deg, 
        rgba(59, 130, 246, 0.4), 
        rgba(147, 197, 253, 0.3),
        rgba(255, 255, 255, 0.4),
        rgba(59, 130, 246, 0.3),
        rgba(147, 197, 253, 0.4)
    );
    background-size: 600% 600%;
    border-radius: 28px;
    z-index: -2;
    animation: gradientBorderOuter 4s ease-in-out infinite reverse;
    filter: blur(1px);
    mask: 
        radial-gradient(farthest-side, transparent calc(100% - 6px), white calc(100% - 5px)),
        linear-gradient(white, white);
    mask-composite: subtract;
    -webkit-mask: 
        radial-gradient(farthest-side, transparent calc(100% - 6px), white calc(100% - 5px)),
        linear-gradient(white, white);
    -webkit-mask-composite: subtract;
}

@keyframes gradientBorderBase {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.7;
    }
    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
}

@keyframes gradientBorderListening {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.8;
    }
    25% {
        background-position: 25% 25%;
        opacity: 1;
    }
    50% {
        background-position: 100% 50%;
        opacity: 0.9;
    }
    75% {
        background-position: 75% 75%;
        opacity: 1;
    }
}

@keyframes gradientBorderSpeaking {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.9;
    }
    33% {
        background-position: 50% 0%;
        opacity: 1;
    }
    66% {
        background-position: 100% 100%;
        opacity: 0.8;
    }
}

@keyframes gradientBorderOuter {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.4;
    }
    50% {
        background-position: 100% 50%;
        opacity: 0.6;
    }
}

@media (max-width: 480px) {
    .voice-chat-section {
        border-radius: 16px;
        padding: 8px;
        gap: 4px;
        min-height: 300px;
    }
    
    .voice-bubble-container {
        padding: 4px 0 8px 0;
    }
    
    .voice-main-bubble {
        width: 80px;
        height: 80px;
    }
    
    .voice-bubble-core {
        width: 16px;
        height: 16px;
    }
    
    .voice-bubble-circle:nth-child(1) {
        width: 30px;
        height: 30px;
    }
    
    .voice-bubble-circle:nth-child(2) {
        width: 40px;
        height: 40px;
    }
    
    .voice-bubble-circle:nth-child(3) {
        width: 50px;
        height: 50px;
    }
    
    .voice-bubble-circle:nth-child(4) {
        width: 60px;
        height: 60px;
    }
    
    .voice-chat-area {
        max-height: 140px;
        min-height: 100px;
    }
    
    .voice-chat-messages {
        max-height: 80px;
        min-height: 50px;
        padding: 8px;
        gap: 6px;
        font-size: 11px;
    }
    
    .voice-status-area {
        padding: 6px 8px;
    }
    
    .voice-status-text {
        font-size: 10px;
    }
    
    .voice-bottom-controls {
        gap: 10px;
        padding: 8px;
        min-height: 36px;
    }
    
    .voice-control-btn {
        padding: 5px 10px;
        font-size: 10px;
        gap: 4px;
    }
    
    .voice-control-btn svg {
        width: 10px;
        height: 10px;
    }
    
    .voice-bubble-visualizer {
        height: 20px;
        margin: 6px 0 2px 0;
        gap: 1px;
    }
    
    .voice-bubble-bar {
        width: 2px;
    }
}

/* Accessibility */
.voice-toggle-btn:focus,
.voice-control-btn:focus,
.enable-permission-btn:focus {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* Voice Error States */
.voice-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #f87171;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: 12px;
}

.voice-error.hidden {
    display: none;
}

.error-icon {
    width: 24px;
    height: 24px;
    color: #ef4444;
    flex-shrink: 0;
}

.error-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Voice Loading States */
.voice-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    color: #6b7280;
    font-size: 14px;
}

.voice-loading.hidden {
    display: none;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #0ea5e9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Voice Chat Toggle in Input */
.voice-input-toggle {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    margin-right: 8px;
}

.voice-input-toggle:hover {
    background: rgba(14, 165, 233, 0.1);
    color: #0ea5e9;
}

.voice-input-toggle.active {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.voice-input-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.voice-input-toggle.active svg {
    animation: micPulse 1s ease-in-out infinite;
}

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

/* Extra small screens - ensure buttons are always visible */
@media (max-width: 360px) {
    .voice-chat-section {
        padding: 6px;
        gap: 3px;
        min-height: 280px;
    }
    
    .voice-main-bubble {
        width: 70px;
        height: 70px;
    }
    
    .voice-bubble-core {
        width: 14px;
        height: 14px;
    }
    
    .voice-chat-area {
        max-height: 120px;
        min-height: 80px;
    }
    
    .voice-chat-messages {
        max-height: 60px;
        min-height: 40px;
        padding: 6px;
        font-size: 10px;
    }
    
    .voice-message {
        padding: 8px 10px;
        font-size: 10px;
    }
    
    .voice-bottom-controls {
        gap: 8px;
        padding: 6px;
        min-height: 32px;
        position: relative;
        z-index: 100;
    }
    
    .voice-control-btn {
        padding: 4px 8px;
        font-size: 9px;
        gap: 3px;
        border-radius: 6px;
        min-width: 60px;
        flex-shrink: 0;
    }
    
    .voice-control-btn svg {
        width: 9px;
        height: 9px;
    }
    
    .voice-bubble-visualizer {
        height: 16px;
        margin: 4px 0 1px 0;
    }
}