:root{
    --z-base: 1;
    --z-content: 10;
    --z-sticky: 1000;
    --z-floating: 2000;
    --z-chat: 5000;
    --z-popup: 9999;
}

/* ==========================================
   CONTACT FIXE
========================================== */

.contact-fixed{
    position:fixed;
    left:15px;
    bottom:20px;

    display:flex;
    flex-direction:column;
    gap:12px;

    z-index: var(--z-floating);
}

.btn-whatsapp-fixe,
.btn-call-fixe{
    width:50px;
    height:50px;

    border-radius:50%;

    display:flex;
    align-items:center;
    justify-content:center;

    text-decoration:none;
    color:#fff;
    font-size:24px;

    box-shadow:0 8px 20px rgba(0,0,0,.20);

    transition:.3s;
}

.btn-call-fixe{
    background:#0c0457;
}

.btn-whatsapp-fixe{
    background:#110050;
    animation: whatsappPulse 2s infinite;
}

.btn-call-fixe:hover,
.btn-whatsapp-fixe:hover{
    transform:translateY(-4px);
}

/* ==========================================
   CHAT BUTTON
========================================== */

#chatbot-button{
    position:fixed;
    right:20px;
    bottom:20px;

    display:flex;
    align-items:center;
    gap:10px;

    padding:14px 22px;

    border:none;
    border-radius:50px;

    background:linear-gradient(135deg,#001122,#000b18);
    color:#fff;

    font-size:16px;
    font-weight:600;

    cursor:pointer;

    z-index: calc(var(--z-chat) + 1);

    box-shadow:0 8px 25px rgba(0,0,0,.20);

    transition:.3s;
}

#chatbot-button:hover{
    transform:translateY(-3px);
}

#chatbot-button i{
    font-size:22px;
}

/* ==========================================
   CHAT BOX
========================================== */

#chatbot-box{
    position:fixed;

    right:20px;
    bottom:90px;

    width:420px;
    height:460px;

    background:#fff;

    border-radius:22px;

    overflow:hidden;

    display:none;
    flex-direction:column;

    z-index: var(--z-chat);

    box-shadow:0 20px 50px rgba(0,0,0,.15);
}

/* ==========================================
   HEADER
========================================== */

#chatbot-header{
    display:flex;
    justify-content:space-between;
    align-items:center;

    padding:16px;

    background:linear-gradient(135deg,#0a66c2,#084a9b);

    color:#fff;
}

.chatbot-title{
    display:flex;
    align-items:center;
    gap:8px;
    font-weight:700;
}

.status-dot{
    width:10px;
    height:10px;
    border-radius:50%;
    background:#00d26a;
}

.close-chat{
    cursor:pointer;
    font-size:18px;
}

/* ==========================================
   MESSAGES
========================================== */

#chatbot-messages{
    flex:1;
    padding:18px;

    overflow-y:auto;

    display:flex;
    flex-direction:column;
    gap:12px;

    background:rgba(248,250,252,.95);
}

.message{
    display:flex;
    align-items:flex-end;
    gap:10px;

    opacity:0;
    transform:translateY(15px);
    transition:.3s;
}

.message.show{
    opacity:1;
    transform:translateY(0);
}

/* ==========================================
   AVATAR
========================================== */

.avatar{
    width:38px;
    height:38px;

    display:flex;
    align-items:center;
    justify-content:center;

    border-radius:50%;

    font-size:18px;
    flex-shrink:0;
}

/* ==========================================
   BUBBLES
========================================== */

.bubble{
    max-width:80%;

    padding:12px 16px;

    border-radius:18px;

    font-size:15px;
    line-height:1.6;

    word-break:break-word;

    box-shadow:0 3px 10px rgba(0,0,0,.08);
}

/* USER */
.user{
    justify-content:flex-end;
}

.user .avatar{
    order:2;
    background:#0a66c2;
    color:#fff;
}

.user .bubble{
    background:linear-gradient(135deg,#0a66c2,#084a9b);
    color:#fff;
    border-bottom-right-radius:6px;
}

/* BOT */
.bot{
    justify-content:flex-start;
}

.bot .avatar{
    background:linear-gradient(135deg,#6a11cb,#2575fc);
    color:#fff;
}

.bot .bubble{
    background:#fff;
    border:1px solid #ececec;
    color:#111;
    border-bottom-left-radius:6px;
}

/* TYPES */
.bot.greeting .bubble{ background:#e3f2fd; border-left:4px solid #2196f3; }
.bot.info .bubble{ background:#f1f8e9; border-left:4px solid #43a047; }
.bot.warning .bubble{ background:#fff3e0; border-left:4px solid #fb8c00; }
.bot.highlight .bubble{ background:#ede7f6; border-left:4px solid #7e57c2; }
.bot.success .bubble{ background:#e8f5e9; border-left:4px solid #2e7d32; }

/* ==========================================
   TYPING
========================================== */

.typing{
    display:flex;
    gap:5px;
    padding:12px 16px;
    border-radius:18px;
    background:#f1f1f1;
}

.typing span{
    width:8px;
    height:8px;
    border-radius:50%;
    background:#777;
    animation:bounce 1.2s infinite;
}

.typing span:nth-child(2){ animation-delay:.2s; }
.typing span:nth-child(3){ animation-delay:.4s; }

@keyframes bounce{
    0%,80%,100%{ transform:scale(0); }
    40%{ transform:scale(1); }
}

/* ==========================================
   INPUT
========================================== */

#chatbot-input{
    display:flex;
    gap:10px;

    padding:12px;
    border-top:1px solid #eee;
}

#chatbot-input input{
    flex:1;
    padding:12px 16px;

    border:1px solid #ddd;
    border-radius:30px;

    outline:none;
    font-size:15px;
}

#chatbot-input input:focus{
    border-color:#0a66c2;
}

#chatbot-input button{
    width:48px;
    height:48px;

    border:none;
    border-radius:50%;

    background:#0a66c2;
    color:#fff;

    cursor:pointer;

    transition:.3s;
}

#chatbot-input button:hover{
    transform:scale(1.05);
}

/* ==========================================
   POPUP
========================================== */

.popup{
    z-index: var(--z-popup);
}

/* ==========================================
   LINK FIX
========================================== */

.bubble a{
    color:#b40505;
    text-decoration:underline;
    font-weight:500;

    position:relative;
    z-index:1;
}

/* ==========================================
   WHATSAPP ANIMATION
========================================== */

@keyframes whatsappPulse{
    0%{
        box-shadow:0 0 0 0 rgba(37,211,102,.5);
    }
    70%{
        box-shadow:0 0 0 15px rgba(37,211,102,0);
    }
    100%{
        box-shadow:0 0 0 0 rgba(37,211,102,0);
    }
}

/* ==========================================
   RESPONSIVE TABLET
========================================== */

@media (max-width:768px){

    #chatbot-box{
        left:10px;
        right:10px;
        width:auto;

        bottom:85px;
        height:75vh;

        border-radius:18px;
    }

    #chatbot-button{
        width:56px;
        height:56px;
        padding:0;

        justify-content:center;
        align-items:center;
    }

    .chat-text{
        display:none;
    }

    .contact-fixed{
        left:10px;
        bottom:10px;
        transform:scale(0.95);
        gap:10px;
    }

    .btn-whatsapp-fixe,
    .btn-call-fixe{
        width:46px;
        height:46px;
        font-size:20px;
    }
}

/* ==========================================
   RESPONSIVE MOBILE
========================================== */

@media (max-width:480px){

    #chatbot-box{
        left:5px;
        right:5px;
        height:80vh;
        bottom:10px;
    }

    .bubble{
        font-size:14px;
    }

    #chatbot-input input{
        font-size:14px;
    }

    #chatbot-input button{
        width:44px;
        height:44px;
    }
}

#chatbot-box.active{
    z-index: calc(var(--z-popup) + 10);
}

#chatbot-button.active{
    z-index: calc(var(--z-popup) + 20);
}

#chatbot-box.active{
    z-index: 100000 !important;
}

#chatbot-button.active{
    z-index: 100001 !important;
}

#chatbot-box {
    z-index: 999999 !important;
}

#chatbot-button {
    z-index: 999998 !important;
}

/* =========================
   TABLETTE + MOBILE
========================= */
@media (max-width: 768px) {

    #chatbot-button {
        width: 58px;
        height: 58px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }

    /* cacher le texte */
    #chatbot-button .chat-text {
        display: none;
    }

    /* agrandir l'icône si besoin */
    #chatbot-button i {
        font-size: 24px;
    }
}

/* =========================
   PETIT MOBILE
========================= */
@media (max-width: 480px) {

    #chatbot-button {
        width: 54px;
        height: 54px;
    }
}