/*************************************************
 * RESET SÉCURITÉ — EMPÊCHE TOUT BUG DE SCROLL
 *************************************************/
#chatbotx-window,
#chatbotx-body,
#chatbotx-input-area {
    box-sizing: border-box !important;
}

/*************************************************
 * FENÊTRE DU CHATBOT
 *************************************************/
#chatbotx-window {
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 350px;
    height: 520px;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);

    transform: scale(0);
    transform-origin: bottom right;
    transition: 0.25s ease-in-out;

    z-index: 999999;
}

#chatbotx-window.chatbotx-open {
    transform: scale(1);
}

/*************************************************
 * HEADER
 *************************************************/
.chatbotx-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    background: var(--cbx-color, #6c63ff);
    color: #fff;
    font-weight: bold;
    font-size: 1.1rem;
}

#chatbotx-close {
    cursor: pointer;
    font-size: 28px;
    margin-left: auto;
}

/*************************************************
 * CONTENU DU CHAT
 *************************************************/
#chatbotx-body {
    height: calc(100% - 135px);
    padding: 15px;
    overflow-y: auto;
    background: #f7f7ff;
    -webkit-overflow-scrolling: touch;
}

.chatbotx-msg {
    margin-bottom: 12px;
    display: flex;
}

.chatbotx-msg.bot { justify-content: flex-start; }
.chatbotx-msg.user { justify-content: flex-end; }

.bubble {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    font-size: 15px;
    line-height: 1.4;
}

.bot-bubble {
    background: #e1e6ff;
    color: #111;
    border-bottom-left-radius: 6px;
}

.user-bubble {
    background: var(--cbx-color, #6c63ff);
    color: #fff;
    border-bottom-right-radius: 6px;
}

/*************************************************
 * INPUT ZONE
 *************************************************/
#chatbotx-input-area {
    height: 65px;
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #ddd;
}

#chatbotx-user-input {
    flex: 1;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid #ccc;
    font-size: 14px;
}

#chatbotx-send-btn {
    width: 55px;
    background: var(--cbx-color, #6c63ff);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

/*************************************************
 * BOUTON FLOTTANT
 *************************************************/
#chatbotx-bubble {
    position: fixed;
    bottom: 25px;
    right: 20px;
    width: 70px;
    height: 70px;
    background: var(--cbx-color, #6c63ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    cursor: pointer;
    z-index: 999998;
}

#chatbotx-bubble img {
    width: 40px;
    height: 40px;
}

/*************************************************
 * MOBILE — FIX COMPLET
 *************************************************/
@media (max-width: 600px) {
    #chatbotx-window {
        width: 95% !important;
        height: 80% !important;
        left: 50%;
        bottom: 90px;
        transform: translateX(-50%) scale(0);
        right: auto;
        max-width: 95%;
        max-height: 80%;
    }

    #chatbotx-window.chatbotx-open {
        transform: translateX(-50%) scale(1);
    }

    #chatbotx-body {
        height: calc(100% - 135px) !important;
    }

    html, body {
        height: 100%;
        overflow: hidden !important;
    }
}