
#bmi-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fef9f0;
    border: 2px solid #D4AF37;
    overflow: hidden;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.3), 0 4px 20px rgba(212,175,55,.4);
    transition: transform .2s ease, box-shadow .2s ease;
    user-select: none;
}
#bmi-chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,.35), 0 6px 28px rgba(212,175,55,.55);
}
#bmi-chat-fab:active { transform: scale(.95); }

#bmi-chat-window {
    position: fixed;
    bottom: 92px;
    right: 24px;
    z-index: 9998;
    width: 380px;
    height: 520px;
    background: #f1f5f9;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,.35), 0 2px 10px rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(.97);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
}
#bmi-chat-window.bmi-chat-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

#bmi-chat-header {
    background: #0b1225;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(212,175,55,.2);
}
#bmi-chat-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color .15s, background .15s;
}
#bmi-chat-close:hover { color: #fff; background: rgba(255,255,255,.08); }

#bmi-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
#bmi-chat-messages::-webkit-scrollbar { width: 4px; }
#bmi-chat-messages::-webkit-scrollbar-track { background: transparent; }
#bmi-chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.bmi-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    animation: bmi-msg-in .18s ease;
}
@keyframes bmi-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.bmi-msg-bot {
    background: #0b1225;
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}
.bmi-msg-bot a {
    color: #D4AF37;
    text-decoration: underline;
}
.bmi-msg-user {
    background: #D4AF37;
    color: #0b1225;
    font-weight: 600;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Typing indicator */
.bmi-typing {
    background: #0b1225;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    padding: 12px 16px;
    display: flex;
    gap: 5px;
    align-items: center;
}
.bmi-typing span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: bmi-bounce .9s infinite ease-in-out;
}
.bmi-typing span:nth-child(2) { animation-delay: .15s; }
.bmi-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bmi-bounce {
    0%,60%,100% { transform: translateY(0); }
    30%          { transform: translateY(-5px); }
}

#bmi-chat-quickbtns {
    padding: 0 12px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
}
.bmi-qbtn {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #0b1225;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 11px;
    border-radius: 20px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    font-family: inherit;
    white-space: nowrap;
}
.bmi-qbtn:hover { background: #fef9ec; border-color: #D4AF37; color: #0b1225; }

#bmi-chat-inputbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
#bmi-chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    padding: 9px 14px;
    font-size: 13.5px;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    color: #0f172a;
    background: #f8fafc;
    outline: none;
    transition: border-color .15s;
}
#bmi-chat-input:focus { border-color: #D4AF37; }
#bmi-chat-input::placeholder { color: #94a3b8; }
#bmi-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #D4AF37;
    border: none;
    color: #0b1225;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .1s;
}
#bmi-chat-send:hover { background: #c9a328; transform: scale(1.06); }
#bmi-chat-send:active { transform: scale(.94); }

@media (max-width: 480px) {
    #bmi-chat-window {
        width: 100%;
        height: 70vh;
        bottom: 0;
        right: 0;
        border-radius: 18px 18px 0 0;
    }
    #bmi-chat-fab {
        bottom: 16px;
        right: 16px;
    }
    #bmi-chat-quickbtns { gap: 5px; }
    .bmi-qbtn { font-size: 11px; padding: 5px 9px; }
}
