/* ── TQM Chatbot Widget ──────────────────────────────────────── */
#tqm-chatbot-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #1a56db;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(26,86,219,.45);
    z-index: 99999;
    transition: transform .2s, box-shadow .2s;
}
#tqm-chatbot-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(26,86,219,.55);
}
#tqm-chatbot-bubble svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}
.tqm-bubble-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* ── Chat Window ─────────────────────────────────────────────── */
#tqm-chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(.97);
    transition: opacity .25s, transform .25s;
}
#tqm-chatbot-window.open {
    opacity: 1;
    pointer-events: all;
    transform: none;
}

/* ── Header ──────────────────────────────────────────────────── */
.tqm-chat-header {
    background: linear-gradient(135deg, #1e3a8a, #1a56db);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.tqm-chat-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.tqm-chat-title { font-size: 14px; font-weight: 700; }
.tqm-chat-subtitle { font-size: 11px; opacity: .8; margin-top: 1px; }
.tqm-chat-close {
    margin-left: auto;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
.tqm-chat-close:hover { background: rgba(255,255,255,.3); }

/* ── Messages ────────────────────────────────────────────────── */
.tqm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    -webkit-overflow-scrolling: touch;
}
.tqm-chat-messages::-webkit-scrollbar { width: 4px; }
.tqm-chat-messages::-webkit-scrollbar-track { background: transparent; }
.tqm-chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.tqm-msg {
    max-width: 82%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
}
.tqm-msg-bot {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.tqm-msg-user {
    background: #1a56db;
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}
.tqm-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    width: 50px;
    align-self: flex-start;
}
.tqm-typing span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: tqmBounce .9s infinite;
}
.tqm-typing span:nth-child(2) { animation-delay: .2s; }
.tqm-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes tqmBounce {
    0%,60%,100% { transform: none; }
    30% { transform: translateY(-5px); }
}

/* ── Suggestions ─────────────────────────────────────────────── */
.tqm-chat-suggestions {
    padding: 6px 10px 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.tqm-suggestion {
    background: #fff;
    border: 1.5px solid #1a56db;
    color: #1a56db;
    border-radius: 50px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.tqm-suggestion:hover { background: #1a56db; color: #fff; }

/* ── Input ───────────────────────────────────────────────────── */
.tqm-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
#tqm-chat-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 50px;
    padding: 9px 14px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    transition: border .15s;
    min-width: 0;
}
#tqm-chat-input:focus { border-color: #1a56db; }
#tqm-chat-send {
    width: 36px;
    height: 36px;
    background: #1a56db;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
#tqm-chat-send:hover { background: #1548c5; }
#tqm-chat-send svg { width: 16px; height: 16px; fill: #fff; }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #tqm-chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 70vh;
        border-radius: 20px 20px 0 0;
    }
    #tqm-chatbot-bubble {
        bottom: 16px;
        right: 16px;
    }
}

/* ── Theme override — force chatbot styles ───────────────────── */
body #tqm-chatbot-bubble,
body #tqm-chatbot-window,
body #tqm-chatbot-window * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Suggestion chips — force blue, override theme */
body .tqm-chat-suggestions .tqm-suggestion,
body #tqm-chat-suggestions .tqm-suggestion {
    background: #fff !important;
    border: 1.5px solid #1a56db !important;
    color: #1a56db !important;
    border-radius: 50px !important;
    padding: 6px 14px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: all .15s !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    line-height: 1.4 !important;
}
body .tqm-chat-suggestions .tqm-suggestion:hover,
body #tqm-chat-suggestions .tqm-suggestion:hover {
    background: #1a56db !important;
    color: #fff !important;
}

/* Messages */
body #tqm-chat-messages .tqm-msg-bot {
    background: #fff !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    border-bottom-left-radius: 4px !important;
}
body #tqm-chat-messages .tqm-msg-user {
    background: #1a56db !important;
    color: #fff !important;
    border: none !important;
    border-radius: 14px !important;
    border-bottom-right-radius: 4px !important;
}

/* Input */
body #tqm-chat-input {
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 50px !important;
    padding: 9px 14px !important;
    font-size: 13px !important;
    color: #1e293b !important;
    background: #fff !important;
    box-shadow: none !important;
    outline: none !important;
}
body #tqm-chat-input:focus {
    border-color: #1a56db !important;
    box-shadow: none !important;
}
body #tqm-chat-send {
    background: #1a56db !important;
    border: none !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}
body #tqm-chat-send svg {
    width: 16px !important;
    height: 16px !important;
    fill: #fff !important;
}
