#ksbl-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ───────────────────────────────────────── */
/* FLOATING CHAT BUBBLE */
/* ───────────────────────────────────────── */

#ksbl-chat-bubble {
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 51, 102, 0.35);
    transition: all 0.3s ease;
    animation: ksblPulse 2s infinite;
}

#ksbl-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 30px rgba(0, 51, 102, 0.45);
}

@keyframes ksblPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 51, 102, 0.5), 0 6px 20px rgba(0, 51, 102, 0.35);
    }

    70% {
        box-shadow: 0 0 0 16px rgba(0, 51, 102, 0), 0 6px 20px rgba(0, 51, 102, 0.35);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 51, 102, 0), 0 6px 20px rgba(0, 51, 102, 0.35);
    }
}

.ksbl-chat-bubble-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ksbl-chat-bubble-icon svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* ───────────────────────────────────────── */
/* CHAT WINDOW */
/* ───────────────────────────────────────── */

#ksbl-chat-window {
    width: 400px;
    height: 580px;
    background: #fff;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.ksbl-hidden {
    display: none !important;
}

/* ───────────────────────────────────────── */
/* HEADER */
/* ───────────────────────────────────────── */

#ksbl-chat-header {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo-wrap {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    flex-shrink: 0;
}

.header-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(0.85);
    object-position: center;
    display: block;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.header-name {
    font-size: 15px;
    font-weight: 700;
}

.header-status {
    font-size: 11px;
    color: #90ee90;
}

#ksbl-chat-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ksbl-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ───────────────────────────────────────── */
/* MESSAGES AREA */
/* ───────────────────────────────────────── */

#ksbl-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    background: #f4f6f9;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ───────────────────────────────────────── */
/* MESSAGE ROW */
/* ───────────────────────────────────────── */

.ksbl-msg-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
    animation: ksblFadeIn 0.2s ease;
}

.ksbl-msg-wrapper.user {
    justify-content: flex-end;
}

.ksbl-msg-wrapper.assistant {
    justify-content: flex-start;
}

@keyframes ksblFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ───────────────────────────────────────── */
/* MESSAGE ICONS — KEY FIX HERE             */
/* background matches KSBL logo dark blue   */
/* padding: 0 so image fills the circle     */
/* ───────────────────────────────────────── */

.ksbl-msg-icon-wrap {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: #0d2a4e;
    /* dark blue bg */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    padding: 0;
    box-sizing: border-box;
}

.ksbl-msg-icon-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(0.85);
    object-position: center;
    display: block;
    border-radius: 50%;
}

.ksbl-msg-icon-wrap.fallback {
    background: #003366;
    color: white;
    font-size: 13px;
    font-weight: 700;
}

/* ───────────────────────────────────────── */
/* MESSAGE BUBBLES */
/* ───────────────────────────────────────── */

.ksbl-msg {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
}

.ksbl-msg.user {
    background: linear-gradient(135deg, #003366, #004a99);
    color: white;
    border-bottom-right-radius: 4px;
}

.ksbl-msg.assistant {
    background: white;
    color: #222;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

/* ───────────────────────────────────────── */
/* TYPING */
/* ───────────────────────────────────────── */

.ksbl-typing-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 2px;
    height: 20px;
}

.ksbl-typing-dots span {
    width: 7px;
    height: 7px;
    background-color: #aaa;
    border-radius: 50%;
    animation: ksblBounce 1.2s infinite ease-in-out;
}

.ksbl-typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.ksbl-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ksbl-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes ksblBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        background-color: #bbb;
    }

    30% {
        transform: translateY(-6px);
        background-color: #003366;
    }
}

/* ───────────────────────────────────────── */
/* INPUT */
/* ───────────────────────────────────────── */

#ksbl-chat-input-area {
    padding: 12px 14px;
    background: white;
    border-top: 1px solid #e8eaed;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

#ksbl-chat-input {
    flex: 1;
    border: 1.5px solid #dde1e8;
    border-radius: 22px;
    padding: 10px 14px;
    resize: none;
    font-size: 14px;
    outline: none;
    max-height: 100px;
    overflow-y: auto;
}

#ksbl-chat-input:focus {
    border-color: #003366;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.08);
}

#ksbl-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #003366;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#ksbl-chat-send:hover {
    background: #004a99;
}

#ksbl-chat-send svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* ───────────────────────────────────────── */
/* FOOTER */
/* ───────────────────────────────────────── */

#ksbl-chat-footer {
    padding: 6px;
    text-align: center;
    font-size: 10px;
    color: #aaa;
    background: white;
}

/* ───────────────────────────────────────── */
/* MOBILE */
/* ───────────────────────────────────────── */

@media (max-width: 480px) {
    #ksbl-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        border-radius: 16px;
    }

    #ksbl-chat-widget {
        right: 10px;
        bottom: 14px;
    }
}