/* Chatbox container */
#kag-ai-chatbot {
    border: 1px solid #ccc;
    padding: 15px;
    max-width: 400px;
    background: #fff;
    display: none; /* Hide the chatbox initially */
    position: fixed;
    bottom: 90px; /* Adjust for the circle button */
    right: 20px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    z-index: 9999; /* Make sure it stays on top */
    border-radius: 8px; /* Rounded corners */
    animation: slideIn 0.3s ease-out; /* Animation when appearing */
}

#logo-container {
    display: flex;
    justify-content: center;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    transition: transform 0.1s ease-in;
}

#logo-container:hover {
    transform: scale(1.1); /* Slight grow effect on hover */
    cursor: pointer;
}

#logo-message {
    display: flex;
    align-items: center;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    text-align: center;
}

#logo-message img {
    height: 30px; /* Adjust as needed */
    width: auto;
    margin: auto;
}

#powered-by {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Add this to your CSS */
#kag-ai-chatbot-header {
    background-color: #8b0003;
    color: white;
    font-weight: bold;
    padding: 12px 15px;
    margin: -15px -15px 15px -15px; /* Negative margins to stretch to container edges */
    border-radius: 8px 8px 0 0; /* Only round top corners */
    font-size: 16px;
}

/* Animation for the chatbox */
@keyframes slideIn {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Messages container */
#kag-ai-chatbot-messages {
    height: 300px;
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 10px;
    border-bottom: 1px solid #ccc;
    word-wrap: break-word; /* Ensure long words break */
}

/* Chat input and send button */
.chat-input-container {
    display: flex;
    justify-content: space-between;
}

#kag-ai-chatbot-input {
    width: 70%;
    padding: 10px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    background-color: #f4eee7; /* Secondary color */
}

#kag-ai-chatbot-send {
    padding: 10px 20px;
    background-color: #8b0003; /* Highlight color */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

#kag-ai-chatbot-send:hover {
    background-color: #a30000; /* Slightly lighter shade on hover */
}

/* Floating button (circle) to open the chatbox */
#kag-ai-chatbot-toggle {
    position: fixed;
    bottom: 20px; /* Position above the chatbox */
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #8b0003; /* Highlight color */
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    cursor: pointer;
    z-index: 10000; /* Make sure it's above everything */
    transition: transform 0.3s ease-in-out;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */
}

#kag-ai-chatbot-toggle:hover {
    background-color: #a30000;
    transform: scale(1.1); /* Slight grow effect on hover */
}

/* Chat messages */
#kag-ai-chatbot-messages div {
    margin-bottom: 10px;
    font-size: 14px;
    max-width: 80%; /* Maximum width, but can be less */
    padding: 10px;
    border-radius: 10px;
    display: inline-block;
    clear: both;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    width: fit-content; /* New: Bubble width matches content */
    min-width: 10%; /* Prevents bubbles from being too narrow */
}

/* User message styling (Right aligned) */
#kag-ai-chatbot-messages .user-message {
    background-color: #f4eee7;
    text-align: right; /* Align text to right */
    float: right;
    border: 1px solid #ccc;
}

/* Bot message styling (Left aligned) */
#kag-ai-chatbot-messages .bot-message {
    background-color: #8b0003;
    color: white;
    text-align: left; /* Align text to left */
    float: left;
    border: 1px solid #ccc;
}

#kag-ai-chatbot-messages div:not(.user-message):not(.bot-message) {
    max-width: 100%; /* For system messages if any */
}

/* Clear floats after each message */
#kag-ai-chatbot-messages::after {
    content: "";
    display: table;
    clear: both;
}
