/* Floating Chatbot Button */
.chatbot-toggler {
    position: fixed;
    right: 40px !important;
    bottom: 35px !important;
    height: 50px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: #724ae8;
    border: none;
    outline: none;
    cursor: pointer;
    border-radius: 50%;
    z-index: 9999;
    transition: all 0.2s ease;
}

.chatbot-toggler span {
    position: absolute;
}

.chatbot-toggler span:last-child {
    opacity: 0;
}

.show-chatbot .chatbot-toggler span:first-child {
    opacity: 0;
}

.show-chatbot .chatbot-toggler span:last-child {
    opacity: 1;
}

/* Chatbot Popup */
.chatbot {
    position: fixed;
    right: 40px;
    bottom: 100px;
    width: 420px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 0 128px 0 rgba(0,0,0,0.1),
                0 32px 64px -48px rgba(0,0,0,0.5);
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.1s ease;
    transform-origin: bottom right;
}

.show-chatbot .chatbot {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

.chatbot header {
    background: #724ae8;
    padding: 16px 0;
    text-align: center;
    position: relative;
}

.chatbot header h2 {
    color: #fff;
    font-size: 1.4rem;
}

.chatbot header span {
    position: absolute;
    right: 20px;
    top: 50%;
    color: #fff;
    cursor: pointer;
    transform: translateY(-50%);
    display: none;
}

.chatbot .chatbox {
    height: 510px;
    overflow-y: auto;
    padding: 30px 20px 100px;
}

.chatbox .chat {
    display: flex;
}

.chatbox .incoming span {
    height: 32px;
    width: 32px;
    color: #fff;
    background: #724ae8;
    text-align: center;
    line-height: 32px;
    border-radius: 4px;
    margin: 0 10px 7px 0;
}

.chatbox .outgoing {
    margin: 20px 0;
    justify-content: flex-end;
}

.chatbox .chat p {
    color: #fff;
    max-width: 75%;
    font-size: 0.95rem;
    padding: 12px 16px;
    border-radius: 10px 10px 0 10px;
    background: #724ae8;
}

.chatbox .chat p.error {
    color: #721c24;
    background: #f8d7da;
}

.chatbox .incoming p {
    color: #000;
    background: #f2f2f2;
    border-radius: 10px 10px 10px 0;
}

/* Chat Input */
.chatbot .chat-input {
    position: absolute;
    bottom: 0;
    width: 100%;
    display: flex;
    gap: 5px;
    background: #fff;
    padding: 5px 20px;
    border-top: 1px solid #ccc;
}

.chat-input textarea {
    height: 55px;
    width: 100%;
    border: none;
    outline: none;
    font-size: 0.95rem;
    resize: none;
    padding: 16px 15px 16px 0;
}

.chat-input span {
    font-size: 1.75rem;
    cursor: pointer;
    color: #724ae8;
    align-self: flex-end;
    height: 55px;
    line-height: 55px;
    visibility: hidden;
}

.chat-input textarea:valid ~ span {
    visibility: visible;
}

/* Responsive */
@media(max-width: 490px) {
    .chatbot {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chatbot .chatbox {
        height: 90%;
    }

    .chatbot header span {
        display: inline;
    }
}
