/* Isolate chatbox styles with high specificity */
body #custom-chat,
body #chat-toggle {
    all: initial !important; /* Reset all styles */
}

/* Chat toggle button */
body #chat-toggle {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 50px !important;
    height: 50px !important;
    background-color: #005566 !important;
    color: #fff !important;
    border-radius: 50% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    z-index: 999999 !important; /* Higher than Tailwind max */
    font-family: 'Font Awesome 5 Free' !important;
    font-weight: 900 !important;
    font-size: 24px !important;
}

body #chat-toggle.active::before {
    content: '\f00d' !important; /* Close icon */
}

body #chat-toggle::before {
    content: '\f075' !important; /* Chat bubble icon */
}

/* Chat container */
body #custom-chat {
    position: fixed !important;
    bottom: 80px !important;
    right: 20px !important;
    width: 320px !important;
    height: 400px !important;
    background-color: #f9f9f9 !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    z-index: 999999 !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
    display: none !important;
    flex-direction: column !important;
    font-family: Arial, sans-serif !important;
}

body #custom-chat.active {
    display: flex !important;
}

body #custom-chat:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3) !important;
}

body #custom-chat .chat-header {
    background-color: #005566 !important;
    color: #fff !important;
    padding: 10px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

body #custom-chat .chat-body {
    background-color: #fff !important;
    padding: 10px !important;
    flex-grow: 1 !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    display: block !important;
}

body #custom-chat .user-message,
body #custom-chat .bot-message {
    border-radius: 12px !important;
    padding: 8px 12px !important;
    margin: 5px 10px !important;
    max-width: 80% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
}

body #custom-chat .user-message {
    background-color: #005566 !important;
    color: #fff !important;
    margin-left: 50px !important;
    text-align: right !important;
}

body #custom-chat .bot-message {
    background-color: #e6e6e6 !important;
    color: #333 !important;
    margin-right: 50px !important;
}

body #custom-chat .user-message::before,
body #custom-chat .bot-message::before {
    font-family: 'Font Awesome 5 Free' !important;
    font-weight: 900 !important;
    margin-right: 8px !important;
}

body #custom-chat .user-message::before {
    content: '\f007' !important; /* User icon */
}

body #custom-chat .bot-message::before {
    content: '\f3e5' !important; /* Robot icon */
}

body #custom-chat .chat-input {
    border-top: 1px solid #ddd !important;
    padding: 10px !important;
    background-color: #fff !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

body #custom-chat .chat-input input {
    width: calc(100% - 60px) !important;
    padding: 8px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
}

body #custom-chat .chat-input button {
    background-color: #005566 !important;
    color: #fff !important;
    border: none !important;
    padding: 8px 12px !important;
    border-radius: 4px !important;
    margin-left: 5px !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
}

@media (max-width: 768px) {
    body #custom-chat {
        width: 280px !important;
        height: 350px !important;
        bottom: 80px !important;
        right: 10px !important;
    }
    body #custom-chat .chat-header {
        font-size: 14px !important;
        padding: 8px !important;
    }
    body #custom-chat .chat-body {
        padding: 8px !important;
    }
    body #custom-chat .user-message,
    body #custom-chat .bot-message {
        max-width: 90% !important;
        font-size: 14px !important;
    }
    body #custom-chat .chat-input input {
        padding: 6px !important;
    }
    body #custom-chat .chat-input button {
        padding: 6px 10px !important;
    }
    body #chat-toggle {
        bottom: 10px !important;
        right: 10px !important;
    }
}

body #custom-chat .minimize-button {
    cursor: pointer !important;
    font-size: 18px !important;
    color: #fff !important;
}