/* Overall chatbot floating wrapper */
#it-chatbot-floating-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Chatbot Toggle Button */
#it-chatbot-toggle {
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 9999px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease-in-out;
    position: absolute;
    bottom: 0;
    right: 0;
    font-size: 1.5rem;
}

#it-chatbot-toggle:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Chatbot Window */
#it-chatbot-window {
    width: 380px;
    height: 500px;
    background-color: #f3f4f6;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex !important;
    flex-direction: column !important;
    position: absolute;
    bottom: 70px;
    right: 0;
    transform-origin: bottom right;
    transition: all 0.3s ease-in-out;
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
    overflow: hidden !important;
}

/* Visible state for the chatbot window */
#it-chatbot-window:not(.it-chatbot-hidden) {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Chatbot Header */
#chatbot-header {
    background: #4571bb;
    color: #ffffff;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    position: relative;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}
#chatbot-heading {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin: 0;
}
#chatbot-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: transform 0.2s ease-in-out;
}
#chatbot-close-button:hover {
    transform: scale(1.2);
}

/* Chat Window Content Area (scrollable messages) */
#chat-window-content {
    flex: 1 1 0% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 1rem;
    background-color: #ffffff;
    box-shadow: inset 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
#welcome-message {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    margin-top: 1rem;
}

/* Message alignment and styling using Bootstrap 3 floats */
.message-bubble {
    padding: 0.75rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
    margin-bottom: 0.75rem;
    max-width: 80%;
    clear: both;
}
.user-message {
    background-color: #3b82f6;
    color: white;
    float: right !important;
}
.bot-message {
    background-color: #e5e7eb;
    color: #1f2937;
    float: left !important;
}

/* FIX: Input and button positioning */
#it-chatbot-window .p-4 {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #f8f9fa; /* Consistent background color */
    padding: 1rem !important;
    border-top: 1px solid #dee2e6;
}
#it-chatbot-window .d-flex {
    display: flex !important;
    align-items: center !important;
}

#it-chatbot-window .form-control {
    flex: 1;
    min-height: 3rem;
}

#it-chatbot-window .btn {
    margin-left: 0.5rem;
}

textarea#chat-input.form-control {
    resize: none;
    height: 3rem;
    min-height: 3rem;
    max-height: 9.375rem;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.5rem;
    transition: height 0.2s ease-in-out;
}
button#send-button.btn.btn-primary {
    color: #ffffff;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease-in-out;
    border: none;
    cursor: pointer;
}
button#send-button.btn.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5), 0 0 0 4px rgba(59, 130, 246, 0.25);
}
button#send-button.btn.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading Spinner */
.loader {
    float: left;
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 0;
}
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #2563eb;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: inline-block;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 600px) {
    #it-chatbot-floating-wrapper {
        bottom: 10px;
        right: 10px;
    }
    #it-chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 80px);
        bottom: 70px;
        right: 0;
        left: auto;
    }
    #it-chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    #chatbot-heading {
        font-size: 1rem;
    }
    #chat-window-content .message-bubble {
        max-width: 85%;
    }
}
