/* Chatbot (assistent.js), naar het voorbeeld van de huidige webshop.
   Kleuren komen uit de backend (--ai-kleur, --ai-accent). */
/* Lagen: chatbot (55-56) boven de pagina en zwevende knoppen (50), onder winkelmand/besteloverzicht (60-61) en vensters (70+). */
#kp-ai { --ai-kleur: #0369A1; --ai-accent: #111; font-family: var(--font-ui); }
@keyframes kpAiIn  { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes kpAiUit { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes kpAiBub { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes kpAiDot { 0% { opacity: .25; } 30% { opacity: 1; transform: translateY(-1px); } 100% { opacity: .25; } }

.kp-ai__knop { position: fixed; right: 22px; bottom: 22px; z-index: 55; width: 64px; height: 64px; border-radius: 50%; border: 0; padding: 0; overflow: hidden; background: var(--ai-kleur); color: #fff; font-weight: 700; box-shadow: 0 8px 22px rgba(0,0,0,.18); cursor: pointer; display: grid; place-items: center; }
.kp-ai__knop--img { background: transparent; }
.kp-ai__knop img, .kp-ai__ava img { width: 100%; height: 100%; object-fit: cover; display: block; }

.kp-ai__bubbel { position: fixed; right: 30px; bottom: 98px; z-index: 55; max-width: 260px; display: flex; gap: 10px; align-items: flex-start; background: #fff; color: #333; border-radius: 18px 18px 6px 18px; box-shadow: 0 4px 24px rgba(0,0,0,.12); padding: 12px 36px 12px 16px; font-size: 14px; line-height: 1.4; cursor: pointer; animation: kpAiBub 300ms ease forwards; }
.kp-ai__bubbeltekst > span:first-child { font-size: 20px; line-height: 1; }
.kp-ai__bubbel [data-ai="bubbelweg"] { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: #f3f4f6; color: #666; display: grid; place-items: center; padding: 0; cursor: pointer; }
.kp-ai__bubbel [data-ai="bubbelweg"] svg { width: 10px; height: 10px; }

.kp-ai__paneel { position: fixed; right: 22px; bottom: 100px; z-index: 56; width: 560px; max-width: 96vw; height: 70vh; background: #fff; color: #222; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.25); border: 1px solid rgba(0,0,0,.06); display: flex; flex-direction: column; overflow: hidden; animation: kpAiIn 220ms ease forwards; }
.kp-ai__paneel.is-vol { inset: 0; width: 100%; max-width: 100%; height: 100%; border-radius: 0; border: 0; box-shadow: none; }
.kp-ai__paneel.is-dicht { animation: kpAiUit 220ms ease forwards; }

.kp-ai__kop { background: var(--ai-kleur); background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,0)); color: #fff; padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.kp-ai__ava { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.2); overflow: hidden; display: grid; place-items: center; font-weight: 700; flex: none; }
.kp-ai__naam { display: flex; flex-direction: column; line-height: 1.2; }
.kp-ai__naam b { font-size: 16px; }
.kp-ai__naam span { font-size: 12px; opacity: .95; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.kp-ai__naam i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; display: inline-block; }
.kp-ai__kop button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }

.kp-ai__lijst { flex: 1; padding: 14px; overflow-y: auto; background: #FAFBFC; }
.kp-ai__rij { display: flex; margin-bottom: 10px; }
.kp-ai__rij.is-user { justify-content: flex-end; }
.kp-ai__msg { max-width: 85%; padding: 10px 12px; border-radius: 14px; font-size: 15px; line-height: 1.45; white-space: pre-line; box-shadow: 0 2px 6px rgba(0,0,0,.06); animation: kpAiBub 220ms ease; background: var(--ai-kleur); color: #fff; }
.kp-ai__rij.is-user .kp-ai__msg { background: #F5F7FB; color: #222; border: 1px solid #E7EAF0; }
.kp-ai__msg ol { padding-left: 1.25rem; margin: 0; } .kp-ai__msg li { margin-bottom: 4px; }
.kp-ai__dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.95); display: inline-block; margin: 0 3px; animation: kpAiDot 1s infinite; }
.kp-ai__dot:nth-child(2) { animation-delay: .15s; } .kp-ai__dot:nth-child(3) { animation-delay: .3s; }

.kp-ai__fallback { background: linear-gradient(135deg, #FEF3C7, #FDE68A); border: 1px solid #F59E0B; border-radius: 12px; padding: 16px; margin-top: 12px; }
.kp-ai__fallback h4 { margin: 0 0 8px; color: #92400E; font-size: 14px; }
.kp-ai__fallback p { margin: 0 0 12px; color: #78350F; font-size: 13px; }
.kp-ai__fallback div { display: flex; gap: 10px; flex-wrap: wrap; }
.kp-ai__fallback button { background: #F59E0B; color: #451A03; border: 0; padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.kp-ai__fallback button.is-2 { background: rgba(255,255,255,.7); color: #92400E; border: 1px solid rgba(146,64,14,.35); }

.kp-ai__prods { margin-top: 12px; } .kp-ai__prods > b { display: block; margin-bottom: 8px; }
.kp-ai__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kp-ai__grid.is-vol { grid-template-columns: repeat(4, 1fr); max-width: 1400px; margin: 0 auto; }
@media (max-width: 767px) { .kp-ai__grid.is-vol { grid-template-columns: 1fr; } }
.kp-ai__prod { background: #fff; border: 1px solid #EEE; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 8px 18px rgba(0,0,0,.07); }
/* Foto in een vast vierkant vak (productfoto's zijn 1:1); de foto past er altijd in en schaalt niet uit het vak */
.kp-ai__prod > a { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; background: #fff; border-bottom: 1px solid #EEE; text-decoration: none; }
.kp-ai__prod > a img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 10px; box-sizing: border-box; }
.kp-ai__prod > a span { position: absolute; inset: 0; display: grid; place-items: center; background: #F2F3F6; color: #98A2B3; font-size: 12px; }
/* Eigen vak voor naam, prijs en knop onder de foto */
.kp-ai__prod > div { position: relative; background: #fff; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kp-ai__pnaam { font-weight: 700; font-size: 14px; line-height: 1.25; color: inherit; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kp-ai__prijs { display: flex; align-items: center; gap: 6px; margin-top: auto; font-weight: 700; font-size: 13px; }
.kp-ai__prijs svg { width: 14px; height: 14px; }
.kp-ai__prijs button { margin-left: auto; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--ai-accent); display: grid; place-items: center; cursor: pointer; }
.kp-ai__prijs button:disabled { opacity: .7; cursor: not-allowed; }
.kp-ai__pag { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; color: #6B7280; }
.kp-ai__pag button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid #E5E7EB; background: #fff; display: grid; place-items: center; cursor: pointer; }
.kp-ai__pag button:disabled { background: #F3F4F6; opacity: .55; }

.kp-ai__in { padding: 12px; border-top: 1px solid #eee; display: flex; gap: 8px; background: #fff; margin: 0; }
.kp-ai__in input { flex: 1; border: 1px solid #E7EAF0; border-radius: 9999px; padding: 10px 12px; font-size: 16px; }
.kp-ai__in button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--ai-accent); display: grid; place-items: center; cursor: pointer; }
