/* Website AI chat assistant. Every class starts with pe-cb- so the theme's styles never clash. */
#pe-chatbot-root {
    --pe-cb-primary: #2E3192;
    --pe-cb-primary-dark: #1f2170;
    --pe-cb-accent: #ED1D25;
    --pe-cb-online: #22c55e;
    --pe-cb-bg: #ffffff;
    --pe-cb-soft: #f3f5fb;
    --pe-cb-border: #e3e7f1;
    --pe-cb-text: #1b2336;
    --pe-cb-muted: #6b7489;
    --pe-cb-shadow: 0 18px 50px rgba(16, 38, 84, .22);
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--pe-cb-text);
}
#pe-chatbot-root *, #pe-chatbot-root *::before, #pe-chatbot-root *::after { box-sizing: border-box; }
#pe-chatbot-root button { font-family: inherit; }

/* Launcher: sits above the WhatsApp button */
.pe-cb-launcher {
    position: fixed; right: 3%; bottom: 152px; z-index: 10000;
    width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
    background: linear-gradient(135deg, var(--pe-cb-primary), #5b4bd6);
    color: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(46, 49, 146, .4);
    transition: transform .2s ease, box-shadow .2s ease;
}
.pe-cb-launcher:hover { transform: scale(1.07); box-shadow: 0 10px 28px rgba(46, 49, 146, .5); }
.pe-cb-launcher:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 3px; }
.pe-cb-launcher svg { width: 28px; height: 28px; }
.pe-cb-launcher::before {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid rgba(91, 75, 214, .55); animation: pe-cb-pulse 2.2s ease-out infinite;
}
/* "AI Assistant" label to the left of the round button */
.pe-cb-launcher-tag {
    position: absolute; right: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    padding: 7px 14px; border-radius: 999px; white-space: nowrap;
    background: #fff; color: var(--pe-cb-primary); font-size: 14px; font-weight: 700; line-height: 1.2;
    box-shadow: 0 6px 18px rgba(16, 38, 84, .22); pointer-events: none;
    transition: transform .2s ease;
}
.pe-cb-launcher-tag::after {
    content: ""; position: absolute; right: -5px; top: 50%; width: 10px; height: 10px;
    background: #fff; transform: translateY(-50%) rotate(45deg); border-radius: 2px;
}
.pe-cb-launcher:hover .pe-cb-launcher-tag { transform: translateY(-50%) translateX(-3px); }
.pe-cb-badge {
    position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 10px; background: var(--pe-cb-accent); color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.pe-cb-open .pe-cb-launcher { display: none; }
@keyframes pe-cb-pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.55); opacity: 0; } }

/* Panel */
.pe-cb-panel {
    position: fixed; right: 3%; bottom: 24px; z-index: 10001;
    width: 400px; height: 600px; max-height: calc(100vh - 48px);
    background: var(--pe-cb-bg); border-radius: 18px; box-shadow: var(--pe-cb-shadow);
    border: 1px solid var(--pe-cb-border);
    display: flex; flex-direction: column; overflow: hidden;
    opacity: 0; visibility: hidden; transform: translateY(16px) scale(.98);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.pe-cb-open .pe-cb-panel { opacity: 1; visibility: visible; transform: none; }

.pe-cb-header {
    display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px;
    background: linear-gradient(135deg, var(--pe-cb-primary), #4b3fc4); color: #fff; flex-shrink: 0;
}
.pe-cb-avatar {
    position: relative; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .18);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 800; font-size: 14px;
}
.pe-cb-avatar::after {
    content: ""; position: absolute; right: 0; bottom: 1px; width: 11px; height: 11px; border-radius: 50%;
    background: var(--pe-cb-online); border: 2px solid var(--pe-cb-primary);
}
.pe-cb-title { flex: 1; min-width: 0; }
.pe-cb-title strong { display: block; font-size: 15px; line-height: 1.25; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-cb-title span { display: block; font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-cb-icon-btn {
    width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.pe-cb-icon-btn:hover, .pe-cb-icon-btn:focus-visible { background: rgba(255, 255, 255, .16); outline: none; }
.pe-cb-icon-btn svg { width: 19px; height: 19px; }

.pe-cb-banner {
    display: none; padding: 8px 14px; font-size: 13px; background: #fff4e5; color: #8a4b00;
    border-bottom: 1px solid #ffe0b2; flex-shrink: 0;
}
.pe-cb-banner.pe-cb-show { display: block; }

/* Messages */
.pe-cb-messages {
    flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: var(--pe-cb-soft);
    scroll-behavior: smooth; overscroll-behavior: contain;
}
.pe-cb-row { display: flex; flex-direction: column; margin-bottom: 12px; }
.pe-cb-row.pe-cb-user { align-items: flex-end; }
.pe-cb-row.pe-cb-bot { align-items: flex-start; }
.pe-cb-bubble {
    max-width: 86%; padding: 9px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere;
}
.pe-cb-user .pe-cb-bubble { background: var(--pe-cb-primary); color: #fff; border-bottom-right-radius: 5px; white-space: pre-wrap; }
.pe-cb-bot .pe-cb-bubble { background: #fff; color: var(--pe-cb-text); border: 1px solid var(--pe-cb-border); border-bottom-left-radius: 5px; }
.pe-cb-bot .pe-cb-bubble.pe-cb-error { background: #fdecec; border-color: #f8c9cb; color: #8f1d22; }
.pe-cb-bubble p { margin: 0 0 6px; }
.pe-cb-bubble p:last-child, .pe-cb-bubble ul:last-child, .pe-cb-bubble ol:last-child { margin-bottom: 0; }
.pe-cb-bubble ul, .pe-cb-bubble ol { margin: 2px 0 6px; padding-left: 20px; }
.pe-cb-bubble li { margin: 2px 0; }
.pe-cb-bubble a { color: var(--pe-cb-primary); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.pe-cb-bubble a:hover { color: var(--pe-cb-accent); }
.pe-cb-bubble code { background: #eef1f8; padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.pe-cb-bubble blockquote { margin: 4px 0; padding: 2px 10px; border-left: 3px solid var(--pe-cb-primary); color: var(--pe-cb-muted); }
.pe-cb-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; padding: 0 4px; font-size: 11px; color: var(--pe-cb-muted); }
.pe-cb-copy {
    border: 0; background: transparent; color: var(--pe-cb-muted); cursor: pointer; padding: 2px 4px;
    border-radius: 6px; font-size: 11px; display: inline-flex; align-items: center; gap: 3px;
}
.pe-cb-copy:hover, .pe-cb-copy:focus-visible { background: #e6e9f3; color: var(--pe-cb-text); outline: none; }
.pe-cb-copy svg { width: 13px; height: 13px; }

.pe-cb-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.pe-cb-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa3b8; animation: pe-cb-bounce 1.2s infinite ease-in-out; }
.pe-cb-typing span:nth-child(2) { animation-delay: .15s; }
.pe-cb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes pe-cb-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Follow-up buttons under the latest answer */
.pe-cb-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.pe-cb-suggest .pe-cb-chip { font-size: 12.5px; padding: 5px 11px; }

/* Advisor card */
.pe-cb-card { width: 92%; background: #fff; border: 1px solid var(--pe-cb-border); border-radius: 14px; padding: 12px; }
.pe-cb-card h4 { margin: 0 0 4px; font-size: 14.5px; color: var(--pe-cb-text); }
.pe-cb-card p { margin: 0 0 10px; font-size: 13px; color: var(--pe-cb-muted); }
.pe-cb-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.pe-cb-action {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px;
    border-radius: 10px; font-size: 13px; font-weight: 600; text-decoration: none !important; color: #fff !important;
}
.pe-cb-action.pe-cb-call { background: var(--pe-cb-primary); }
.pe-cb-action.pe-cb-wa { background: #25D366; }
.pe-cb-action svg { width: 16px; height: 16px; }
.pe-cb-form { display: grid; gap: 7px; }
.pe-cb-form input, .pe-cb-form select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--pe-cb-border); border-radius: 9px;
    font: inherit; font-size: 13.5px; color: var(--pe-cb-text); background: #fff; height: auto;
}
.pe-cb-form input:focus, .pe-cb-form select:focus { outline: 2px solid #c7cdf5; border-color: var(--pe-cb-primary); }
.pe-cb-form button {
    padding: 9px; border: 0; border-radius: 10px; background: var(--pe-cb-accent); color: #fff;
    font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.pe-cb-form button:disabled { opacity: .6; cursor: default; }
.pe-cb-form-msg { font-size: 12.5px; margin: 0; }
.pe-cb-form-msg.pe-cb-bad { color: #b4232a; }
.pe-cb-form-msg.pe-cb-good { color: #15803d; font-weight: 600; }

/* Suggested prompts */
.pe-cb-chips {
    display: flex; gap: 7px; padding: 8px 12px; overflow-x: auto; background: var(--pe-cb-soft);
    flex-shrink: 0; scrollbar-width: none;
}
.pe-cb-chips::-webkit-scrollbar { display: none; }
.pe-cb-chips[hidden] { display: none; }
.pe-cb-chip {
    flex-shrink: 0; padding: 6px 12px; border-radius: 999px; border: 1px solid #cfd5ee; background: #fff;
    color: var(--pe-cb-primary); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: background .15s ease, border-color .15s ease;
}
.pe-cb-chip:hover, .pe-cb-chip:focus-visible { background: #eef0ff; border-color: var(--pe-cb-primary); outline: none; }

/* Input */
.pe-cb-composer { border-top: 1px solid var(--pe-cb-border); padding: 10px 12px 6px; background: #fff; flex-shrink: 0; }
.pe-cb-inputwrap {
    display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--pe-cb-border); border-radius: 14px;
    padding: 6px 6px 6px 12px; background: #fff; transition: border-color .15s ease;
}
.pe-cb-inputwrap:focus-within { border-color: var(--pe-cb-primary); box-shadow: 0 0 0 3px rgba(46, 49, 146, .1); }
.pe-cb-input {
    flex: 1; border: 0 !important; outline: none; resize: none; background: transparent; padding: 6px 0;
    font: inherit; font-size: 14.5px; line-height: 1.45; color: var(--pe-cb-text); max-height: 110px; min-height: 22px; height: 22px;
    box-shadow: none !important;
}
.pe-cb-send {
    width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--pe-cb-primary); color: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background .15s ease;
}
.pe-cb-send:hover { background: var(--pe-cb-primary-dark); }
.pe-cb-send:disabled { background: #c3c8d8; cursor: default; }
.pe-cb-send svg { width: 18px; height: 18px; }
/* Voice: mic in the input, language switch and speaker in the header */
.pe-cb-mic {
    position: relative; width: 36px; height: 36px; border-radius: 10px; border: 0; background: #eef0ff; color: var(--pe-cb-primary);
    display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background .15s ease, color .15s ease;
}
.pe-cb-mic[hidden] { display: none; }
.pe-cb-mic:hover, .pe-cb-mic:focus-visible { background: #dfe3ff; outline: none; }
.pe-cb-mic svg { width: 19px; height: 19px; }
.pe-cb-mic.pe-cb-listening { background: var(--pe-cb-accent); color: #fff; }
.pe-cb-mic.pe-cb-listening::before {
    content: ""; position: absolute; inset: -4px; border-radius: 13px; border: 2px solid var(--pe-cb-accent);
    animation: pe-cb-pulse 1.2s ease-out infinite;
}
.pe-cb-lang { width: auto !important; min-width: 34px; padding: 0 7px; font-size: 12.5px; font-weight: 800; letter-spacing: .02em; border: 1px solid rgba(255, 255, 255, .45) !important; }
.pe-cb-icon-btn[hidden] { display: none; }
.pe-cb-icon-btn[aria-pressed="true"] { background: rgba(255, 255, 255, .2); }
.pe-cb-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 2px 0; font-size: 11.5px; color: var(--pe-cb-muted); }
.pe-cb-foot button { border: 0; background: none; color: var(--pe-cb-primary); font-weight: 600; font-size: 12px; cursor: pointer; padding: 0; }
.pe-cb-count.pe-cb-warn { color: var(--pe-cb-accent); font-weight: 600; }

/* Phones: the chat fills the screen */
@media (max-width: 640px) {
    .pe-cb-launcher { bottom: 142px; right: 4%; width: 52px; height: 52px; }
    .pe-cb-launcher-tag { padding: 5px 11px; font-size: 12.5px; right: calc(100% + 9px); }
    .pe-cb-panel { inset: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; }
    .pe-cb-bubble { max-width: 90%; }
    .pe-cb-input { font-size: 16px; } /* stops iPhone zooming in */
    html.pe-cb-lock, html.pe-cb-lock body { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .pe-cb-launcher::before, .pe-cb-typing span, .pe-cb-mic.pe-cb-listening::before { animation: none; }
    .pe-cb-panel, .pe-cb-launcher, .pe-cb-messages { transition: none; scroll-behavior: auto; }
}
