/* Widget Button */
#kbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Sarabun', sans-serif;
}

#kbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #2e7d32;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(46,125,50,0.4);
    font-size: 24px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
#kbot-toggle:hover { background: #1b5e20; transform: scale(1.05); }

/* Chat Box */
#kbot-box {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 340px;
    height: 480px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: kbotSlideUp 0.3s ease;
}
@keyframes kbotSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header */
#kbot-header {
    background: #2e7d32;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
#kbot-header img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
}
#kbot-header strong { display: block; font-size: 15px; }
#kbot-header span   { font-size: 12px; opacity: 0.85; }

/* Messages */
#kbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9fbe7;
}
.kbot-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}
.kbot-bot {
    background: #fff;
    border: 1px solid #e0e0e0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.kbot-user {
    background: #2e7d32;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
#kbot-typing {
    padding: 8px 16px;
    display: flex;
    gap: 4px;
    align-items: center;
}
#kbot-typing span {
    width: 8px; height: 8px;
    background: #2e7d32;
    border-radius: 50%;
    animation: kbotBounce 1.2s infinite;
}
#kbot-typing span:nth-child(2) { animation-delay: 0.2s; }
#kbot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes kbotBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%           { transform: translateY(-6px); }
}

/* Input Area */
#kbot-input-area {
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    background: #fff;
}
#kbot-input {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 80px;
    overflow-y: auto;
}
#kbot-input:focus { border-color: #2e7d32; }
#kbot-send {
    background: #2e7d32;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: background 0.2s;
}
#kbot-send:hover    { background: #1b5e20; }
#kbot-send:disabled { background: #aaa; cursor: not-allowed; }

/* Mobile */
@media (max-width: 400px) {
    #kbot-box { width: calc(100vw - 32px); right: -8px; }
}
