/* ═══════════════════════════════════════════════════════════════
   KLARRRO CHATBOT — Floating bubble + panel
   Used on: index.html, pro.html, contact.html, agenda.html, etc.
   Themed via [data-chatbot-mode] attribute:
     - participant (default): Rose #E0527A
     - pro: Gold #F8BF45
   ═══════════════════════════════════════════════════════════════ */

/* ── Theme tokens ── */
#kb-widget {
  --kb-accent: #E0527A;
  --kb-accent-dark: #c9446a;
  --kb-accent-glow: rgba(224, 82, 122, 0.4);
  --kb-accent-glow-strong: rgba(224, 82, 122, 0.7);
  --kb-accent-08: rgba(224, 82, 122, 0.08);
  --kb-accent-12: rgba(224, 82, 122, 0.12);
  --kb-accent-15: rgba(224, 82, 122, 0.15);
  --kb-accent-20: rgba(224, 82, 122, 0.2);
  --kb-accent-25: rgba(224, 82, 122, 0.25);
  --kb-accent-06: rgba(224, 82, 122, 0.06);
  --kb-accent-30: rgba(224, 82, 122, 0.3);

  position: fixed; bottom: 24px; right: 24px; z-index: 9990;
  font-family: 'DM Sans', -apple-system, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
}

/* Gold theme for pro mode */
#kb-widget[data-chatbot-mode="pro"] {
  --kb-accent: #F8BF45;
  --kb-accent-dark: #d9a63a;
  --kb-accent-glow: rgba(248, 191, 69, 0.35);
  --kb-accent-glow-strong: rgba(248, 191, 69, 0.6);
  --kb-accent-08: rgba(248, 191, 69, 0.08);
  --kb-accent-12: rgba(248, 191, 69, 0.12);
  --kb-accent-15: rgba(248, 191, 69, 0.15);
  --kb-accent-20: rgba(248, 191, 69, 0.2);
  --kb-accent-25: rgba(248, 191, 69, 0.25);
  --kb-accent-06: rgba(248, 191, 69, 0.06);
  --kb-accent-30: rgba(248, 191, 69, 0.3);
}

/* ── FAB button ── */
.kb-fab {
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--kb-accent), var(--kb-accent-dark)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px var(--kb-accent-glow);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  animation: kbFabPulse 2s ease-in-out 3;
}
.kb-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px var(--kb-accent-glow-strong); }

@keyframes kbFabPulse {
  0%, 100% { box-shadow: 0 4px 20px var(--kb-accent-glow, rgba(224,82,122,0.4)); }
  50% { box-shadow: 0 4px 28px var(--kb-accent-glow-strong, rgba(224,82,122,0.7)); }
}

/* ── Teaser tooltip ── */
.kb-teaser {
  position: absolute;
  bottom: 68px; right: 0;
  background: #1a1a2e;
  color: #EDE9F6;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  border: 1px solid var(--kb-accent-20);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.kb-teaser::after {
  content: '';
  position: absolute;
  bottom: -6px; right: 20px;
  width: 12px; height: 12px;
  background: #1a1a2e;
  border-right: 1px solid var(--kb-accent-20);
  border-bottom: 1px solid var(--kb-accent-20);
  transform: rotate(45deg);
}
.kb-teaser-show {
  opacity: 1;
  transform: translateY(0);
}

/* ── Chat panel ── */
.kb-panel {
  position: absolute; bottom: 72px; right: 0;
  width: 380px; height: 500px;
  background: rgba(18, 18, 31, 0.95);
  border: 1px solid var(--kb-accent-15);
  border-radius: 16px; overflow: hidden;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.kb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--kb-accent-08);
  border-bottom: 1px solid var(--kb-accent-12);
  font-weight: 700; font-size: .92rem; color: #EDE9F6;
}
.kb-close {
  background: none; border: none; color: #ABA3C2; font-size: 1.4rem;
  cursor: pointer; line-height: 1; padding: 0;
}
.kb-close:hover { color: var(--kb-accent); }

/* ── Messages ── */
.kb-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.kb-msg {
  max-width: 85%; padding: 10px 14px; border-radius: 12px;
  font-size: .85rem; line-height: 1.5; word-break: break-word;
}
.kb-msg a { color: var(--kb-accent); text-decoration: underline; }
.kb-bot {
  background: rgba(255,255,255,0.06); color: #ABA3C2;
  align-self: flex-start; border-bottom-left-radius: 4px;
}
.kb-bot strong { color: #EDE9F6; }
.kb-user {
  background: var(--kb-accent-15); color: #EDE9F6;
  align-self: flex-end; border-bottom-right-radius: 4px;
}

/* ── Contact fallback button ── */
.kb-contact-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 18px;
  background: var(--kb-accent-15);
  color: var(--kb-accent) !important;
  border: 1px solid var(--kb-accent-30);
  border-radius: 8px;
  text-decoration: none !important;
  font-weight: 600;
  font-size: .82rem;
  transition: background .2s;
}
.kb-contact-btn:hover { background: var(--kb-accent-25); }

/* ── Input row ── */
.kb-input-row {
  display: flex; gap: 8px; padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(18, 18, 31, 0.98);
}
.kb-input-row input {
  flex: 1; padding: 10px 14px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #EDE9F6; font-size: .85rem; font-family: 'DM Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
  outline: none;
}
.kb-input-row input::placeholder { color: #8A839E; }
.kb-input-row input:focus { border-color: var(--kb-accent); }
.kb-send {
  display: flex; align-items: center; justify-content: center;
  width: 40px; min-width: 40px; height: 40px;
  border-radius: 10px; border: none;
  background: var(--kb-accent); color: #fff;
  cursor: pointer; transition: background .2s;
}
.kb-send:hover { background: var(--kb-accent-dark); }

/* ── Suggestion pills ── */
.kb-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.kb-pill {
  padding: 6px 12px; border-radius: 20px; border: 1px solid var(--kb-accent-25);
  background: var(--kb-accent-06); color: var(--kb-accent); font-size: .75rem;
  font-weight: 600; cursor: pointer; font-family: 'DM Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
  transition: color .15s, background .15s; white-space: nowrap;
}
.kb-pill:hover { background: var(--kb-accent-15); border-color: var(--kb-accent); }

/* ── Typing indicator ── */
.kb-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.kb-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #ABA3C2;
  animation: kbBounce .6s infinite alternate;
}
.kb-typing span:nth-child(2) { animation-delay: .15s; }
.kb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes kbBounce { from { opacity: .3; transform: translateY(0); } to { opacity: 1; transform: translateY(-4px); } }

/* ── Panel open animation ── */
.kb-panel-open { animation: kbSlideUp .25s ease-out; }
@keyframes kbSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Mobile ── */
@media (max-width: 480px) {
  #kb-widget { bottom: 16px; right: 16px; }
  .kb-panel { width: calc(100vw - 32px); height: 60vh; right: -8px; }
  .kb-pill { font-size: .7rem; padding: 5px 10px; }
  .kb-teaser { font-size: .75rem; right: -4px; bottom: 64px; }
}

.kb-msg.kb-staff{background:rgba(248,191,69,.14);border:1px solid rgba(248,191,69,.35);align-self:flex-start;}
.kb-ticket-gate{display:flex;flex-direction:column;gap:.5rem;margin:.5rem 0;}
.kb-ticket-gate input{padding:.6rem .75rem;border-radius:10px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.05);color:#EDE9F6;font-size:.9rem;}
.kb-ticket-start,.kb-ticket-new{padding:.6rem 1rem;border-radius:10px;border:none;background:#E0527A;color:#fff;font-weight:700;cursor:pointer;}
