/* AP Product AI Sales — Chat UI (v3) */
/* Minimal, production-ready styles */

/* =========================
   GLOBAL RESET & BASE
   ========================= */

.apais-overlay,
.apais-window,
.apais-support-launcher {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  line-height: 1.5;
}

.apais-overlay *,
.apais-window *,
.apais-support-launcher * {
  box-sizing: border-box;
}

/* Self-contained vector icons: no icon font, emoji fallback or extra request. */
.apais-inline-icon {
  width: 1.15em;
  height: 1.15em;
  min-width: 1.15em;
  min-height: 1.15em;
  flex: 0 0 auto;
  display: block;
  box-sizing: border-box !important;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  align-self: center;
  overflow: visible;
  position: static !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  pointer-events: none;
}

.apais-button-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  display: block;
}

.apais-window button > .apais-inline-icon,
.apais-talk-btn > .apais-inline-icon,
.apais-support-launcher > .apais-inline-icon,
.apais-product-invite button > .apais-inline-icon {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  flex: 0 0 20px !important;
}

.apais-message-actions {
  width: 100%;
  min-width: 0;
  align-items: stretch;
}

.apais-message-actions > button {
  min-height: 42px;
  max-width: 100%;
  white-space: normal !important;
  line-height: 1.25 !important;
  text-align: left;
}

.apais-upload-suggestions {
  width: min(100%, 520px);
  align-self: flex-start;
  padding: 10px;
  border: 1px solid rgba(79, 70, 229, .16);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(238,242,255,.92));
  box-shadow: 0 8px 24px rgba(49, 46, 129, .08);
}

.apais-upload-suggestions__title {
  margin: 0 0 7px;
  color: #3730a3;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 850;
}

.apais-upload-suggestions__actions {
  gap: 7px !important;
  margin: 0 !important;
}

.apais-upload-suggestions__actions > button {
  flex: 1 1 180px;
  min-height: 40px;
  padding: 8px 10px !important;
  border-radius: 10px !important;
  font-size: 11px !important;
}

/* =========================
   Z-INDEX (Above everything)
   ========================= */

.apais-overlay,
.apais-window,
.apais-support-launcher {
  z-index: 2147483000 !important; /* Max safe z-index */
}

/* =========================
   MODAL OVERLAY (Product Chat)
   ========================= */

.apais-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0.55);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
}

/* =========================
   CHAT WINDOW
   ========================= */

.apais-window {
  position: relative;
  width: min(560px, 96vw);
  max-height: min(78vh, 720px);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.10);
}

/* Floating support window */
.apais-window--floating {
  position: fixed !important;
  right: 18px !important;
  bottom: 88px !important;
  width: min(420px, 94vw);
  max-height: min(70vh, 680px);
}

/* =========================
   HEADER
   ========================= */

.apais-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #111;
  color: #fff;
  flex-shrink: 0;
}

.apais-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.2;
  margin: 0;
}

.apais-close {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 36px;
  height: 32px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  font-weight: 900;
  padding: 0;
  transition: background 0.2s;
}

.apais-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* =========================
   SUBHEADER (Product info)
   ========================= */

.apais-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #111;
  color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.apais-subheader a {
  color: #fff;
  text-decoration: underline;
  font-size: 13px;
  opacity: 0.95;
}

.apais-subheader a:hover {
  opacity: 1;
}

/* =========================
   BODY (Messages container)
   ========================= */

.apais-body {
  flex: 1;
  overflow: hidden;
  background: #f6f7f8;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.apais-messages {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Product recommendations must never widen or lock the message scroller. */
.apais-product-results-row,
.apais-product-results,
.apais-product-results__box,
.apais-product-grid {
  min-width: 0 !important;
  max-width: 100% !important;
}

.apais-product-grid--compact {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  overflow: hidden !important;
}

.apais-product-grid--compact .apais-product-card {
  min-width: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

@media (max-width: 360px) {
  .apais-product-grid--compact { grid-template-columns: minmax(0, 1fr) !important; }
}

/* Scrollbar styling */
.apais-messages::-webkit-scrollbar { width: 8px; }
.apais-messages::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.05); }
.apais-messages::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
.apais-messages::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }

/* =========================
   TYPING INDICATOR
   ========================= */

.apais-typing {
  padding: 10px 14px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: none;
  flex-shrink: 0;
}

/* =========================
   MESSAGE BUBBLES
   ========================= */

.apais-msg { display: flex; flex-direction: column; gap: 8px; }
.apais-msg--user { align-items: flex-end; }
.apais-msg--assistant,
.apais-msg--manager { align-items: flex-start; }

.apais-bubble {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.35;
  font-size: 14px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.apais-msg--user .apais-bubble {
  background: #111;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  border-color: rgba(255, 255, 255, 0.10);
}

/* Keep shopper text readable even when a storefront theme forces colours on
   nested paragraphs, spans, links or strong elements. */
.apais-window .apais-msg--user .apais-bubble *,
.apais-window .apais-msg--user .apais-bubble a {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  text-shadow: none !important;
}

.apais-msg--assistant .apais-bubble {
  background: #f6f7f9;
  color: #111;
}

.apais-msg--manager .apais-bubble {
  background: #fff7e6;
  color: #111;
  border-color: rgba(0, 0, 0, 0.10);
}

.apais-bubble a { color: inherit; text-decoration: underline; }
.apais-bubble a:hover { opacity: 0.8; }

.apais-bubble code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
}

/* =========================
   FOOTER (Input area)
   ========================= */

.apais-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  flex-shrink: 0;
}

.apais-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  outline: none;
  font-size: 14px;
  line-height: 1.25;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.2s;
}

.apais-input:focus { border-color: rgba(0, 0, 0, 0.28); }
.apais-input::placeholder { color: rgba(0, 0, 0, 0.4); }

.apais-footer > div {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

/* =========================
   BUTTONS
   ========================= */

.apais-send,
.apais-human {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #111;
  color: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  font-family: inherit;
  transition: filter 0.2s, opacity 0.2s;
}

.apais-human { background: #fff; color: #111; }
.apais-send:hover { filter: brightness(1.06); }
.apais-human:hover { background: #f3f4f6; }
.apais-send:disabled,
.apais-human:disabled { opacity: 0.5; cursor: not-allowed; }

/* =========================
   CTA BUTTON (Product pages)
   ========================= */

.apais-talk-btn {
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.2s, box-shadow 0.2s;
}

.apais-talk-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* =========================
   SUPPORT LAUNCHER
   ========================= */

.apais-support-launcher {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  padding: 14px 18px;
  background: #111;
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 50px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.apais-support-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

/* =========================
   ✅ CRITICAL FIX: ICON BUTTONS (TTS + MIC)
   ========================= */

.apais-voice-btn,
.apais-tts-toggle {
  text-indent: 0 !important;
  letter-spacing: 0 !important;
  font-size: 18px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial,Apple Color Emoji,Segoe UI Emoji,Noto Color Emoji !important;
  overflow: visible !important;
}

.apais-voice-btn::before,
.apais-voice-btn::after,
.apais-tts-toggle::before,
.apais-tts-toggle::after {
  content: none !important;
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 768px) {
  .apais-window { width: 96vw !important; max-height: 85vh !important; }
  .apais-window--floating { bottom: 72px !important; right: 12px !important; width: calc(100vw - 24px) !important; max-height: 70vh !important; }
  .apais-support-launcher { bottom: 16px !important; right: 16px !important; padding: 12px 16px !important; font-size: 13px !important; }
  .apais-bubble { max-width: 90%; }
}

@media print {
  .apais-overlay,
  .apais-window,
  .apais-support-launcher,
  .apais-talk-btn { display: none !important; }
}

/* ===== Voice buttons (mic / sound) ===== */
.apais-voice-btn{
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(0,0,0,0.14);
  background: #fff;
  color: #111;
  border-radius: 14px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 900;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  user-select: none;
}

.apais-voice-btn:hover{ background:#f3f4f6; }

.apais-voice-btn.is-off{
  opacity: .75;
  filter: grayscale(1);
}

/* optional: mažas "OFF" badge */
.apais-voice-btn.is-off::after{
  content: "OFF";
  position: absolute;
  transform: translate(14px, 14px);
  font-size: 9px;
  font-weight: 900;
  background: #111;
  color: #fff;
  padding: 2px 4px;
  border-radius: 8px;
}

.apais-tts-toggle, .apais-voice-btn { position: relative !important; }
.apais-tts-toggle::before, .apais-tts-toggle::after,
.apais-voice-btn::before, .apais-voice-btn::after { content:none !important; }


/* =========================
   ✅ PREMIUM PRO PATCH (CTA + overlay safety)
   Put this at the VERY END of the CSS file
   ========================= */

/* 1) Overlay must never block clicks when closed */
.apais-overlay {
  display: none;          /* default: hidden */
  pointer-events: none;   /* extra safety */
}
.apais-overlay.is-open,
.apais-overlay[data-open="1"],
.apais-overlay[aria-hidden="false"]{
  display: flex !important;
  pointer-events: auto !important;
}

/* 2) Window should only be on top when visible */
.apais-window {
  pointer-events: auto;
}
.apais-window[hidden],
.apais-window.is-hidden{
  display: none !important;
}

/* 3) Hardcore button resets (theme-proof) */
.apais-talk-btn,
.apais-support-launcher,
.apais-send,
.apais-human,
.apais-close,
.apais-voice-btn,
.apais-tts-toggle{
  text-transform: none !important;
  letter-spacing: 0 !important;
  text-indent: 0 !important;
  background-image: none !important;
  box-shadow: none;
  font-kerning: auto;
}

/* 4) ✅ Talk with Product button = premium, always visible */
.apais-talk-btn{
  appearance: none !important;
  -webkit-appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;

  width: 100% !important;
  min-height: 46px !important;

  padding: 12px 14px !important;
  border-radius: 14px !important;

  border: 1px solid rgba(0,0,0,0.16) !important;
  background: #111 !important;
  color: #fff !important;

  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif !important;
  font-size: 14px !important;
  line-height: 1.1 !important;
  font-weight: 900 !important;

  cursor: pointer !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.apais-talk-btn:hover{
  transform: translateY(-1px) !important;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18) !important;
}
.apais-talk-btn:active{
  transform: translateY(0px) !important;
  box-shadow: 0 6px 16px rgba(0,0,0,0.16) !important;
}

/* Loop CTA version (white) */
.apais-loop-cta .apais-talk-btn{
  background: #fff !important;
  color: #111 !important;
}

/* 5) Support launcher: lock style (theme-proof) */
.apais-support-launcher{
  appearance: none !important;
  -webkit-appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  font-size: 14px !important;
  line-height: 1.1 !important;
  font-weight: 900 !important;

  border-radius: 999px !important;
}

/* 6) Fix icons (some themes inject pseudo content) */
.apais-voice-btn::before, .apais-voice-btn::after,
.apais-tts-toggle::before, .apais-tts-toggle::after,
.apais-close::before, .apais-close::after{
  content: none !important;
}

/* =========================
   REALTIME 2.1 VOICE AGENT CTA
   ========================= */

button.apais-hold-to-talk[data-voice-state] {
  position: relative !important;
  isolation: isolate;
  flex: 1 0 100% !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 68px !important;
  justify-content: flex-start !important;
  gap: 11px !important;
  padding: 9px 11px !important;
  white-space: normal !important;
  overflow: hidden !important;
  border-radius: 16px !important;
  border: 1px solid rgba(15, 23, 42, .14) !important;
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%) !important;
  color: #111827 !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08) !important;
  transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease !important;
}

button.apais-hold-to-talk[data-voice-state]:not(:disabled):hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .13) !important;
}

button.apais-hold-to-talk[data-voice-state]:focus-visible {
  outline: 3px solid rgba(59, 130, 246, .35) !important;
  outline-offset: 2px !important;
}

button.apais-hold-to-talk[data-voice-state]:disabled {
  cursor: progress !important;
  opacity: 1 !important;
}

.apais-voice-agent-orb {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 55%, #06b6d4 100%);
  box-shadow: 0 8px 22px rgba(79, 70, 229, .28);
}

.apais-voice-agent-ring {
  position: absolute;
  inset: -4px;
  border: 2px solid rgba(99, 102, 241, .28);
  border-radius: inherit;
  pointer-events: none;
}

.apais-voice-agent-icon,
.apais-voice-agent-bars {
  position: relative;
  z-index: 1;
}

.apais-voice-agent-icon .apais-inline-icon {
  width: 21px !important;
  height: 21px !important;
  stroke-width: 2 !important;
}

.apais-voice-agent-bars {
  height: 21px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.apais-voice-agent-bars i {
  display: block;
  width: 3px;
  height: 7px;
  border-radius: 99px;
  background: currentColor;
  transform-origin: center;
}

.apais-voice-agent-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
}

.apais-voice-agent-label {
  display: block;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.1;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apais-voice-agent-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  font-size: 10.5px;
  line-height: 1.15;
  font-weight: 700;
  opacity: .68;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apais-voice-agent-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .14);
}

.apais-voice-agent-action {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 6px 8px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  opacity: .74;
}

button.apais-hold-to-talk[data-voice-state="connecting"],
button.apais-hold-to-talk[data-voice-state="listening"],
button.apais-hold-to-talk[data-voice-state="thinking"],
button.apais-hold-to-talk[data-voice-state="speaking"] {
  border-color: rgba(99, 102, 241, .35) !important;
  background: linear-gradient(135deg, #111827 0%, #312e81 55%, #1d4ed8 100%) !important;
  color: #fff !important;
  box-shadow: 0 12px 30px rgba(49, 46, 129, .25) !important;
}

button.apais-hold-to-talk[data-voice-state="connecting"] .apais-voice-agent-dot,
button.apais-hold-to-talk[data-voice-state="thinking"] .apais-voice-agent-dot {
  background: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, .18);
}

button.apais-hold-to-talk[data-voice-state="listening"] .apais-voice-agent-dot,
button.apais-hold-to-talk[data-voice-state="speaking"] .apais-voice-agent-dot {
  animation: apais-agent-dot 1.1s ease-in-out infinite;
}

button.apais-hold-to-talk[data-voice-state="connecting"] .apais-voice-agent-ring,
button.apais-hold-to-talk[data-voice-state="thinking"] .apais-voice-agent-ring {
  border-color: transparent rgba(255,255,255,.88) rgba(255,255,255,.25) rgba(255,255,255,.25);
  animation: apais-agent-spin .85s linear infinite;
}

button.apais-hold-to-talk[data-voice-state="listening"] .apais-voice-agent-ring {
  border-color: rgba(255,255,255,.7);
  animation: apais-agent-pulse 1.35s ease-out infinite;
}

button.apais-hold-to-talk[data-voice-state="speaking"] .apais-voice-agent-icon {
  display: none;
}

button.apais-hold-to-talk[data-voice-state="speaking"] .apais-voice-agent-bars {
  display: inline-flex;
}

button.apais-hold-to-talk[data-voice-state="speaking"] .apais-voice-agent-bars i,
button.apais-hold-to-talk[data-voice-state="listening"] .apais-voice-agent-bars i {
  animation: apais-agent-wave .72s ease-in-out infinite alternate;
}

.apais-voice-agent-bars i:nth-child(2) { animation-delay: -.52s !important; }
.apais-voice-agent-bars i:nth-child(3) { animation-delay: -.34s !important; }
.apais-voice-agent-bars i:nth-child(4) { animation-delay: -.16s !important; }

button.apais-hold-to-talk[data-voice-state="error"] {
  border-color: rgba(220, 38, 38, .3) !important;
  background: linear-gradient(135deg, #fff 0%, #fef2f2 100%) !important;
  color: #991b1b !important;
}

button.apais-hold-to-talk[data-voice-state="error"] .apais-voice-agent-orb {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 8px 22px rgba(185, 28, 28, .22);
}

button.apais-hold-to-talk[data-voice-state="error"] .apais-voice-agent-dot {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .14);
}

@keyframes apais-agent-spin { to { transform: rotate(360deg); } }
@keyframes apais-agent-pulse {
  0% { transform: scale(.92); opacity: .9; }
  75%, 100% { transform: scale(1.28); opacity: 0; }
}
@keyframes apais-agent-dot {
  0%, 100% { transform: scale(.82); opacity: .62; }
  50% { transform: scale(1.18); opacity: 1; }
}
@keyframes apais-agent-wave {
  0% { height: 5px; }
  100% { height: 21px; }
}

@media (max-width: 390px) {
  .apais-voice-agent-action { display: none; }
  .apais-voice-agent-meta { font-size: 9.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .apais-voice-agent-ring,
  .apais-voice-agent-dot,
  .apais-voice-agent-bars i { animation: none !important; }
}

/* =========================
   STOREFRONT-MATCHED PRODUCT CTA
   The accent is read from WooCommerce's Add to cart button at runtime.
   ========================= */

.apais-product-cta {
  width: 100%;
  margin-top: 10px !important;
}

.apais-product-cta .apais-talk-btn {
  min-height: 56px !important;
  padding: 12px 16px !important;
  border: 1.5px solid #35312d !important;
  border-radius: 4px !important;
  background: #fff !important;
  color: #24211f !important;
  box-shadow: none !important;
  gap: 10px !important;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease !important;
}

.apais-product-cta .apais-talk-btn .apais-inline-icon {
  width: 22px !important;
  height: 22px !important;
  color: var(--apais-store-accent, #ef8624);
}

.apais-product-cta .apais-talk-btn .apais-button-label {
  flex: 0 1 auto;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.apais-product-cta__copy {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
}

.apais-product-cta__helper {
  display: block;
  color: #6f6861;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 650;
}

.apais-new-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 21px;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--apais-store-accent, #ef8624);
  color: var(--apais-store-accent-contrast, #fff);
  font-size: 9px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.apais-product-cta .apais-talk-btn:hover,
.apais-product-cta .apais-talk-btn:focus-visible {
  border-color: var(--apais-store-accent, #ef8624) !important;
  background: #fff8f1 !important;
  color: #171512 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 8px 22px rgba(36, 33, 31, .08) !important;
}

/* =========================
   PRODUCT INVITATION POPUP
   ========================= */

.apais-product-invite {
  position: fixed;
  right: 24px;
  bottom: 86px;
  z-index: 2147482999;
  width: min(370px, calc(100vw - 32px));
  padding: 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  border: 1px solid #dedbd7;
  border-top: 3px solid var(--apais-store-accent, #ef8624);
  border-radius: 10px;
  background: #fff;
  color: #24211f;
  box-shadow: 0 18px 50px rgba(36, 33, 31, .16);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  animation: apais-invite-in .35s cubic-bezier(.2,.8,.2,1) both;
}

.apais-product-invite *,
.apais-product-invite *::before,
.apais-product-invite *::after { box-sizing: border-box; }

.apais-product-invite__image {
  position: relative;
  width: 58px;
  height: 58px;
  border: 1px solid #e7e3df;
  border-radius: 8px;
  background: #f8f7f5;
}

.apais-product-invite__image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: inherit;
}

.apais-product-invite__image > span {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--apais-store-accent, #ef8624);
  color: var(--apais-store-accent-contrast, #fff);
}

.apais-product-invite__image .apais-inline-icon { width: 13px; height: 13px; }
.apais-product-invite__copy { min-width: 0; padding-right: 22px; }
.apais-product-invite__title { margin: 0 0 4px; font-size: 15px; line-height: 1.25; font-weight: 900; }
.apais-product-invite__message { color: #68625d; font-size: 12px; line-height: 1.42; }

.apais-product-invite__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

button.apais-product-invite__button {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px !important;
  border: 1px solid var(--apais-store-accent, #ef8624) !important;
  border-radius: 5px !important;
  background: var(--apais-store-accent, #ef8624) !important;
  color: var(--apais-store-accent-contrast, #fff) !important;
  box-shadow: none !important;
}

button.apais-product-invite__button .apais-button-label { flex: 1; text-align: left; }
button.apais-product-invite__button .apais-new-badge {
  margin-left: 4px;
  border: 1px solid currentColor;
  background: transparent;
  color: currentColor;
}

button.apais-product-invite__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 6px !important;
  border: 0 !important;
  background: transparent !important;
  color: #5f5a55 !important;
}

@keyframes apais-invite-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================
   IMMERSIVE 20-SECOND REALTIME VOICE SURFACE
   ========================= */

.apais-live-voice {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  min-height: 0;
  overflow: hidden;
  padding: 18px;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  align-items: center;
  color: #fff;
  background: #171512;
  background:
    radial-gradient(circle at 52% 38%, color-mix(in srgb, var(--apais-store-accent, #ef8624) 32%, transparent) 0%, transparent 38%),
    linear-gradient(155deg, #29241f 0%, #171512 55%, #0e0d0c 100%);
}

.apais-live-voice.is-active { display: grid; }

.apais-live-voice__glow {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(65px);
  opacity: .15;
  pointer-events: none;
  background: var(--apais-store-accent, #ef8624);
}
.apais-live-voice__glow--one { top: -120px; right: -80px; }
.apais-live-voice__glow--two { bottom: -150px; left: -100px; }

.apais-live-voice__top {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.apais-live-voice__live,
.apais-live-voice__time {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.88);
  font-size: 10px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: .05em;
}

.apais-live-voice__live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #37d67a;
  box-shadow: 0 0 0 4px rgba(55,214,122,.13);
  animation: apais-live-dot 1.15s ease-in-out infinite;
}

.apais-live-voice__main {
  position: relative;
  z-index: 2;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.apais-live-voice__orb {
  position: relative;
  width: 128px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: var(--apais-store-accent, #ef8624);
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.46), transparent 18%),
    linear-gradient(145deg, color-mix(in srgb, var(--apais-store-accent, #ef8624) 88%, white), color-mix(in srgb, var(--apais-store-accent, #ef8624) 72%, #411d06));
  box-shadow: 0 28px 70px color-mix(in srgb, var(--apais-store-accent, #ef8624) 30%, transparent), inset 0 -18px 34px rgba(66,24,0,.28);
}

.apais-live-voice__halo {
  position: absolute;
  inset: -12px;
  border: 1.5px solid color-mix(in srgb, var(--apais-store-accent, #ef8624) 55%, transparent);
  border-radius: inherit;
  opacity: .8;
}
.apais-live-voice__halo--two { inset: -27px; opacity: .35; }

.apais-live-voice__core { position: relative; z-index: 2; color: #fff; }
.apais-live-voice__core .apais-inline-icon { width: 38px !important; height: 38px !important; stroke-width: 1.6 !important; }
.apais-live-voice__wave { position: relative; z-index: 2; display: none; height: 38px; align-items: center; gap: 5px; }
.apais-live-voice__wave i { width: 4px; height: 9px; border-radius: 99px; background: #fff; animation: apais-live-wave .58s ease-in-out infinite alternate; }
.apais-live-voice__wave i:nth-child(2) { animation-delay: -.46s; }
.apais-live-voice__wave i:nth-child(3) { animation-delay: -.33s; }
.apais-live-voice__wave i:nth-child(4) { animation-delay: -.20s; }
.apais-live-voice__wave i:nth-child(5) { animation-delay: -.08s; }

.apais-live-voice__orb[data-state="connecting"] .apais-live-voice__halo--one,
.apais-live-voice__orb[data-state="thinking"] .apais-live-voice__halo--one { animation: apais-agent-spin 1.1s linear infinite; border-color: #fff transparent rgba(255,255,255,.22); }
.apais-live-voice__orb[data-state="listening"] .apais-live-voice__halo { animation: apais-live-pulse 1.45s ease-out infinite; }
.apais-live-voice__orb[data-state="speaking"] .apais-live-voice__core { display: none; }
.apais-live-voice__orb[data-state="speaking"] .apais-live-voice__wave { display: flex; }

.apais-live-voice__state {
  margin: 0 0 8px !important;
  color: #fff !important;
  font-size: clamp(26px, 5vw, 38px) !important;
  line-height: 1.05 !important;
  font-weight: 850 !important;
  letter-spacing: -.035em;
}
.apais-live-voice__persona { margin: 0 0 8px; max-width: 360px; color: rgba(255,255,255,.86); font-size: 14px; line-height: 1.4; font-weight: 750; }
.apais-live-voice__hint { margin: 0; max-width: 360px; min-height: 36px; color: rgba(255,255,255,.6); font-size: 12px; line-height: 1.45; }

button.apais-live-voice__end {
  position: relative;
  z-index: 2;
  justify-self: center;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.1) !important;
  color: #fff !important;
  box-shadow: none !important;
  font: 800 13px/1 system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif !important;
  cursor: pointer;
}
button.apais-live-voice__end:hover { background: rgba(255,255,255,.17) !important; }
button.apais-live-voice__end .apais-inline-icon { width: 18px; height: 18px; }
.apais-live-voice__notice { position: relative; z-index: 2; margin-top: 10px; color: rgba(255,255,255,.43); font-size: 9.5px; text-align: center; }

button.apais-hold-to-talk[data-voice-state="connecting"],
button.apais-hold-to-talk[data-voice-state="listening"],
button.apais-hold-to-talk[data-voice-state="thinking"],
button.apais-hold-to-talk[data-voice-state="speaking"] {
  border-color: color-mix(in srgb, var(--apais-store-accent, #ef8624) 55%, transparent) !important;
  background: linear-gradient(135deg, #29241f 0%, #171512 58%, #6e320d 100%) !important;
  background: linear-gradient(135deg, #29241f 0%, #171512 58%, color-mix(in srgb, var(--apais-store-accent, #ef8624) 58%, #2b1608) 100%) !important;
}
.apais-voice-agent-orb { background: linear-gradient(135deg, var(--apais-store-accent, #ef8624), color-mix(in srgb, var(--apais-store-accent, #ef8624) 66%, #552300)) !important; }

@keyframes apais-live-dot { 0%,100% { opacity:.55; transform:scale(.82); } 50% { opacity:1; transform:scale(1.12); } }
@keyframes apais-live-pulse { 0% { transform:scale(.92); opacity:.75; } 80%,100% { transform:scale(1.22); opacity:0; } }
@keyframes apais-live-wave { from { height:8px; } to { height:36px; } }

@media (max-width: 600px) {
  .apais-product-invite { right: 16px; bottom: 78px; width: calc(100vw - 32px); }
  .apais-live-voice { padding: 16px; }
  .apais-live-voice__orb { width: 112px; height: 112px; margin-bottom: 24px; }
  .apais-live-voice__halo--two { inset: -20px; }
}

@media (prefers-reduced-motion: reduce) {
  .apais-product-invite,
  .apais-live-voice__live i,
  .apais-live-voice__halo,
  .apais-live-voice__wave i { animation: none !important; }
}
