.chatbot {
    display: flex;
    flex-direction: column;
    row-gap: 10px;
    align-items: flex-end;
    position: relative;
    width: auto;
    margin: 0;
    padding: 0;
}
.chatbot button {
    height: 50px !important;
    width: 50px !important;
}
.chatbot .card {
    border-radius: 24px;
    box-shadow: rgba(16, 24, 40, 0.4) 0px 4px 6px -2px;
    border: 0px;
    width: 320px;
    max-width: 100%;
    max-height: 420px;
}
.chatbot .card-header {
    background-color: #E71618;
    color: white;
    border-radius: 24px 24px 0 0;
    padding: 15px;
    font-weight: bold;
    text-align: center;
}
.chatbot .chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 15px;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chatbot .message-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.chatbot .message-wrapper.user {
    justify-content: flex-end;
}
.chatbot .bot-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background-color: #E71618;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}
.chatbot .user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background-color: #E71618;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}
.chatbot .message {
    padding: 10px;
    border-radius: 10px;
    max-width: 85%;
    word-wrap: break-word;
}
.chatbot .message.user {
    background-color: #E71618;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}
.chatbot .message.bot {
    background-color: #e0e0e0;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}
.chatbot .bot-references {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.08);
    font-size: 13px;
    color: #333;
}
.chatbot .bot-references .reference-item {
    margin-top: 4px;
}
.chatbot .bot-references .reference-item a {
    color: #E71618;
    text-decoration: underline;
}
.chatbot .loading-message {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f7f7f7;
    padding: 10px;
    border-radius: 10px;
    color: #555;
    font-style: italic;
}
.chatbot .chat-input-group {
    padding: 12px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 24px 24px;
    display: flex;
    gap: 8px;
}
.chatbot .chat-input-group input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
}
.chatbot .chat-input-group button {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
}
.chatbot .btn-primary {
    background-color: #E71618;
    border: none;
}
.chatbot .btn-primary:hover {
    background-color: #c80b0f;
}

@media (max-width: 767px) {
    .chatbot {
        width: auto;
        padding: 0;
        row-gap: 8px;
        align-items: center !important;
        position: static;
        margin: 0 auto !important;
    }
    .chatbot > button {
        align-self: flex-end !important;
        margin: 0 !important;
        position: static !important;
        left: auto !important;
        bottom: auto !important;
        z-index: auto !important;
    }
    .chatbot .collapse {
        position: fixed !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -13%) !important;
        width: min(320px, 90vw) !important;
        max-width: 90vw !important;
        max-height: 75vh !important;
        margin: 0 !important;
        z-index: 1200 !important;
        border-radius: 18px !important;
    }
    .chatbot .collapse .card {
        width: 100% !important;
        max-height: 75vh !important;
        border-radius: 18px !important;
    }
    .chatbot button {
        height: 44px !important;
        width: 44px !important;
    }
    .chatbot button {
        height: 44px !important;
        width: 44px !important;
    }
    .chatbot .card {
        width: min(320px, 90vw);
        max-width: 90vw;
        max-height: min(74vh, 460px);
        border-radius: 18px;
    }
    .chatbot .card-header {
        padding: 10px;
        font-size: 14px;
    }
    .chatbot .chat-messages {
        height: min(54vh, 250px);
        padding: 10px;
    }
    .chatbot .message {
        max-width: 88%;
        font-size: 13px;
    }
    .chatbot .bot-avatar,
    .chatbot .user-avatar {
        width: 26px;
        height: 26px;
        min-width: 26px;
        font-size: 15px;
    }
    .chatbot .chat-input-group {
        padding: 8px;
        gap: 6px;
    }
    .chatbot .chat-input-group input {
        font-size: 13px;
        padding: 8px 10px;
    }
    .chatbot .chat-input-group button {
        width: 36px !important;
        height: 36px !important;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .chatbot .card {
        width: min(420px, 72vw);
    }
    .chatbot .chat-messages {
        height: 280px;
    }
    .chatbot .message {
        max-width: 88%;
    }
}