/* ─── ChatbotPress AI — Frontend CSS (Light Theme) ─────────────────────────── */

/* Reset */
.cbp-widget *, .cbp-inline-widget * { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Trigger button ──────────────────────────────────────────────────────────── */
.cbp-trigger {
    position: fixed;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.16);
    z-index: 9998;
    transition: transform .2s, box-shadow .2s;
}
.cbp-trigger:hover { transform: scale(1.07); box-shadow: 0 6px 20px rgba(0,0,0,.22); }
.cbp-trigger svg   { width: 24px; height: 24px; color: #fff; }

.cbp-pos-bottom-right .cbp-trigger { bottom: 24px; right: 24px; }
.cbp-pos-bottom-left  .cbp-trigger { bottom: 24px; left:  24px; }

/* ── Panel ───────────────────────────────────────────────────────────────────── */
.cbp-panel {
    position: fixed;
    width: 360px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.14);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px) scale(.97);
    transition: opacity .22s ease, transform .22s ease;
}
.cbp-panel.cbp-open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}
.cbp-pos-bottom-right .cbp-panel { bottom: 92px; right: 24px; }
.cbp-pos-bottom-left  .cbp-panel { bottom: 92px; left:  24px; }

/* Inline */
.cbp-panel-inline {
    position: relative;
    width: 100%;
    height: 480px;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
    opacity: 1;
    pointer-events: all;
    transform: none;
}

/* ── Header ──────────────────────────────────────────────────────────────────── */
.cbp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    flex-shrink: 0;
}
.cbp-header-left    { display: flex; align-items: center; gap: 10px; }
.cbp-avatar-ring    { position: relative; }
.cbp-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    font-weight: 700;
}
.cbp-online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
}
.cbp-bot-name   { display: block; font-weight: 600; font-size: 14px; color: #1f2937; }
.cbp-bot-status { display: block; font-size: 11px; color: #6b7280; margin-top: 1px; }

/* Header on light background — adjust text */
.cbp-header[style*="#ffffff"] .cbp-bot-name,
.cbp-header[style*="#fff"]    .cbp-bot-name    { color: #111827; }
.cbp-header[style*="#ffffff"] .cbp-bot-status,
.cbp-header[style*="#fff"]    .cbp-bot-status  { color: #6b7280; }
.cbp-header[style*="#ffffff"] .cbp-avatar,
.cbp-header[style*="#fff"]    .cbp-avatar      { background: #f3f4f6; color: #6366f1; }

.cbp-close-btn {
    background: rgba(0,0,0,.06);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #374151;
    transition: background .15s;
}
.cbp-close-btn:hover { background: rgba(0,0,0,.12); }

/* ── Messages ────────────────────────────────────────────────────────────────── */
.cbp-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9fafb;
    scroll-behavior: smooth;
}
.cbp-messages::-webkit-scrollbar { width: 4px; }
.cbp-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Message bubbles */
.cbp-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.cbp-msg-user  { align-self: flex-end; flex-direction: row-reverse; }
.cbp-msg-bot   { align-self: flex-start; }

.cbp-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    color: #6366f1;
    font-weight: 700;
}

.cbp-msg-bubble {
    padding: 10px 13px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    word-break: break-word;
}
.cbp-msg-user  .cbp-msg-bubble { background: #6366f1; color: #fff; border-bottom-right-radius: 4px; }
.cbp-msg-bot   .cbp-msg-bubble { background: #fff; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

.cbp-msg-time { font-size: 10px; color: #9ca3af; margin-top: 3px; padding: 0 4px; }

/* ── Typing indicator ────────────────────────────────────────────────────────── */
.cbp-typing {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
}
.cbp-typing.cbp-visible { display: flex; }
.cbp-typing-bubble {
    display: flex;
    gap: 4px;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px 12px;
}
.cbp-typing-bubble span {
    width: 6px; height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: cbp-bounce .9s infinite;
}
.cbp-typing-bubble span:nth-child(2) { animation-delay: .15s; }
.cbp-typing-bubble span:nth-child(3) { animation-delay: .30s; }
@keyframes cbp-bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
.cbp-typing-label { font-size: 11px; color: #9ca3af; }

/* ── Input area ──────────────────────────────────────────────────────────────── */
.cbp-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}
.cbp-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 8px 8px 8px 14px;
    border: 1px solid #e5e7eb;
    transition: border-color .15s;
}
.cbp-input-wrapper:focus-within { border-color: #6366f1; background: #fff; }
.cbp-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    outline: none;
    max-height: 100px;
    font-family: inherit;
}
.cbp-input::placeholder { color: #9ca3af; }
.cbp-send-btn {
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity .15s, transform .1s;
}
.cbp-send-btn:disabled { opacity: .4; cursor: not-allowed; }
.cbp-send-btn:not(:disabled):hover { transform: scale(1.08); }
.cbp-send-btn svg { color: #fff; }
.cbp-input-hint { font-size: 10px; color: #d1d5db; text-align: center; margin-top: 6px; }

/* ── Mobile ──────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .cbp-panel {
        width: calc(100vw - 24px);
        height: calc(100dvh - 100px);
        bottom: 80px !important;
        right: 12px !important;
        left: 12px !important;
        border-radius: 12px;
    }
}
