.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    background-color: transparent;
    border: none;
    border-radius: 50%;
    width: 65px;
    height: 65px;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    overflow: hidden;
}

    .chat-toggle .chat-icon {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: cover;
        border-radius: 50%;
        image-rendering: auto; /* Use the browser's default scaling */
    }

/* Reposition for RTL */
:dir(rtl) .chat-toggle {
    right: auto;
    left: 24px;
}

.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 360px;
    height: 500px;
    background: rgb(255, 190, 190);
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
    transition: all 0.3s ease;
}

/* Reposition for RTL */
:dir(rtl) .chatbot-window {
    right: auto;
    left: 24px;
}

.chat-header {
    background-color: #0D57BD;
    color: white;
    padding: 12px 16px;
    font-weight: bold;
    text-align: start;
}

/* Flip alignment for RTL */
:dir(rtl) .chat-header {
    text-align: end;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: #f8f9fa;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
}

    /* Bot message */
    .chat-message.bot .message {
        background-color: #e9ecef;
        border-radius: 12px 12px 12px 0;
        padding: 10px 15px;
        max-width: 75%;
        text-align: left;
    }

/* Flip border-radius and text for RTL */
:dir(rtl) .chat-message.bot .message {
    border-radius: 12px 12px 0 12px;
    text-align: right;
}

/* User message aligned right */
.chat-message.user {
    justify-content: flex-end;
}

    /* User message style */
    .chat-message.user .message {
        background-color: #0d6efd;
        color: white;
        border-radius: 12px 12px 0 12px;
        padding: 10px 15px;
        max-width: 75%;
        text-align: right;
    }

/* Flip border-radius and text for RTL */
:dir(rtl) .chat-message.user .message {
    border-radius: 12px 12px 12px 0;
    text-align: left;
}

.chat-input {
    padding: 10px;
    border-top: 1px solid #dee2e6;
    background-color: white;
    display: flex;
    gap: 10px;
}

/* Flip input order for RTL */
:dir(rtl) .chat-input {
    flex-direction: row-reverse;
}

.chat-input input {
    flex: 1;
}

    /* Override dark or inherited styles */

    /* Reset background color for main window */

    /* Input container fix */

    /* Fix input box */
    .chat-input input.form-control {
        background-color: #fff !important;
        color: #000 !important;
        border: 1px solid #ccc;
        border-radius: 6px;
    }

/* prevent outer themes affecting it */
.chatbot-window input,
.chatbot-window button {
    font-size: 0.9rem;
    box-shadow: none !important;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 4px;
}

.chat-typing-indicator {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
    padding-left: 16px;
}

.typing-dots {
    background-color: #e9ecef;
    border-radius: 12px 12px 12px 0;
    padding: 10px 15px;
    max-width: 75%;
    display: flex;
    gap: 5px;
    align-items: center;
}

    .typing-dots span {
        width: 6px;
        height: 6px;
        background-color: #999;
        border-radius: 50%;
        animation: blink 1.4s infinite both;
    }

        .typing-dots span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-dots span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes blink {
    0%, 80%, 100% {
        opacity: 0.2;
    }

    40% {
        opacity: 1;
    }
}
