/* Voice Chatbot n8n - Stili CSS */

/* Container principale */
.vcn8n-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Pulsante toggle */
.vcn8n-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vcn8n-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.vcn8n-toggle-btn.hidden {
    display: none;
}

/* Finestra del chatbot */
.vcn8n-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.vcn8n-chatbot-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.vcn8n-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vcn8n-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vcn8n-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.vcn8n-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.vcn8n-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.vcn8n-close-btn:hover {
    opacity: 0.7;
}

/* Area messaggi */
.vcn8n-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.vcn8n-welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.vcn8n-welcome-message p {
    margin: 10px 0;
    font-size: 14px;
}

.vcn8n-message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

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

.vcn8n-message.user {
    flex-direction: row-reverse;
}

.vcn8n-message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.vcn8n-message.user .vcn8n-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.vcn8n-message.assistant .vcn8n-message-bubble {
    background: white;
    color: #374151;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.vcn8n-message-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.vcn8n-message.user .vcn8n-message-icon {
    background: #e5e7eb;
    color: #6b7280;
}

.vcn8n-message.assistant .vcn8n-message-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Visualizzatore audio */
.vcn8n-audio-visualizer {
    height: 60px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.vcn8n-audio-visualizer.active {
    display: flex;
}

.vcn8n-wave-container {
    display: flex;
    gap: 4px;
    height: 40px;
    align-items: center;
}

.vcn8n-wave {
    width: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.vcn8n-wave:nth-child(1) { animation-delay: 0s; height: 20px; }
.vcn8n-wave:nth-child(2) { animation-delay: 0.1s; height: 30px; }
.vcn8n-wave:nth-child(3) { animation-delay: 0.2s; height: 25px; }
.vcn8n-wave:nth-child(4) { animation-delay: 0.3s; height: 35px; }
.vcn8n-wave:nth-child(5) { animation-delay: 0.4s; height: 20px; }

@keyframes wave {
    0%, 100% {
        transform: scaleY(0.5);
        opacity: 0.5;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Area controlli */
.vcn8n-controls {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.vcn8n-mic-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.vcn8n-mic-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.vcn8n-mic-btn.recording {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: recordPulse 1.5s infinite;
}

@keyframes recordPulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 4px 30px rgba(239, 68, 68, 0.6);
    }
}

.vcn8n-mic-btn.processing {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    pointer-events: none;
}

.vcn8n-status-text {
    font-size: 14px;
    color: #6b7280;
    min-width: 100px;
}

/* Responsive */
@media (max-width: 480px) {
    .vcn8n-chatbot-container {
        bottom: 10px;
        right: 10px;
    }
    
    .vcn8n-chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
        border-radius: 20px 20px 0 0;
    }
    
    .vcn8n-toggle-btn {
        width: 50px;
        height: 50px;
    }
}

/* Scrollbar personalizzata */
.vcn8n-messages::-webkit-scrollbar {
    width: 6px;
}

.vcn8n-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.vcn8n-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.vcn8n-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loading dots */
.vcn8n-loading {
    display: inline-flex;
    gap: 4px;
    padding: 12px 16px;
}

.vcn8n-loading-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: loadingDot 1.4s infinite ease-in-out;
}

.vcn8n-loading-dot:nth-child(1) { animation-delay: -0.32s; }
.vcn8n-loading-dot:nth-child(2) { animation-delay: -0.16s; }
.vcn8n-loading-dot:nth-child(3) { animation-delay: 0; }

@keyframes loadingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}
