.chatbot-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--bs-primary);
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    transition: transform 0.2s ease-in-out;
}
.chatbot-fab:hover {
    transform: scale(1.1);
}
.chatbot-fab .bi-robot {
    color: white;
    font-size: 2rem;
}
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 370px;
    max-width: 90vw;
    height: 70vh;
    max-height: 600px;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1050;
    transform-origin: bottom right;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: scale(0);
    opacity: 0;
}
.chat-window.open {
    transform: scale(1);
    opacity: 1;
}
.chat-header {
    background-color: var(--bs-primary);
    color: white;
    padding: 1rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}
.chat-body {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.chat-message {
    max-width: 80%;
    padding: 0.5rem 1rem;
    border-radius: 18px;
    word-wrap: break-word;
}
.chat-message.bot {
    background-color: #e9ecef;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.chat-message.user {
    background-color: var(--bs-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid #dee2e6;
}
.chat-footer .form-control {
    border-radius: 20px;
}
.chat-footer .input-group-text {
    cursor: pointer;
}

.chat-footer .input-group-text.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Source/Citation Styles */
.chat-sources {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #dee2e6;
}
.chat-sources h5 {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}
.chat-source-btn {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    margin: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--bs-primary);
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.chat-source-btn:hover {
    background-color: #d6dbe0;
}

/* --- Hide Chatbot UI on Print --- */
@media print {
    #chatbot-fab,
    #chat-window {
        display: none !important;
    }
}