/* ---------------------------------------------------------------
   Site assistant — launcher and panel.
   Self-contained so it can be dropped onto any page: it borrows the
   site tokens where they exist and falls back where they don't.
   --------------------------------------------------------------- */

.pba-assistant {
  --a-bg: #071427;
  --a-panel: #0a1c33;
  --a-line: rgba(93,175,238,.18);
  --a-cyan: #19c8f4;
  --a-blue: #1f7ae0;
  --a-text: #f2f8ff;
  --a-muted: #93a7bd;
  --a-bubble: #0f2440;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ----------------------------- launcher ----------------------------- */

.pba-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 62px; height: 62px;
  display: grid; place-items: center;
  padding: 0;
  border: 1px solid rgba(25,200,244,.55);
  border-radius: 50%;
  background: radial-gradient(120% 120% at 30% 25%, #0d2a4a, #061426);
  box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 6px rgba(25,200,244,.08);
  cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.pba-launcher img { width: 34px; height: 34px; object-fit: contain; pointer-events: none; }
.pba-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: var(--a-cyan);
  box-shadow: 0 14px 36px rgba(0,0,0,.5), 0 0 0 8px rgba(25,200,244,.14);
}
.pba-launcher:focus-visible { outline: 2px solid var(--a-cyan); outline-offset: 4px; }

/* One pulse on arrival, then still. */
@keyframes pba-pulse {
  0%   { box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 0 rgba(25,200,244,.5); }
  70%  { box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 18px rgba(25,200,244,0); }
  100% { box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 6px rgba(25,200,244,.08); }
}
.pba-launcher.pba-pulse { animation: pba-pulse 2.2s ease-out 1; }

.pba-tooltip {
  position: fixed;
  right: 96px; bottom: 40px;
  z-index: 90;
  padding: 8px 13px;
  border: 1px solid var(--a-line);
  border-radius: 9px;
  background: rgba(7,20,39,.96);
  color: var(--a-text);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(6px);
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.pba-tooltip.pba-show { opacity: 1; transform: translateX(0); }

.pba-launcher.pba-hidden { opacity: 0; pointer-events: none; transform: scale(.9); }

/* ------------------------------- panel ------------------------------ */

.pba-panel {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 95;
  width: 410px;
  height: min(700px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(96,190,255,.28);
  border-radius: 18px;
  background: linear-gradient(170deg, #0a1e38, #050f1e 60%);
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(25,200,244,.08);
  color: var(--a-text);
  opacity: 0;
  transform: translateY(14px) scale(.98);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.pba-panel.pba-open { opacity: 1; transform: none; pointer-events: auto; }

@media (prefers-reduced-motion: reduce) {
  .pba-panel, .pba-launcher, .pba-tooltip { transition: none; }
  .pba-launcher.pba-pulse { animation: none; }
}

/* header */
.pba-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--a-line);
  background: rgba(9,26,48,.85);
  flex: none;
}
.pba-head-mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(25,200,244,.4);
  background: radial-gradient(120% 120% at 30% 25%, #0d2a4a, #061426);
}
.pba-head-mark img { width: 22px; height: 22px; object-fit: contain; }
.pba-head-text { flex: 1; min-width: 0; }
.pba-head-text b { display: block; font-size: 15px; font-weight: 700; }
.pba-head-text span { font-size: 12px; color: var(--a-muted); }

.pba-icon-button {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  padding: 0;
  border: none; border-radius: 8px;
  background: transparent;
  color: var(--a-muted);
  cursor: pointer;
  transition: .18s;
}
.pba-icon-button:hover { background: rgba(93,175,238,.12); color: #fff; }
.pba-icon-button:focus-visible { outline: 2px solid var(--a-cyan); outline-offset: 2px; }
.pba-icon-button svg { width: 18px; height: 18px; }

/* message list */
.pba-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(93,175,238,.3) transparent;
}
.pba-body::-webkit-scrollbar { width: 8px; }
.pba-body::-webkit-scrollbar-thumb { background: rgba(93,175,238,.25); border-radius: 8px; }

.pba-row { display: flex; gap: 9px; margin-bottom: 14px; align-items: flex-end; }
.pba-row.pba-user { justify-content: flex-end; }

.pba-avatar {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(25,200,244,.35);
  background: radial-gradient(120% 120% at 30% 25%, #0d2a4a, #061426);
}
.pba-avatar img { width: 17px; height: 17px; object-fit: contain; }

.pba-bubble {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.pba-assistant-bubble {
  border: 1px solid var(--a-line);
  border-bottom-left-radius: 5px;
  background: var(--a-bubble);
  color: #e6f0fb;
}
.pba-user-bubble {
  border-bottom-right-radius: 5px;
  background: linear-gradient(135deg, var(--a-blue), #1668c4);
  color: #fff;
}

/* typing dots */
.pba-typing { display: flex; gap: 4px; padding: 14px; }
.pba-typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--a-cyan);
  opacity: .4;
  animation: pba-dot 1.2s infinite ease-in-out;
}
.pba-typing i:nth-child(2) { animation-delay: .18s; }
.pba-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes pba-dot { 0%,60%,100% { opacity:.3; transform: translateY(0); } 30% { opacity:1; transform: translateY(-3px); } }

/* quick actions */
.pba-actions { display: grid; gap: 8px; margin: 0 0 14px 37px; }
.pba-row + .pba-actions { margin-top: -4px; }

.pba-action {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid rgba(93,175,238,.22);
  border-radius: 11px;
  background: rgba(11,32,57,.85);
  color: #dcebfa;
  font-size: 13.5px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: .18s;
}
.pba-action:hover { border-color: rgba(25,200,244,.6); background: rgba(16,45,78,.9); transform: translateX(2px); }
.pba-action:focus-visible { outline: 2px solid var(--a-cyan); outline-offset: 2px; }
.pba-action .pba-a-icon { width: 20px; height: 20px; flex: none; color: var(--a-cyan); }
.pba-action .pba-a-label { flex: 1; min-width: 0; }
.pba-action .pba-a-chevron { width: 15px; height: 15px; flex: none; color: var(--a-muted); }

.pba-action.pba-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--a-cyan), #1da8ea);
  color: #00121e;
  font-weight: 700;
  justify-content: center;
}
.pba-action.pba-primary .pba-a-icon, .pba-action.pba-primary .pba-a-chevron { color: #00121e; }

/* recommendation / summary card */
.pba-card {
  margin: 0 0 14px 37px;
  padding: 15px;
  border: 1px solid rgba(25,200,244,.32);
  border-radius: 13px;
  background: linear-gradient(160deg, rgba(14,45,80,.9), rgba(7,20,38,.92));
}
.pba-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.pba-card-head b { font-size: 15px; }
.pba-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(25,200,244,.16);
  border: 1px solid rgba(25,200,244,.4);
  color: #8fe3ff;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
}
.pba-card ul { margin: 0 0 13px; padding: 0; list-style: none; display: grid; gap: 6px; }
.pba-card li {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; line-height: 1.5; color: #cddff0;
}
.pba-card li svg { width: 14px; height: 14px; flex: none; margin-top: 2px; color: #3de5a5; }
.pba-card dl { margin: 0 0 13px; display: grid; gap: 7px; }
.pba-card .pba-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.pba-card .pba-kv dt { color: var(--a-muted); }
.pba-card .pba-kv dd { margin: 0; color: #eaf4ff; text-align: right; }

/* input */
.pba-foot { flex: none; padding: 12px 14px 10px; border-top: 1px solid var(--a-line); background: rgba(7,20,38,.9); }
.pba-input-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 6px 6px 14px;
  border: 1px solid rgba(93,175,238,.26);
  border-radius: 13px;
  background: rgba(4,13,26,.8);
  transition: border-color .18s, box-shadow .18s;
}
.pba-input-wrap:focus-within { border-color: var(--a-cyan); box-shadow: 0 0 0 3px rgba(25,200,244,.14); }

.pba-input {
  flex: 1;
  min-height: 34px;
  max-height: 110px;
  padding: 8px 0;
  border: none;
  background: none;
  color: var(--a-text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  resize: none;
  outline: none;
}
.pba-input::placeholder { color: #6d819a; }

.pba-send {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  padding: 0;
  border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--a-cyan), var(--a-blue));
  color: #00121e;
  cursor: pointer;
  transition: .18s;
}
.pba-send:hover { transform: translateY(-1px); }
.pba-send:disabled { opacity: .45; cursor: default; transform: none; }
.pba-send:focus-visible { outline: 2px solid var(--a-cyan); outline-offset: 2px; }
.pba-send svg { width: 17px; height: 17px; }

.pba-powered { margin: 8px 0 0; text-align: center; font-size: 10.5px; color: #5e738c; }

/* screen-reader only */
.pba-sr {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ------------------------------ mobile ------------------------------ */

@media (max-width: 640px) {
  .pba-launcher { right: 16px; bottom: 16px; width: 56px; height: 56px; }
  .pba-launcher img { width: 30px; height: 30px; }
  .pba-tooltip { display: none; }

  .pba-panel {
    right: 0; bottom: 0; left: 0;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 16px 16px 0 0;
    border-left: none; border-right: none; border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .pba-head { padding-top: max(15px, env(safe-area-inset-top)); }
  .pba-bubble { max-width: 86%; font-size: 14px; }
  .pba-actions, .pba-card { margin-left: 0; }
  .pba-action { min-height: 48px; }
}
