/* ── WP Keyword Chatbot styles ────────────────────────────────── */

:root {
    --wpkc-color: #4f46e5;
    --wpkc-color-dark: #3730a3;
    --wpkc-radius: 16px;
    --wpkc-shadow: 0 8px 32px rgba(0,0,0,.18);
    --wpkc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --wpkc-z: 99999;
}

#wpkc-wrapper * {
    box-sizing: border-box;
    font-family: var(--wpkc-font);
}

/* ── Floating bubble ── */
#wpkc-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--wpkc-z);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--wpkc-color);
    border: none;
    cursor: pointer;
    box-shadow: var(--wpkc-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: transform .2s ease, background .2s;
    color: #fff;
    line-height: 1;
}
#wpkc-bubble:hover { background: var(--wpkc-color-dark); transform: scale(1.08); }
#wpkc-bubble-close { font-size: 28px; font-weight: 700; }

/* ── Chat window ── */
#wpkc-box {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: var(--wpkc-z);
    width: 340px;
    max-height: 520px;
    background: #fff;
    border-radius: var(--wpkc-radius);
    box-shadow: var(--wpkc-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(.97);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}
#wpkc-box.wpkc-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ── */
#wpkc-header {
    background: var(--wpkc-color);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
#wpkc-header-icon { font-size: 20px; }
#wpkc-header-name { font-weight: 600; font-size: 15px; flex: 1; }
#wpkc-close {
    background: none;
    border: none;
    color: rgba(255,255,255,.8);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    transition: color .15s;
}
#wpkc-close:hover { color: #fff; }

/* ── Messages ── */
#wpkc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
#wpkc-messages::-webkit-scrollbar { width: 4px; }
#wpkc-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.wpkc-msg {
    max-width: 82%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    animation: wpkcFadeIn .18s ease;
}
@keyframes wpkcFadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

.wpkc-bot {
    background: #f3f4f6;
    color: #111;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.wpkc-user {
    background: var(--wpkc-color);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing dots */
.wpkc-typing span {
    display: inline-block;
    width: 7px; height: 7px;
    background: #aaa;
    border-radius: 50%;
    margin: 0 2px;
    animation: wpkcDot 1.2s infinite ease-in-out;
}
.wpkc-typing span:nth-child(2) { animation-delay: .2s; }
.wpkc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes wpkcDot {
    0%,80%,100% { transform: scale(1);   opacity: .5; }
    40%          { transform: scale(1.4); opacity: 1;  }
}

/* ── Input row ── */
#wpkc-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}
#wpkc-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
#wpkc-input:focus { border-color: var(--wpkc-color); }
#wpkc-send {
    background: var(--wpkc-color);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
#wpkc-send:hover { background: var(--wpkc-color-dark); }

/* ── Mobile ── */
@media (max-width: 400px) {
    #wpkc-box { width: calc(100vw - 24px); right: 12px; bottom: 84px; }
    #wpkc-bubble { right: 12px; bottom: 12px; }
}
