/* ═══════════════════════════════════════════════════════════
   Assistant behind the WhatsApp button (assistant.js). Loaded on the home
   pages and the catalogue pages; self-contained, so it looks the same on both.
   ═══════════════════════════════════════════════════════════ */
.ka {
  --ka-green: #25d366;
  --ka-green-dark: #128c4b;
  --ka-ink: #111b21;
  --ka-bg: #efeae2;
  --ka-me: #d9fdd3;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  pointer-events: none;
}
.ka > * { pointer-events: auto; }
/* catalogue: sit above the fixed quote strip */
.quote-strip ~ .ka, body:has(.quote-strip) .ka { bottom: 84px; }

/* ── launcher ─────────────────────────────────────────── */
.ka-launch {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ka-green);
  box-shadow: 0 14px 34px rgba(18, 140, 75, 0.38), 0 2px 6px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 0.84, 0.34, 1), box-shadow 0.25s;
}
.ka-launch:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 18px 40px rgba(18, 140, 75, 0.46); }
.ka-launch:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.ka-launch svg { width: 32px; height: 32px; fill: #fff; transition: transform 0.3s; }
.ka[data-open="true"] .ka-launch svg { transform: rotate(-12deg) scale(0.92); }
.ka-badge {
  position: absolute;
  top: -3px;
  right: -5px;
  padding: 3px 6px 2px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #c1121c;
  color: #fff;
  font: 700 10px/1 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.06em;
}
.ka-ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--ka-green);
  animation: ka-ping 2.8s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
  pointer-events: none;
}
.ka[data-open="true"] .ka-ping { display: none; }
@keyframes ka-ping {
  0% { transform: scale(1); opacity: 0.7; }
  70%, 100% { transform: scale(1.55); opacity: 0; }
}

/* ── teaser bubble ────────────────────────────────────── */
.ka-teaser {
  position: relative;
  display: flex;
  align-items: flex-start;
  max-width: 270px;
  margin-right: 6px;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  animation: ka-rise 0.45s cubic-bezier(0.16, 0.84, 0.34, 1);
}
.ka-teaser[hidden] { display: none; }
.ka-teaser-text {
  flex: 1;
  padding: 12px 6px 12px 14px;
  border: 0;
  background: none;
  color: var(--ka-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}
.ka-teaser-x {
  width: 30px;
  height: 30px;
  margin: 4px 4px 0 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #667781;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.ka-teaser-x:hover { background: #f0f2f5; }

/* ── panel ────────────────────────────────────────────── */
.ka-panel {
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 130px));
  overflow: hidden;
  border-radius: 18px;
  background: var(--ka-bg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.06);
  transform-origin: bottom right;
  animation: ka-open 0.35s cubic-bezier(0.16, 0.84, 0.34, 1);
}
.ka-panel[hidden] { display: none; }
@keyframes ka-open { from { opacity: 0; transform: translateY(14px) scale(0.94); } }
@keyframes ka-rise { from { opacity: 0; transform: translateY(10px); } }

.ka-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 14px 16px;
  background: linear-gradient(135deg, #0b3d2c, #075e54 60%, #0d7a5c);
  color: #fff;
}
.ka-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
}
.ka-avatar img { width: 30px; height: 30px; }
.ka-ht { flex: 1; min-width: 0; }
.ka-ht strong { display: block; font-size: 16px; font-weight: 700; }
.ka-ht small { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; opacity: 0.85; }
.ka-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ka-green); box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.25); flex: none; }
.ka-x {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.ka-x:hover { background: rgba(255, 255, 255, 0.22); }

.ka-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  background-color: var(--ka-bg);
  background-image: radial-gradient(rgba(17, 27, 33, 0.07) 1px, transparent 1.4px);
  background-size: 16px 16px;
  scroll-behavior: smooth;
}
.ka-msg {
  position: relative;
  max-width: 86%;
  margin: 0 0 8px;
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--ka-ink);
  font-size: 14.5px;
  line-height: 1.45;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  animation: ka-rise 0.3s cubic-bezier(0.16, 0.84, 0.34, 1);
}
.ka-msg p { margin: 0; }
.ka-bot { background: #fff; border-top-left-radius: 4px; }
.ka-me { margin-left: auto; background: var(--ka-me); border-top-right-radius: 4px; }
.ka-miss { border-left: 3px solid var(--ka-green); }
.ka-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ka-links a {
  padding: 5px 10px;
  border-radius: 999px;
  background: #e7f8ee;
  color: var(--ka-green-dark);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.ka-links a::after { content: " →"; }
.ka-links a:hover { background: #d0f2de; }
.ka-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.ka-typing span { width: 7px; height: 7px; border-radius: 50%; background: #8696a0; animation: ka-blink 1.2s infinite; }
.ka-typing span:nth-child(2) { animation-delay: 0.15s; }
.ka-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ka-blink { 0%, 60%, 100% { opacity: 0.3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.ka-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: var(--ka-bg);
  scrollbar-width: none;
}
.ka-chips::-webkit-scrollbar { display: none; }
.ka-chips[hidden] { display: none; }
.ka-chip {
  flex: none;
  padding: 7px 12px;
  border: 1px solid rgba(18, 140, 75, 0.35);
  border-radius: 999px;
  background: #fff;
  color: var(--ka-green-dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.ka-chip:hover { background: #e7f8ee; transform: translateY(-1px); }

.ka-form {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  background: #f0f2f5;
}
.ka-in {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--ka-ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
}
.ka-in:focus { outline: 2px solid var(--ka-green); outline-offset: 0; }
.ka-send {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--ka-green-dark);
  cursor: pointer;
}
.ka-send svg { width: 20px; height: 20px; fill: #fff; }
.ka-send:hover { background: #0e7a40; }

.ka-foot { padding: 8px 12px 12px; background: #f0f2f5; }
.ka-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border-radius: 12px;
  background: var(--ka-green);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
}
.ka-wa svg { width: 20px; height: 20px; fill: #fff; }
.ka-wa:hover { background: #1fbe5b; transform: translateY(-1px); }
.ka-wa.is-hot { animation: ka-hot 1.4s ease 2; }
@keyframes ka-hot { 50% { box-shadow: 0 0 0 6px rgba(37, 211, 102, 0.3); } }
.ka-privacy { margin: 8px 2px 0; color: #667781; font-size: 11.5px; line-height: 1.35; text-align: center; }

/* phones: the panel becomes a bottom sheet */
@media (max-width: 560px) {
  .ka { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  body:has(.quote-strip) .ka { bottom: 76px; }
  .ka[data-open="true"] { left: 0; right: 0; bottom: 0; align-items: stretch; gap: 0; }
  .ka[data-open="true"] .ka-launch { display: none; }
  .ka-panel { width: 100%; height: min(86vh, 100dvh); border-radius: 18px 18px 0 0; }
  .ka-launch { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .ka *, .ka *::before, .ka *::after { animation: none !important; transition: none !important; }
}
@media print { .ka { display: none !important; } }

/* a popup (catalogue detail, my list) owns the screen: no floating button over it */
body.detail-open .ka { display: none; }
