/* Anvilaunch AI Block widget. All knobs are CSS custom properties set from site theme. */
.ab-root {
  --ab-primary: #e2551c; --ab-surface: #111113; --ab-text: #f4f0ea;
  --ab-muted: #9a938a; --ab-radius: 14px; --ab-font: inherit;
  position: fixed; right: 20px; bottom: var(--ab-bottom, 20px); z-index: 99999;
  font-family: var(--ab-font); font-size: 15px; line-height: 1.45;
}
.ab-root.ab-left { right: auto; left: 20px; }

.ab-launcher {
  position: relative;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  /* falls back to the flat primary when a site defines no gradient */
  background: var(--ab-primary-gradient, var(--ab-primary));
  color: #fff; display: grid; place-items: center;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.34),
    inset 0 -1px 0 rgba(0,0,0,.28),
    0 6px 24px rgba(0,0,0,.35);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
  overflow: hidden;
}
.ab-launcher:hover { transform: scale(1.06); filter: brightness(1.07); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 8px 28px rgba(0,0,0,.45); }
/* metallic sheen travelling across the bubble, matching the site buttons */
.ab-launcher .ab-sheen {
  position: absolute; inset: 0; pointer-events: none; border-radius: 50%;
  background: linear-gradient(105deg, transparent 38%, rgba(255,246,226,.48) 50%, transparent 62%);
  background-size: 250% 100%;
  animation: ab-sheen 6.5s linear infinite;
}
@keyframes ab-sheen {
  0% { background-position: 145% 0; }
  55%, 100% { background-position: -60% 0; }
}
@media (prefers-reduced-motion: reduce) { .ab-launcher .ab-sheen { animation: none; } }
/* attention pulse to draw the eye; stops once the panel is open */
.ab-launcher::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  animation: ab-pulse 2.6s ease-out infinite;
}
.ab-open .ab-launcher::after { animation: none; }
@keyframes ab-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ab-primary) 60%, transparent); }
  70% { box-shadow: 0 0 0 16px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .ab-launcher::after { animation: none; } }
/* starter-prompt chips */
.ab-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 14px 8px; }
.ab-chip {
  border: 1px solid color-mix(in srgb, var(--ab-primary) 45%, transparent);
  background: color-mix(in srgb, var(--ab-primary) 12%, transparent);
  color: var(--ab-text); border-radius: 999px; padding: 7px 12px; cursor: pointer;
  font: inherit; font-size: 13px; line-height: 1.2; transition: background .15s ease;
}
.ab-chip:hover { background: color-mix(in srgb, var(--ab-primary) 24%, transparent); }
.ab-launcher .ab-x { display: none; font-size: 20px; }
.ab-open .ab-launcher svg { display: none; }
.ab-open .ab-launcher .ab-x { display: block; }

.ab-panel {
  position: absolute; bottom: 74px; right: 0; width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column;
  background: var(--ab-surface); color: var(--ab-text);
  border-radius: var(--ab-radius); overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(12px) scale(.98); pointer-events: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.9,.3,1.2);
}
.ab-left .ab-panel { right: auto; left: 0; }
.ab-open .ab-panel { opacity: 1; transform: none; pointer-events: auto; }

.ab-header { padding: 14px 16px 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.ab-title { font-weight: 700; font-size: 16px; }
.ab-tabs { display: flex; gap: 6px; margin-top: 10px; }
.ab-tab {
  flex: 1; padding: 6px 10px; border: 0; cursor: pointer; border-radius: 8px;
  background: transparent; color: var(--ab-muted); font: inherit; font-size: 13px;
}
.ab-tab.ab-active { background: rgba(255,255,255,.10); color: var(--ab-text); }

.ab-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ab-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.ab-msg {
  max-width: 82%; padding: 9px 12px; border-radius: 12px;
  animation: ab-in .18s ease both;
}
@keyframes ab-in { from { opacity: 0; transform: translateY(6px); } }
/* Darkened primary so white text stays legible on light brand colors (e.g. cyan). */
.ab-user { align-self: flex-end; background: color-mix(in srgb, var(--ab-primary) 58%, #000); color: #fff; border-bottom-right-radius: 4px; }
.ab-bot  { align-self: flex-start; background: rgba(255,255,255,.09); border-bottom-left-radius: 4px; }
.ab-sys  { align-self: center; color: var(--ab-muted); font-size: 12.5px; background: none; padding: 2px; }

.ab-typing { display: none; gap: 4px; padding: 0 16px 8px; }
.ab-typing.ab-show { display: flex; }
.ab-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ab-muted);
  animation: ab-b 1s infinite ease-in-out;
}
.ab-typing span:nth-child(2) { animation-delay: .15s; }
.ab-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ab-b { 0%,100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.ab-bar { display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.ab-input {
  flex: 1; border: 0; outline: 0; padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,.08); color: var(--ab-text); font: inherit;
}
.ab-input::placeholder { color: var(--ab-muted); }
.ab-send {
  width: 42px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--ab-primary); color: #fff; font-size: 16px;
}

.ab-form { flex: 1; display: none; flex-direction: column; gap: 10px; padding: 16px; overflow-y: auto; }
.ab-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ab-muted); }
.ab-form input, .ab-form textarea {
  border: 0; outline: 0; padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,.08); color: var(--ab-text); font: inherit; resize: none;
}
.ab-form button {
  margin-top: 4px; padding: 11px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--ab-primary); color: #fff; font: inherit; font-weight: 600;
}
.ab-sent { color: var(--ab-text); text-align: center; margin: auto; }
.ab-badge { text-align: center; font-size: 11px; color: var(--ab-muted); padding: 6px 0 8px; }

@media (max-width: 480px) {
  /* Panel sits above the launcher, tracking the per-site launcher offset. */
  .ab-panel { position: fixed; inset: auto 16px calc(var(--ab-bottom, 20px) + 72px) 16px; width: auto; height: min(70vh, 560px); }
}
