/* Scripted demo assistant widget. Themed per brand through CSS custom
   properties set on the page: --ac (accent), --ac-ink (ink on accent),
   --panel (surface), --panel-ink, --line, --font-b (body face). */
.ast-fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px 13px 15px;
  border: 0;
  border-radius: 100px;
  background: var(--ac, #111);
  color: var(--ac-ink, #fff);
  font: 600 .82rem/1 var(--font-b, inherit);
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.4), box-shadow .25s;
}
.ast-fab:hover { transform: translateY(-2px) scale(1.03); }
.ast-fab:active { transform: scale(.97); }
.ast-fab svg { width: 19px; height: 19px; flex: none; }
.ast-fab .ast-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #35c26e;
  border: 2.5px solid var(--page, #fff);
}

.ast-panel {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 66px);
  z-index: 81;
  width: min(392px, calc(100vw - 28px));
  height: min(560px, calc(100dvh - 110px));
  display: flex;
  flex-direction: column;
  background: var(--panel, #fff);
  color: var(--panel-ink, #111);
  border: 1px solid var(--line, rgba(0, 0, 0, .12));
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity .28s ease, transform .28s cubic-bezier(.2, .9, .3, 1.15);
  font-family: var(--font-b, inherit);
}
.ast-panel.open { opacity: 1; transform: none; pointer-events: auto; }

.ast-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line, rgba(0, 0, 0, .1));
  flex: none;
}
.ast-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ac, #111);
  color: var(--ac-ink, #fff);
  display: grid;
  place-items: center;
  font: 700 .9rem/1 var(--font-d, inherit);
  flex: none;
}
.ast-who { min-width: 0; flex: 1; }
.ast-who b { display: block; font-size: .95rem; letter-spacing: .01em; }
.ast-who span { display: block; font-size: .72rem; opacity: .62; margin-top: 2px; }
.ast-x {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line, rgba(0, 0, 0, .14));
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s;
}
.ast-x:hover { background: rgba(127, 127, 127, .12); }
.ast-x svg { width: 15px; height: 15px; }

.ast-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.ast-msg {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: .88rem;
  line-height: 1.5;
  white-space: pre-line;
  animation: ast-in .3s ease both;
}
@keyframes ast-in { from { opacity: 0; transform: translateY(6px); } }
.ast-msg.bot {
  align-self: flex-start;
  background: var(--bubble, rgba(127, 127, 127, .13));
  border-bottom-left-radius: 5px;
}
.ast-msg.you {
  align-self: flex-end;
  background: var(--ac, #111);
  color: var(--ac-ink, #fff);
  border-bottom-right-radius: 5px;
}
.ast-typing { display: inline-flex; gap: 5px; padding: 13px 15px; }
.ast-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .35;
  animation: ast-b 1s infinite;
}
.ast-typing i:nth-child(2) { animation-delay: .15s; }
.ast-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ast-b { 30% { opacity: 1; transform: translateY(-3px); } }

.ast-chips {
  display: flex;
  gap: 8px;
  padding: 6px 14px 10px;
  overflow-x: auto;
  flex: none;
  scrollbar-width: none;
}
.ast-chips::-webkit-scrollbar { display: none; }
.ast-chip {
  flex: none;
  border: 1px solid var(--line, rgba(0, 0, 0, .16));
  background: transparent;
  color: inherit;
  border-radius: 100px;
  padding: 7px 13px;
  font: 600 .74rem/1 var(--font-b, inherit);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.ast-chip:hover { border-color: var(--ac, #111); background: rgba(127, 127, 127, .08); }

.ast-form {
  display: flex;
  gap: 9px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line, rgba(0, 0, 0, .1));
  flex: none;
}
.ast-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line, rgba(0, 0, 0, .16));
  background: transparent;
  color: inherit;
  border-radius: 100px;
  padding: 11px 16px;
  font: 400 .88rem/1.2 var(--font-b, inherit);
  outline: none;
  transition: border-color .2s;
}
.ast-form input:focus { border-color: var(--ac, #111); }
.ast-send {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--ac, #111);
  color: var(--ac-ink, #fff);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .2s;
}
.ast-send:hover { transform: scale(1.07); }
.ast-send svg { width: 17px; height: 17px; }

@media (max-width: 560px) {
  .ast-fab span.ast-fab-t { display: none; }
  .ast-fab { padding: 14px; }
  .ast-fab svg { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .ast-fab, .ast-panel, .ast-msg, .ast-typing i, .ast-send { animation: none; transition: none; }
}
