/* PB AI Assistant widget */
.pbai, .pbai * { box-sizing: border-box; }
.pbai {
  --pbai-primary: #2873BE;
  --pbai-accent: #F69904;
  --pbai-ink: #1d2733;
  --pbai-muted: #6b7785;
  --pbai-bg: #f4f7fb;
  --pbai-radius: 18px;
  position: fixed; bottom: 20px; z-index: 99990;
  font-family: inherit; font-size: 15px; line-height: 1.45; color: var(--pbai-ink);
}
.pbai--right { right: 20px; }
.pbai--left { left: 20px; }

/* Launcher */
.pbai-launcher {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--pbai-primary); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(20, 60, 110, .35); position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
}
.pbai-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(20, 60, 110, .4); }
.pbai-launcher:focus-visible { outline: 3px solid var(--pbai-accent); outline-offset: 3px; }
.pbai-dot {
  position: absolute; top: 6px; right: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--pbai-accent); border: 2px solid var(--pbai-primary);
  animation: pbai-pulse 2.2s infinite;
}
.pbai.is-open .pbai-dot { display: none; }
@keyframes pbai-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

.pbai-teaser {
  position: absolute; bottom: 74px; width: 240px; padding: 12px 14px; border-radius: 14px;
  background: #fff; color: var(--pbai-ink); box-shadow: 0 8px 28px rgba(0, 0, 0, .15);
  font-size: 14px; cursor: pointer; opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.pbai--right .pbai-teaser { right: 0; }
.pbai--left .pbai-teaser { left: 0; }
.pbai-teaser.is-visible { opacity: 1; transform: none; pointer-events: auto; }

/* Panel */
.pbai-panel {
  position: absolute; bottom: 76px; width: 380px; height: min(620px, calc(100vh - 120px));
  background: #fff; border-radius: var(--pbai-radius); overflow: hidden;
  box-shadow: 0 18px 50px rgba(15, 40, 75, .28);
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(12px) scale(.98); pointer-events: none; visibility: hidden;
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.pbai--right .pbai-panel { right: 0; }
.pbai--left .pbai-panel { left: 0; }
.pbai.is-open .pbai-panel { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }

.pbai-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 16px;
  background: var(--pbai-primary); color: #fff;
}
.pbai-avatar { width: 38px; height: 38px; border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden; flex: 0 0 auto; }
.pbai-avatar img { width: 100%; height: 100%; object-fit: contain; }
.pbai-avatar-fallback { font-weight: 800; color: var(--pbai-primary); font-size: 14px; }
.pbai-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pbai-title strong { font-size: 15px; }
.pbai-status { font-size: 12px; opacity: .9; }
.pbai-status::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #7CFC9A; margin-right: 6px; vertical-align: 1px; }
.pbai-icon-btn { background: transparent; border: 0; color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; opacity: .9; }
.pbai-icon-btn:hover { background: rgba(255, 255, 255, .15); opacity: 1; }

.pbai-log { position: relative; flex: 1; overflow-y: auto; padding: 16px 14px; background: var(--pbai-bg); scroll-behavior: smooth; }
.pbai-msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; margin: 0 0 10px; word-wrap: break-word; animation: pbai-in .2s ease; }
.pbai-msg p { margin: 0 0 6px; }
.pbai-msg p:last-child { margin: 0; }
.pbai-msg ul { margin: 4px 0 6px; padding-left: 18px; }
.pbai-msg li { margin: 2px 0; }
.pbai-msg a { color: var(--pbai-primary); font-weight: 600; text-decoration: underline; }
.pbai-msg--bot { background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.pbai-msg--user { background: var(--pbai-primary); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; white-space: pre-wrap; }
@keyframes pbai-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.pbai-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.pbai-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa7b5; animation: pbai-blink 1.2s infinite; }
.pbai-typing span:nth-child(2) { animation-delay: .2s; }
.pbai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes pbai-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.pbai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; background: var(--pbai-bg); }
.pbai-chips:empty { display: none; }
.pbai-chip {
  border: 1px solid var(--pbai-primary); color: var(--pbai-primary); background: #fff;
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; line-height: 1.2;
}
.pbai-chip:hover { background: var(--pbai-primary); color: #fff; }

.pbai-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid #e6ebf1; background: #fff; }
.pbai-input {
  flex: 1; resize: none; border: 1px solid #d5dde6; border-radius: 12px; padding: 10px 12px;
  font: inherit; font-size: 15px; max-height: 110px; outline: none; color: var(--pbai-ink); background: #fff;
}
.pbai-input:focus { border-color: var(--pbai-primary); box-shadow: 0 0 0 3px rgba(40, 115, 190, .15); }
.pbai-send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--pbai-primary); color: #fff; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; }
.pbai-send:disabled { opacity: .5; cursor: default; }

.pbai-foot { font-size: 11px; color: var(--pbai-muted); padding: 0 14px 10px; background: #fff; line-height: 1.35; }
.pbai-foot a { color: inherit; }

/* Contact card */
.pbai-card { background: #fff; border: 1px solid #dfe6ee; border-left: 4px solid var(--pbai-accent); border-radius: 14px; padding: 14px; margin: 0 0 12px; animation: pbai-in .2s ease; }
.pbai-card-title { display: block; margin-bottom: 10px; font-size: 14px; }
.pbai-card-done { margin: 0; font-weight: 600; color: #1e7b3a; }
.pbai-f-row { display: block; margin-bottom: 8px; }
.pbai-f-row span { display: block; font-size: 12px; color: var(--pbai-muted); margin-bottom: 3px; }
.pbai-f-input { width: 100%; border: 1px solid #d5dde6; border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; color: var(--pbai-ink); background: #fff; }
.pbai-f-input:focus { outline: none; border-color: var(--pbai-primary); }
.pbai-f-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; margin: 8px 0; cursor: pointer; }
.pbai-f-check input { margin-top: 2px; flex: 0 0 auto; }
.pbai-f-legal { font-size: 12px; color: var(--pbai-muted); margin: 6px 0; }
.pbai-f-legal a { color: var(--pbai-primary); }
.pbai-f-error { color: #b42318; font-size: 13px; min-height: 0; margin: 4px 0; }
.pbai-btn { width: 100%; border: 0; border-radius: 10px; padding: 10px; background: var(--pbai-primary); color: #fff; font-weight: 700; cursor: pointer; font-size: 14px; }
.pbai-btn:disabled { opacity: .6; }
.pbai-cf { display: flex; justify-content: center; padding: 0 12px 8px; background: #fff; }
.pbai-cf:empty { display: none; }
.pbai-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* Mobile */
@media (max-width: 480px) {
  .pbai { bottom: 14px; }
  .pbai--right { right: 14px; }
  .pbai--left { left: 14px; }
  .pbai.is-open .pbai-launcher { display: none; }
  .pbai-panel { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; bottom: 0; }
  .pbai-input { font-size: 16px; } /* prevent iOS zoom */
}
@media (prefers-reduced-motion: reduce) {
  .pbai *, .pbai *::before { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------
 * Theme isolation.
 * Hello Elementor (and many themes) style every button pink (#c36) on
 * hover/focus and links pink. The #pbai-root id prefix outranks those
 * selectors, so the widget always keeps its own colours.
 * ------------------------------------------------------------------ */
#pbai-root button {
  font-family: inherit; font-size: inherit; font-weight: inherit; line-height: 1.2;
  text-transform: none; letter-spacing: normal; white-space: normal; text-decoration: none;
  margin: 0; min-height: 0; box-shadow: none; transition: background-color .2s, color .2s, border-color .2s, transform .2s, box-shadow .2s;
}
#pbai-root button:focus:not(:focus-visible) { outline: none; }
#pbai-root button:focus-visible { outline: 3px solid var(--pbai-accent); outline-offset: 2px; }

#pbai-root .pbai-launcher,
#pbai-root .pbai-launcher:hover,
#pbai-root .pbai-launcher:focus,
#pbai-root .pbai-launcher:active {
  background: var(--pbai-primary); color: #fff; border: 0; border-radius: 50%; padding: 0;
  box-shadow: 0 8px 24px rgba(20, 60, 110, .35);
}
#pbai-root .pbai-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(20, 60, 110, .4); }

#pbai-root .pbai-icon-btn,
#pbai-root .pbai-icon-btn:focus,
#pbai-root .pbai-icon-btn:active { background: transparent; color: #fff; border: 0; border-radius: 50%; padding: 0; }
#pbai-root .pbai-icon-btn:hover,
#pbai-root .pbai-icon-btn:focus-visible { background: rgba(255, 255, 255, .18); color: #fff; }

#pbai-root .pbai-send,
#pbai-root .pbai-send:focus,
#pbai-root .pbai-send:active { background: var(--pbai-primary); color: #fff; border: 0; border-radius: 50%; padding: 0; }
#pbai-root .pbai-send:hover:not(:disabled) { background: var(--pbai-accent); color: var(--pbai-ink); }

#pbai-root .pbai-chip,
#pbai-root .pbai-chip:focus,
#pbai-root .pbai-chip:active {
  background: #fff; color: var(--pbai-primary); border: 1px solid var(--pbai-primary);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; text-align: left;
}
#pbai-root .pbai-chip:hover,
#pbai-root .pbai-chip:focus-visible { background: var(--pbai-accent); border-color: var(--pbai-accent); color: var(--pbai-ink); }

#pbai-root .pbai-btn,
#pbai-root .pbai-btn:focus,
#pbai-root .pbai-btn:active { background: var(--pbai-primary); color: #fff; border: 0; border-radius: 10px; padding: 10px; font-weight: 700; font-size: 14px; width: 100%; }
#pbai-root .pbai-btn:hover:not(:disabled) { background: var(--pbai-accent); color: var(--pbai-ink); }

/* Inputs: themes add their own borders/padding to textarea and [type=email]. */
#pbai-root .pbai-input { border: 1px solid #d5dde6; border-radius: 12px; padding: 10px 12px; width: auto; background: #fff; color: var(--pbai-ink); }
#pbai-root .pbai-input:focus { border-color: var(--pbai-primary); box-shadow: 0 0 0 3px rgba(40, 115, 190, .15); outline: none; }
#pbai-root .pbai-f-input { border: 1px solid #d5dde6; border-radius: 10px; padding: 8px 10px; width: 100%; background: #fff; color: var(--pbai-ink); font-size: 14px; }
#pbai-root .pbai-f-input:focus { border-color: var(--pbai-primary); outline: none; }

/* Links */
#pbai-root .pbai-msg a, #pbai-root .pbai-f-legal a { color: var(--pbai-primary); }
#pbai-root .pbai-msg a:hover, #pbai-root .pbai-f-legal a:hover { color: #1b5a99; }
#pbai-root .pbai-foot a, #pbai-root .pbai-foot a:hover { color: inherit; }

/* Themes also force width:auto / display:inline-block on every button. Lock geometry. */
#pbai-root .pbai-launcher { display: grid; place-items: center; width: 60px; height: 60px; min-width: 60px; position: relative; }
#pbai-root .pbai-send { display: grid; place-items: center; width: 42px; height: 42px; min-width: 42px; flex: 0 0 42px; }
#pbai-root .pbai-icon-btn { display: grid; place-items: center; width: 34px; height: 34px; min-width: 34px; flex: 0 0 34px; }
#pbai-root .pbai-chip { display: inline-block; width: auto; }
#pbai-root .pbai-btn { display: block; }
#pbai-root .pbai-f-check input { width: auto; }
@media (max-width: 480px) {
  #pbai-root.pbai.is-open .pbai-launcher { display: none; }
}

/* Letter avatar (persona name) */
#pbai-root .pbai-avatar:has(.pbai-avatar-initial) { background: var(--pbai-accent); }
#pbai-root .pbai-avatar-initial { color: #fff; font-weight: 800; font-size: 18px; line-height: 1; }
