/* ── WP AI Chatbot — Chat Widget ──────────────────────────────────────────── */
:root {
    --wpaic-color: #6366f1;
    --wpaic-color-dark: #4f46e5;
    --wpaic-radius: 16px;
    --wpaic-shadow: 0 8px 40px rgba(0,0,0,.18);
    --wpaic-z: 9999;
}

/* Launcher button */
#wpaic-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--wpaic-z);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--wpaic-color);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99,102,241,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, background .2s;
}
#wpaic-launcher:hover { background: var(--wpaic-color-dark); transform: scale(1.08); }
#wpaic-launcher svg   { width: 26px; height: 26px; fill: #fff; }
#wpaic-launcher.wpaic-pos-left { right: auto; left: 24px; }

/* Unread badge */
#wpaic-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

/* Chat window */
#wpaic-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: var(--wpaic-z);
    width: 370px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: var(--wpaic-radius);
    box-shadow: var(--wpaic-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(.9) translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .25s;
    max-height: 560px;
}
#wpaic-window.wpaic-open { transform: scale(1) translateY(0); opacity: 1; pointer-events: all; }
#wpaic-window.wpaic-pos-left { right: auto; left: 24px; }

/* Header */
#wpaic-header {
    background: var(--wpaic-color);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
#wpaic-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
#wpaic-header-info { flex: 1; line-height: 1.2; }
#wpaic-bot-name  { font-weight: 700; font-size: .95rem; }
#wpaic-bot-status{ font-size: .72rem; opacity: .85; }
#wpaic-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: .8;
    font-size: 18px;
    line-height: 1;
}
#wpaic-close:hover { opacity: 1; }

/* Messages area */
#wpaic-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9ff;
    min-height: 260px;
    max-height: 360px;
}

.wpaic-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: .875rem;
    line-height: 1.55;
    word-break: break-word;
    animation: wpaic-pop .18s ease;
}
@keyframes wpaic-pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.wpaic-bubble-bot  { background: #fff; border: 1px solid #e5e7eb; align-self: flex-start; border-bottom-left-radius: 4px; }
.wpaic-bubble-user { background: var(--wpaic-color); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

/* Typing indicator */
.wpaic-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    align-items: center;
}
.wpaic-dot {
    width: 7px; height: 7px;
    background: #9ca3af;
    border-radius: 50%;
    animation: wpaic-bounce 1.2s infinite;
}
.wpaic-dot:nth-child(2) { animation-delay: .2s; }
.wpaic-dot:nth-child(3) { animation-delay: .4s; }
@keyframes wpaic-bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* Input area */
#wpaic-form {
    padding: 12px 14px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    background: #fff;
    flex-shrink: 0;
}
#wpaic-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: .875rem;
    outline: none;
    resize: none;
    height: 40px;
    max-height: 100px;
    overflow-y: auto;
    font-family: inherit;
    transition: border-color .15s;
}
#wpaic-input:focus { border-color: var(--wpaic-color); }
#wpaic-send {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--wpaic-color);
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
#wpaic-send:hover { background: var(--wpaic-color-dark); }
#wpaic-send svg { fill: #fff; width: 17px; height: 17px; }
#wpaic-send:disabled { opacity: .5; cursor: not-allowed; }

/* Lead score bar (subtle, bottom of window) */
#wpaic-lead-bar {
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    width: 0%;
    transition: width .6s ease;
}

/* Responsive */
@media (max-width: 420px) {
    #wpaic-window { right: 8px; left: 8px; width: auto; bottom: 80px; }
}
