/* BMS AI Chatbot – customer widget. Everything is scoped under .bmsc-root to survive theme CSS (Divi). */

.bmsc-root { --bmsc-color: #0a4d8c; --bmsc-bg: #fff; --bmsc-text: #1c2430; --bmsc-muted: #667085; --bmsc-line: #e3e7ee; --bmsc-soft: #f3f5f9;
	position: fixed; bottom: var(--bmsc-y, 20px); z-index: 999990; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--bmsc-text); }
.bmsc-root[data-position="right"] { right: var(--bmsc-x, 20px); }
.bmsc-root[data-position="left"] { left: var(--bmsc-x, 20px); }
.bmsc-root *, .bmsc-root *::before, .bmsc-root *::after { box-sizing: border-box; }
/* :where() keeps this reset at zero specificity so component colours below always win. */
.bmsc-root :where(button, input, textarea) { font: inherit; color: inherit; margin: 0; }
.bmsc-root [hidden] { display: none !important; }

/* Launcher */
.bmsc-launcher { position: relative; width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--bmsc-color); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(16,24,40,.28); transition: transform .15s ease; padding: 0; }
.bmsc-launcher { background-image: linear-gradient(150deg, color-mix(in srgb, var(--bmsc-color) 72%, #fff), var(--bmsc-color) 55%, color-mix(in srgb, var(--bmsc-color) 78%, #000)); box-shadow: 0 8px 24px color-mix(in srgb, var(--bmsc-color) 45%, transparent), 0 2px 6px rgba(16,24,40,.25); }
.bmsc-launcher::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--bmsc-color); opacity: 0; animation: bmsc-pulse 2.8s ease-out 1.2s 3; pointer-events: none; }
.bmsc-root.is-open .bmsc-launcher::before { animation: none; }
@keyframes bmsc-pulse { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(1.55); opacity: 0; } }
.bmsc-launcher .bmsc-icon svg { filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); }
.bmsc-launcher:hover { transform: scale(1.06); }
/* Pill with text label; turns back into a round close button while the chat is open. */
.bmsc-launcher--label { width: auto; height: 58px; padding: 0 22px 0 16px; border-radius: 99px; gap: 10px; font-size: 16px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.bmsc-launcher--label::before { border-radius: 99px; }
.bmsc-launcher__label { color: #fff; line-height: 1; }
.bmsc-root.is-open .bmsc-launcher--label { width: 58px; padding: 0; border-radius: 50%; }
.bmsc-root.is-open .bmsc-launcher__label { display: none; }
.bmsc-root.has-label .bmsc-teaser { bottom: 70px; }
.bmsc-root.has-label[data-position="right"] .bmsc-teaser { right: 0; }
.bmsc-root.has-label[data-position="left"] .bmsc-teaser { left: 0; }
.bmsc-launcher:focus-visible, .bmsc-root button:focus-visible, .bmsc-root a:focus-visible, .bmsc-root input:focus-visible, .bmsc-root textarea:focus-visible { outline: 3px solid #f5a623; outline-offset: 2px; }
.bmsc-root[data-position="right"] .bmsc-launcher { margin-left: auto; }
.bmsc-icon { display: inline-flex; line-height: 0; }
.bmsc-dot { position: absolute; top: 6px; right: 6px; width: 13px; height: 13px; border-radius: 50%; background: #e5484d; border: 2px solid #fff; }

/* One-time teaser next to the launcher */
.bmsc-teaser { position: absolute; bottom: 10px; width: max-content; display: flex; align-items: center; max-width: min(260px, calc(100vw - 110px)); background: #fff; color: var(--bmsc-text); border: 1px solid var(--bmsc-line); border-radius: 14px; box-shadow: 0 8px 24px rgba(16,24,40,.2); animation: bmsc-pop .35s ease-out both; }
.bmsc-root[data-position="right"] .bmsc-teaser { right: 74px; } .bmsc-root[data-position="left"] .bmsc-teaser { left: 74px; }
.bmsc-teaser__text { border: 0; background: transparent; cursor: pointer; text-align: left; padding: 10px 4px 10px 14px; font-size: 14px; font-weight: 600; line-height: 1.3; }
.bmsc-teaser__x { border: 0; background: transparent; cursor: pointer; color: var(--bmsc-muted); width: 30px; height: 30px; margin-right: 2px; border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0; flex: none; }
.bmsc-teaser__x:hover { background: var(--bmsc-soft); }
.bmsc-teaser__x .bmsc-icon svg { width: 14px; height: 14px; }
@keyframes bmsc-pop { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }

/* Panel */
.bmsc-panel { position: absolute; bottom: 72px; width: 380px; max-width: calc(100vw - 24px); height: 580px; max-height: calc(100vh - 110px); display: flex; flex-direction: column; background: var(--bmsc-bg); border-radius: 16px; overflow: hidden; box-shadow: 0 12px 40px rgba(16,24,40,.28); border: 1px solid var(--bmsc-line); }
.bmsc-root[data-position="right"] .bmsc-panel { right: 0; }
.bmsc-root[data-position="left"] .bmsc-panel { left: 0; }

.bmsc-header { display: flex; align-items: center; gap: 4px; padding: 12px 10px 12px 14px; background: var(--bmsc-color); color: #fff; }
.bmsc-avatar { position: relative; flex: none; width: 42px; height: 42px; margin-right: 8px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; color: #fff; }
.bmsc-online { position: absolute; right: 0; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: #34d27b; border: 2px solid var(--bmsc-color); }
.bmsc-header__title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bmsc-header__title strong { font-size: 16px; line-height: 1.2; }
.bmsc-header__title span { font-size: 12px; opacity: .85; }
.bmsc-iconbtn { background: transparent; border: 0; color: #fff; cursor: pointer; width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0; }
.bmsc-iconbtn:hover { background: rgba(255,255,255,.18); }

.bmsc-banner { background: #fff7e0; color: #6b4e00; font-size: 13px; padding: 8px 14px; border-bottom: 1px solid #f1e0a8; }

.bmsc-log { flex: 1; overflow-y: auto; padding: 14px; background: var(--bmsc-soft); display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.bmsc-row { display: flex; flex-direction: column; max-width: 92%; }
.bmsc-row--visitor { align-self: flex-end; align-items: flex-end; }
.bmsc-row--bot, .bmsc-row--admin { align-self: flex-start; align-items: flex-start; }
.bmsc-who { font-size: 11px; color: var(--bmsc-muted); margin: 0 4px 2px; }
.bmsc-bubble { padding: 9px 13px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; }
.bmsc-bubble p { margin: 0 0 6px; } .bmsc-bubble p:last-child { margin-bottom: 0; }
.bmsc-bubble ul { margin: 4px 0 4px 18px; padding: 0; } .bmsc-bubble li { margin: 2px 0; }
.bmsc-bubble a { color: inherit; text-decoration: underline; }
.bmsc-row--visitor .bmsc-bubble { background: var(--bmsc-color); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.bmsc-row--bot .bmsc-bubble { background: #fff; border: 1px solid var(--bmsc-line); border-bottom-left-radius: 4px; }
.bmsc-row--admin .bmsc-bubble { background: #e8f3ec; border: 1px solid #c4e0cd; border-bottom-left-radius: 4px; }

.bmsc-system { align-self: center; text-align: center; font-size: 12px; color: var(--bmsc-muted); background: #e9edf3; padding: 4px 10px; border-radius: 99px; }
.bmsc-system--warn { background: #fdecea; color: #912018; }

.bmsc-typing { display: flex; gap: 4px; padding: 12px 14px; }
.bmsc-typing i { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; animation: bmsc-bounce 1.2s infinite ease-in-out; }
.bmsc-typing i:nth-child(2) { animation-delay: .15s; } .bmsc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bmsc-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }

/* Product cards */
.bmsc-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; width: 100%; }
.bmsc-card { display: flex; gap: 10px; background: #fff; border: 1px solid var(--bmsc-line); border-radius: 12px; padding: 8px; }
.bmsc-card__img { width: 64px; height: 64px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.bmsc-card__body { min-width: 0; flex: 1; }
.bmsc-card__name { display: block; font-weight: 600; color: var(--bmsc-text); text-decoration: none; line-height: 1.3; font-size: 14px; }
.bmsc-card__name:hover { text-decoration: underline; }
.bmsc-card__sku { font-size: 12px; color: var(--bmsc-muted); }
.bmsc-card__price { font-weight: 700; margin-top: 2px; }
.bmsc-card__stock { font-size: 12px; font-weight: 600; }
.bmsc-stock--instock { color: #067647; } .bmsc-stock--onbackorder { color: #b54708; } .bmsc-stock--outofstock { color: #b42318; }
.bmsc-card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.bmsc-qty { width: 56px; padding: 6px 6px; border: 1px solid #c9d0db; border-radius: 8px; background: #fff; }
.bmsc-added { color: #067647; font-weight: 600; font-size: 13px; }
.bmsc-link { font-size: 13px; color: var(--bmsc-color); font-weight: 600; }

.bmsc-btn { display: inline-block; padding: 7px 12px; border-radius: 8px; border: 1px solid #c9d0db; background: #fff; color: var(--bmsc-text); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; }
.bmsc-btn:hover { background: #f3f5f9; }
.bmsc-btn--primary { background: var(--bmsc-color); border-color: var(--bmsc-color); color: #fff; }
.bmsc-btn--primary:hover { background: var(--bmsc-color); filter: brightness(1.12); }
.bmsc-btn:disabled { opacity: .6; cursor: default; }

/* Chips + composer */
.bmsc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; background: var(--bmsc-soft); }
.bmsc-chip { border: 1px solid var(--bmsc-color); color: var(--bmsc-color); background: #fff; border-radius: 99px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.bmsc-chip:hover { background: var(--bmsc-color); color: #fff; }
.bmsc-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--bmsc-line); background: #fff; align-items: flex-end; }
.bmsc-input { flex: 1; resize: none; border: 1px solid #c9d0db; border-radius: 12px; padding: 9px 12px; min-height: 42px; max-height: 110px; overflow-y: hidden; background: #fff; line-height: 1.35; }
.bmsc-send { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; background: var(--bmsc-color); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.bmsc-send:disabled { opacity: .5; cursor: default; }
.bmsc-note { font-size: 11px; color: var(--bmsc-muted); padding: 0 14px 10px; background: #fff; }

/* Contact form */
.bmsc-contact { flex: 1; overflow-y: auto; padding: 16px; background: #fff; }
.bmsc-contact h3 { margin: 0 0 4px; font-size: 17px; color: var(--bmsc-text); }
.bmsc-contact p { margin: 0 0 12px; color: var(--bmsc-muted); font-size: 13px; }
.bmsc-field { display: block; margin-bottom: 10px; }
.bmsc-field span { display: block; font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.bmsc-field input, .bmsc-field textarea { width: 100%; border: 1px solid #c9d0db; border-radius: 8px; padding: 8px 10px; background: #fff; }
.bmsc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.bmsc-error { color: #b42318; font-size: 13px; margin: 6px 0; }
.bmsc-contact__btns { display: flex; gap: 8px; margin-top: 8px; }

/* Phones: full-screen sheet */
@media (max-width: 480px) {
	.bmsc-root.is-open { inset: 0; bottom: 0; right: 0; left: 0; }
	.bmsc-root.is-open .bmsc-launcher { display: none; }
	.bmsc-root.is-open .bmsc-panel { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.bmsc-launcher, .bmsc-log { transition: none; scroll-behavior: auto; }
	.bmsc-typing i { animation: none; }
	.bmsc-launcher::before, .bmsc-teaser { animation: none; }
}
