/* ===========================================================
   Chatbot AI widget — Công ty CP Gỗ MDF VRG Kiên Giang
   =========================================================== */
#mdf-chat-launcher,
#mdf-chat-window,
#mdf-chat-window * { box-sizing: border-box; }

#mdf-chat-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0b7a34;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease, background .2s ease;
}
#mdf-chat-launcher:hover { background: #096328; transform: scale(1.05); }
#mdf-chat-launcher svg { width: 30px; height: 30px; fill: #fff; }
#mdf-chat-launcher .mdf-badge {
    position: absolute; top: -4px; right: -4px;
    background: #e53935; color:#fff; font: 700 11px/16px Arial, sans-serif;
    min-width: 16px; height:16px; padding:0 4px; border-radius: 9px; text-align:center;
}

#mdf-chat-window {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 370px;
    max-width: calc(100vw - 24px);
    height: 540px;
    max-height: calc(100vh - 110px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,.28);
    z-index: 2147483000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
#mdf-chat-window.mdf-open { display: flex; }

.mdf-head {
    background: #0b7a34;
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mdf-head .mdf-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(255,255,255,.2);
    display:flex; align-items:center; justify-content:center; flex: 0 0 auto;
}
.mdf-head .mdf-avatar svg { width: 20px; height: 20px; fill:#fff; }
.mdf-head .mdf-title { font-size: 15px; font-weight: 700; line-height: 1.2; }
.mdf-head .mdf-sub { font-size: 11px; opacity: .85; }
.mdf-head .mdf-close {
    margin-left: auto; background: none; border: none; color:#fff;
    font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px;
}

.mdf-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px;
    background: #f5f6f8;
}
.mdf-msg { display: flex; margin-bottom: 12px; }
.mdf-msg .mdf-bubble {
    max-width: 82%;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.mdf-msg.bot .mdf-bubble { background: #fff; color: #222; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }
.mdf-msg.user { justify-content: flex-end; }
.mdf-msg.user .mdf-bubble { background: #0b7a34; color: #fff; border-bottom-right-radius: 4px; }
.mdf-bubble a { color: inherit; text-decoration: underline; }
.mdf-msg.bot .mdf-bubble a { color: #0b7a34; }

.mdf-typing span {
    display:inline-block; width:7px; height:7px; margin:0 2px; border-radius:50%;
    background:#9aa0a6; animation: mdf-blink 1.2s infinite both;
}
.mdf-typing span:nth-child(2){ animation-delay:.2s }
.mdf-typing span:nth-child(3){ animation-delay:.4s }
@keyframes mdf-blink { 0%,80%,100%{opacity:.2} 40%{opacity:1} }

.mdf-foot {
    border-top: 1px solid #e5e7eb;
    padding: 8px;
    display: flex;
    gap: 8px;
    background:#fff;
}
.mdf-foot textarea {
    flex: 1 1 auto;
    resize: none;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 14px;
    font-family: inherit;
    max-height: 90px;
    outline: none;
}
.mdf-foot textarea:focus { border-color: #0b7a34; }
.mdf-foot button {
    flex: 0 0 auto;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: none;
    background: #0b7a34;
    color: #fff;
    cursor: pointer;
    display:flex; align-items:center; justify-content:center;
}
.mdf-foot button:disabled { background:#9aa0a6; cursor: default; }
.mdf-foot button svg { width: 20px; height: 20px; fill:#fff; }

.mdf-powered { text-align:center; font-size:10px; color:#9aa0a6; padding:4px 0 6px; background:#fff; }

@media (max-width: 480px){
    #mdf-chat-window { right: 8px; left: 8px; bottom: 84px; width: auto; height: calc(100vh - 100px); }
    #mdf-chat-launcher { right: 14px; bottom: 14px; }
}
