/**
 * Chatbot Lead Capture Styles
 */

.chatbot-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 80%;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    overflow: hidden;
    box-sizing: border-box;
    min-width: 0; /* Prevent flex items from overflowing */
}

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

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 18px;
}

.chatbot-icon {
    font-size: 24px;
}

.chatbot-close {
    background: var(--gradient, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    white-space: nowrap;
    width: 100%;
    margin-top: 8px;
    box-sizing: border-box;
}

.chatbot-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    background: #4caf50; /* Green background on hover */
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 300px;
    max-height: 500px;
}

.chatbot-message {
    display: flex;
    animation: messageSlideIn 0.3s ease-out;
}

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

.chatbot-message-user {
    justify-content: flex-end;
}

.chatbot-message-bot {
    justify-content: flex-start;
}

.chatbot-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

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

.chatbot-message-bot .chatbot-message-content {
    background: #f1f3f5;
    color: #333;
    border-bottom-left-radius: 4px;
}

.chatbot-typing {
    align-items: center;
}

.chatbot-typing-indicator {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: #f1f3f5;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.chatbot-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.chatbot-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.chatbot-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

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

.chatbot-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e1e5e9;
    background: #f8f9fa;
    border-radius: 0 0 16px 16px;
    box-sizing: border-box;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 24px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    width: 100%;
}

.chatbot-input:focus {
    border-color: var(--accent-color, #667eea);
}

.chatbot-input:disabled {
    background: #f1f3f5;
    cursor: not-allowed;
}

.chatbot-send-btn {
    padding: 12px 24px;
    background: var(--gradient, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 15px;
    width: 100%;
    box-sizing: border-box;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.chatbot-voice-btn {
    padding: 0;
    background: #f1f3f5;
    color: #666;
    border: none;
    border-radius: 50%;
    font-size: 40px;
    cursor: pointer;
    transition: all 0.2s;
    width: 88px;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0 auto 12px auto;
}

.chatbot-voice-btn:hover {
    background: #e1e5e9;
    transform: scale(1.05);
}

.chatbot-voice-btn.listening {
    background: #ff4444;
    color: white;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    /* Reduce body padding on mobile for chatbot */
    html, body {
        padding: 10px !important;
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    .lead-form-container {
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .chatbot-container {
        margin: 10px auto !important;
        max-width: 90% !important;
        width: 90% !important;
        min-width: 0 !important;
        max-height: 90vh;
        border-radius: 12px;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .chatbot-header {
        padding: 12px 16px;
        border-radius: 12px 12px 0 0;
    }
    
    .chatbot-messages {
        padding: 16px;
        min-height: 250px;
        max-height: 400px;
    }
    
    .chatbot-message-content {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .chatbot-input-container {
        padding: 12px 12px;
        box-sizing: border-box;
    }
    
    .chatbot-send-btn,
    .chatbot-close {
        box-sizing: border-box;
        padding: 10px 16px;
    }
    
    .chatbot-input {
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .chatbot-send-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .chatbot-voice-btn {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    /* Further reduce body padding on small mobile devices */
    html, body {
        padding: 5px !important;
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    .lead-form-container {
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .chatbot-container {
        margin: 10px auto !important;
        max-width: 90% !important;
        width: 90% !important;
        min-width: 0 !important;
        max-height: 95vh;
        border-radius: 8px;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .chatbot-header {
        padding: 10px 12px;
        border-radius: 8px 8px 0 0;
    }
    
    .chatbot-title {
        font-size: 16px;
    }
    
    .chatbot-messages {
        padding: 12px;
        min-height: 200px;
        max-height: 350px;
    }
    
    .chatbot-message-content {
        max-width: 90%;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .chatbot-input-container {
        padding: 10px 8px;
        gap: 8px;
        box-sizing: border-box;
    }
    
    .chatbot-send-btn,
    .chatbot-close {
        box-sizing: border-box;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .chatbot-input {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .chatbot-send-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .chatbot-close {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .chatbot-voice-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Scrollbar styling */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f3f5;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

