.bdf-chat-button{
    position:fixed;
    right:20px;
    bottom:75px;
    width:64px;
    height:64px;
    border-radius:50%;
    background:linear-gradient(135deg,#006b3f,#d4af37);
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:26px;
    cursor:pointer;
    z-index:99999;
    box-shadow:0 18px 45px rgba(0,0,0,.35);
    transition:.3s ease;
}

.bdf-chat-button:hover{
    transform:scale(1.08);
    box-shadow:0 25px 55px rgba(0,0,0,.45);
}

.bdf-chat-button i{
    pointer-events:none;
}

.bdf-chat-box{
    position:fixed;
    right:20px;
    bottom:150px;
    width:380px;
    max-width:92vw;
    height:540px;
    background:#fff;
    border-radius:26px;
    overflow:hidden;
    display:none;
    flex-direction:column;
    z-index:99999;
    box-shadow:0 30px 80px rgba(15,23,42,.35);
    border:1px solid rgba(255,255,255,.25);
    animation:chatFadeIn .25s ease;
}

@keyframes chatFadeIn{
    from{
        opacity:0;
        transform:translateY(15px) scale(.96);
    }

    to{
        opacity:1;
        transform:translateY(0) scale(1);
    }
}

.bdf-chat-header{
    background:linear-gradient(135deg,#03180d,#006b3f);
    color:#fff;
    padding:18px 20px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    border-bottom:1px solid rgba(255,255,255,.08);
}

.bdf-chat-title{
    display:flex;
    align-items:center;
    gap:12px;
}

.bdf-chat-title i{
    width:42px;
    height:42px;
    border-radius:14px;
    background:rgba(255,255,255,.14);
    display:flex;
    align-items:center;
    justify-content:center;
    color:#d4af37;
    font-size:18px;
}

.bdf-chat-title strong{
    display:block;
    font-size:17px;
    line-height:1.1;
    font-weight:700;
}

.bdf-chat-title small{
    display:block;
    color:#d4af37;
    margin-top:4px;
    font-size:12px;
    letter-spacing:.5px;
}

#bdfChatClose{
    width:34px;
    height:34px;
    border-radius:50%;
    border:0;
    background:rgba(255,255,255,.12);
    color:#fff;
    font-size:24px;
    line-height:1;
    cursor:pointer;
    transition:.25s ease;
}

#bdfChatClose:hover{
    background:rgba(255,255,255,.22);
    transform:rotate(90deg);
}

.bdf-chat-start{
    padding:22px;
    background:linear-gradient(180deg,#f8fafc,#eef7f0);
    flex:1;
}

.bdf-chat-start input{
    height:50px;
    border-radius:15px;
    border:1px solid #d1d5db;
    font-size:15px;
    padding:0 16px;
    margin-bottom:14px;
    background:#fff;
    transition:.2s ease;
}

.bdf-chat-start input:focus{
    border-color:#006b3f;
    box-shadow:0 0 0 .18rem rgba(0,107,63,.15);
    outline:none;
}

#startChatBtn{
    height:52px;
    border-radius:16px;
    border:0;
    background:linear-gradient(135deg,#006b3f,#4f8f5f);
    color:#fff;
    font-weight:700;
    font-size:16px;
    letter-spacing:.3px;
    transition:.25s ease;
    box-shadow:0 14px 30px rgba(0,107,63,.28);
}

#startChatBtn:hover{
    transform:translateY(-2px);
    box-shadow:0 18px 30px rgba(0,107,63,.35);
}

.bdf-chat-area{
    height:100%;
    display:flex;
    flex-direction:column;
    background:#f8fafc;
}

.bdf-chat-messages{
    flex:1;
    padding:16px;
    overflow-y:auto;
    background:
        linear-gradient(180deg,#f8fafc,#eef2f7);
    scroll-behavior:smooth;
}

.bdf-chat-messages::-webkit-scrollbar{
    width:6px;
}

.bdf-chat-messages::-webkit-scrollbar-thumb{
    background:#cbd5e1;
    border-radius:999px;
}

.chat-msg{
    max-width:82%;
    padding:12px 14px;
    border-radius:18px;
    margin-bottom:12px;
    font-size:14px;
    line-height:1.45;
    word-wrap:break-word;
    animation:msgFade .2s ease;
}

@keyframes msgFade{
    from{
        opacity:0;
        transform:translateY(5px);
    }

    to{
        opacity:1;
        transform:translateY(0);
    }
}

.chat-msg.visitor{
    background:linear-gradient(135deg,#006b3f,#0b7d4c);
    color:#fff;
    margin-left:auto;
    border-bottom-right-radius:5px;
    box-shadow:0 10px 24px rgba(0,107,63,.22);
}

.chat-msg.agent,
.chat-msg.system{
    background:#fff;
    color:#0f172a;
    margin-right:auto;
    border-bottom-left-radius:5px;
    box-shadow:0 8px 20px rgba(15,23,42,.08);
}

.chat-msg strong{
    display:block;
    margin-bottom:4px;
    font-size:12px;
    opacity:.8;
}

.bdf-chat-input{
    display:flex;
    align-items:center;
    gap:10px;
    padding:12px;
    background:#fff;
    border-top:1px solid #e5e7eb;
}

.bdf-chat-input input{
    flex:1;
    height:46px;
    border-radius:999px;
    border:1px solid #d1d5db;
    padding:0 16px;
    outline:none;
    font-size:14px;
    transition:.2s ease;
}

.bdf-chat-input input:focus{
    border-color:#006b3f;
    box-shadow:0 0 0 .15rem rgba(0,107,63,.12);
}

.bdf-chat-input button{
    width:46px;
    height:46px;
    border-radius:50%;
    border:0;
    background:linear-gradient(135deg,#006b3f,#0b7d4c);
    color:#fff;
    cursor:pointer;
    transition:.25s ease;
    box-shadow:0 10px 24px rgba(0,107,63,.22);
}

.bdf-chat-input button:hover{
    transform:scale(1.06);
}

.bdf-chat-input button i{
    font-size:16px;
}

@media (max-width:768px){

    .bdf-chat-button{
        right:40px;
        bottom:100px;
        width:60px;
        height:60px;
        font-size:24px;
    }

    .bdf-chat-box{
        right:12px;
        bottom:170px;
        width:calc(100vw - 24px);
        height:72vh;
        border-radius:22px;
    }

}

.bdf-chat-attach{
    padding:10px 12px 0 12px;
    background:#fff;
}

.bdf-chat-attach input{
    width:100%;
    font-size:13px;
    border:1px dashed #94a3b8;
    border-radius:12px;
    padding:8px;
    background:#f8fafc;
}


.chat-attachment-link{
    display:inline-block;
    margin-top:6px;
    padding:6px 10px;
    border-radius:10px;
    background:#e2e8f0;
    color:#0f172a;
    font-size:13px;
    text-decoration:none;
    font-weight:700;
}

.modern-upload-wrapper{
    display:flex;
    align-items:center;
    gap:10px;
    position:relative;
}

.modern-file-input{
    display:none;
}

.modern-upload-btn{
    width:58px;
    height:58px;
    min-width:58px;
    border-radius:18px;
    background:linear-gradient(135deg,#006b3f,#0b7d4c);
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    cursor:pointer;
    font-size:22px;
    transition:.25s ease;
    box-shadow:
        0 12px 24px rgba(0,107,63,.25),
        inset 0 1px 0 rgba(255,255,255,.15);
}

.modern-upload-btn:hover{
    transform:translateY(-2px) scale(1.03);
    box-shadow:
        0 18px 38px rgba(0,107,63,.35),
        inset 0 1px 0 rgba(255,255,255,.15);
}

.modern-upload-btn:active{
    transform:scale(.96);
}

.modern-upload-btn i{
    pointer-events:none;
}

.selected-file-name{
    flex:1;
    min-width:0;
    background:#f8fafc;
    border:1px solid #e2e8f0;
    height:58px;
    border-radius:18px;
    display:flex;
    align-items:center;
    padding:0 16px;
    font-size:13px;
    color:#475569;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
}


.bdf-chat-box{
    display:none;
    flex-direction:column !important;
    overflow:hidden !important;
}

.bdf-chat-header{
    flex:0 0 auto !important;
    position:sticky !important;
    top:0 !important;
    z-index:20 !important;
}

.bdf-chat-area{
    flex:1 1 auto !important;
    min-height:0 !important;
    display:flex !important;
    flex-direction:column !important;
    overflow:hidden !important;
}

.bdf-chat-messages{
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow-y:auto !important;
    padding-bottom:12px !important;
}

.chat-bottom-panel{
    flex:0 0 auto !important;
    position:sticky !important;
    bottom:0 !important;
    z-index:20 !important;
    background:#fff !important;
    border-top:1px solid #e5e7eb !important;
}

/* =========================================================
   MOBILE CHAT FIX - KEEP HEADER AND FOOTER FIXED
   Only #chatMessages scrolls. Add this at the bottom.
   ========================================================= */
.bdf-chat-box{
    display:none;
    flex-direction:column !important;
    overflow:hidden !important;
}

.bdf-chat-header{
    flex:0 0 auto !important;
    position:relative !important;
    top:auto !important;
    z-index:20 !important;
}

.bdf-chat-start{
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow-y:auto !important;
}

.bdf-chat-area{
    flex:1 1 auto !important;
    min-height:0 !important;
    display:flex !important;
    flex-direction:column !important;
    overflow:hidden !important;
}

.bdf-chat-area.d-none{
    display:none !important;
}

.bdf-chat-messages{
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    padding-bottom:12px !important;
}

.chat-bottom-panel{
    flex:0 0 auto !important;
    display:flex !important;
    flex-direction:column !important;
    gap:8px !important;
    background:#fff !important;
    border-top:1px solid #e5e7eb !important;
    padding:8px 10px 10px !important;
    z-index:20 !important;
}

.chat-bottom-panel.d-none{
    display:none !important;
}

.bdf-chat-input{
    flex:0 0 auto !important;
    display:flex !important;
    align-items:center !important;
    gap:10px !important;
    padding:0 !important;
    background:#fff !important;
    border-top:0 !important;
}

.bdf-chat-input input{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    flex:1 1 auto !important;
    min-width:0 !important;
    height:46px !important;
}

.bdf-chat-input button{
    flex:0 0 46px !important;
}

.modern-upload-wrapper{
    flex:0 0 auto !important;
    width:100% !important;
}

.selected-file-name{
    min-width:0 !important;
}

@media (max-width:768px){
    .bdf-chat-box{
        right:8px !important;
        left:8px !important;
        bottom:88px !important;
        width:auto !important;
        max-width:none !important;
        height:78vh !important;
        max-height:78vh !important;
        border-radius:22px !important;
    }

    .bdf-chat-header{
        padding:14px 16px !important;
    }

    .modern-upload-btn{
        width:46px !important;
        height:46px !important;
        min-width:46px !important;
        border-radius:14px !important;
    }

    .selected-file-name{
        height:46px !important;
        border-radius:14px !important;
    }
}
