/* Base Chatbot Styles */
#cloudprime-chatbot {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 370px;
    height: 60vh;
    min-height: 400px;
    max-height: 600px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.2);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(20px);
    opacity: 0;
}

#cloudprime-chatbot.open {
    transform: translateY(0);
    opacity: 1;
}

/* Header */
#chatbot-header {
    background: #2c3e50;
    color: white;
    padding: 15px;
    border-radius: 15px 15px 0 0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.chatbot-avatar img, .avatar-placeholder {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #34495e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.chatbot-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.8;
}

#chatbot-minimize {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

/* Messages */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f4f7f9;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    max-width: 85%;
    flex-direction: column;
}

.message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.message.bot, .message.system, .message.error {
    align-self: flex-start;
    align-items: flex-start;
}

.message-sender {
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
    margin-left: 5px;
}

.message.user .message-sender {
    margin-right: 5px;
}

.message-content {
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user .message-content {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.bot .message-content {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.message.system .message-content {
    font-size: 13px;
    background: #e6f7ff;
    color: #005f8f;
    border: 1px solid #b3e0ff;
    border-radius: 8px;
    text-align: center;
    width: 100%;
}

.message.error .message-content {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Typing Indicator */
.message.bot.typing .message-content {
    opacity: 0.7;
}

/* Predefined Questions */
#chatbot-predefined {
    padding: 10px 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.predefined-question {
    padding: 8px 12px;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    transition: background-color 0.2s, border-color 0.2s;
}

.predefined-question:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

/* Input Area */
#chatbot-input-area {
    display: flex;
    padding: 10px;
    border-top: 1px solid #e9ecef;
    background: white;
    border-radius: 0 0 15px 15px;
    flex-shrink: 0;
    gap: 10px;
}

#chatbot-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

#chatbot-input:focus {
    border-color: #007bff;
}

#chatbot-send {
    padding: 0;
    width: 40px;
    height: 40px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(45deg);
    transition: background-color 0.2s;
}

#chatbot-send:hover {
    background: #0056b3;
}

/* Contact Form */
#chatbot-contact-form {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

#chatbot-contact-form h4 {
    margin-top: 0;
    margin-bottom: 5px;
    text-align: center;
}

#chatbot-contact-form p {
    font-size: 13px;
    text-align: center;
    color: #666;
    margin-bottom: 15px;
}

#chatbot-contact-form input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    box-sizing: border-box;
}

#save-contact {
    width: 100%;
    padding: 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

#save-contact:hover {
    background: #218838;
}

/* WhatsApp Button */
.whatsapp-button-container {
    text-align: center;
    margin: 10px 0;
}

.whatsapp-button {
    display: inline-block;
    background: #25d366;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.3);
}

.whatsapp-button:hover {
    background: #128c7e;
    transform: translateY(-1px);
}

/* PayFast Button */
.payment-button-container {
    text-align: center;
    margin: 10px 0;
}

.payfast-button {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
    transition: all 0.2s;
}

.payfast-button:hover {
    background: #45a049;
    transform: translateY(-1px);
}

/* Voice Button */
.voice-button {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-button svg {
    width: 18px;
    height: 18px;
    color: #555;
}

.voice-button:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.voice-button.listening {
    background: #dc3545;
    border-color: #dc3545;
    animation: voicePulse 1.5s infinite;
}

.voice-button.listening svg {
    color: white;
}

@keyframes voicePulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* Chat Toggle */
#chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #007bff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
}

.chat-icon {
    font-size: 24px;
    color: white;
}

/* Responsive */
@media (max-width: 480px) {
    #cloudprime-chatbot {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-height: 100%;
    }
    #chatbot-toggle {
        bottom: 15px;
        right: 15px;
    }
}