/* Jackpot Chatbot – Frontend CSS */
#kf-chatbot-root {
  position: fixed; bottom: 20px; z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#kf-chatbot-root.kf-pos-right { right: 20px; }
#kf-chatbot-root.kf-pos-left  { left: 20px; }

/* ── Toggle-Button ── */
#kf-cb-toggle {
  display: flex; align-items: center; gap: 0;
  background: none; border: none; cursor: pointer; padding: 0;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.35));
  transition: transform .2s, filter .2s;
  position: relative;
}
#kf-cb-toggle:hover { transform: scale(1.05); filter: drop-shadow(0 6px 22px rgba(0,0,0,.45)); }
#kf-cb-toggle-img {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  display: block; flex-shrink: 0; transition: opacity .2s;
}
#kf-cb-toggle.open #kf-cb-toggle-img { opacity: .85; }

/* Label neben Button */
#kf-cb-label {
  background: #e65d00; color: #fff;
  font-size: 14px; font-weight: 700;
  padding: 10px 20px 10px 12px;
  border-radius: 0 30px 30px 0;
  line-height: 1.4; text-align: center;
  letter-spacing: .01em;
  transition: opacity .2s, transform .2s;
  box-shadow: 3px 4px 14px rgba(230,93,0,.35);
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
}
#kf-chatbot-root.kf-pos-left #kf-cb-label {
  border-radius: 24px 0 0 24px;
  padding: 8px 10px 8px 14px; order: -1;
}
#kf-cb-toggle.open #kf-cb-label { opacity: 0; pointer-events: none; transform: translateX(8px); }
#kf-chatbot-root.kf-pos-left #kf-cb-toggle.open #kf-cb-label { transform: translateX(-8px); }

/* Badge */
#kf-cb-badge {
  position: absolute; top: 0; right: 0;
  background: #dc2626; color: #fff;
  border-radius: 50%; width: 20px; height: 20px;
  font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

/* ── Chat-Fenster ── */
#kf-cb-window {
  position: fixed;
  background: #fff; border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column; overflow: hidden;
  transform: scale(0.92) translateY(12px); opacity: 0;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
  pointer-events: none;
  /* Größe & Position: immer vom Viewport berechnet */
  width: min(340px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 120px));
  bottom: 110px;
}
#kf-chatbot-root.kf-pos-right #kf-cb-window { right: 16px; }
#kf-chatbot-root.kf-pos-left  #kf-cb-window { left: 16px; }
#kf-cb-window.open { transform: scale(1) translateY(0); opacity: 1; pointer-events: all; }

/* Header */
#kf-cb-header {
  padding: 11px 14px; display: flex; align-items: center; gap: 10px;
  color: #fff; flex-shrink: 0; background: #e65d00;
}
#kf-cb-header img {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,255,255,.4); flex-shrink: 0;
}
#kf-cb-header-title { font-size: 14px; font-weight: 700; color: #fff; line-height: 1.2; }
#kf-cb-header-sub   { font-size: 11px; color: rgba(255,255,255,.75); margin-top: 1px; }
#kf-cb-new-session {
  background: rgba(255,255,255,.15); border: none; border-radius: 6px;
  cursor: pointer; color: #fff; font-size: 11px; padding: 4px 8px;
  margin-left: auto; transition: background .15s; white-space: nowrap;
}
#kf-cb-new-session:hover { background: rgba(255,255,255,.25); }
#kf-cb-close-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.7); font-size: 22px; line-height: 1;
  padding: 0 2px; margin-left: 6px; transition: color .15s;
}
#kf-cb-close-btn:hover { color: #fff; }

/* Messages */
#kf-cb-messages {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
#kf-cb-messages::-webkit-scrollbar { width: 4px; }
#kf-cb-messages::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 2px; }

.kf-msg { max-width: 86%; display: flex; flex-direction: column; }
.kf-msg-bot  { align-self: flex-start; }
.kf-msg-user { align-self: flex-end; }
.kf-msg-bubble {
  padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.55;
}
.kf-msg-bot  .kf-msg-bubble { background: #f3f4f6; color: #111827; border-bottom-left-radius: 4px; }
.kf-msg-user .kf-msg-bubble { color: #fff; border-bottom-right-radius: 4px; }

.kf-msg-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.kf-msg-btn {
  display: inline-block; padding: 7px 13px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; text-decoration: none;
  text-align: center; border: none; cursor: pointer; transition: opacity .15s;
}
.kf-msg-btn:hover { opacity: .85; }
.kf-msg-btn-primary { color: #fff; }
.kf-msg-btn-outline { background: #f3f4f6; color: #374151; }

/* Typing */
.kf-typing { display: flex; gap: 4px; padding: 10px 13px; align-items: center; }
.kf-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #9ca3af;
  animation: kf-bounce 1.2s infinite;
}
.kf-typing span:nth-child(2) { animation-delay: .2s; }
.kf-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes kf-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-5px)} }

/* Quick Replies */
#kf-cb-quick {
  padding: 0 12px 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  flex-shrink: 0;
}
.kf-qr-btn {
  padding: 7px 10px; border-radius: 12px; border: 1.5px solid #e5e7eb;
  background: #fff; font-size: 12px; font-weight: 500; color: #374151;
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: left;
}
.kf-qr-btn:hover { border-color: var(--kf-color,#e65d00); color: var(--kf-color,#e65d00); background: #fff8f5; }

/* ── Input-Zeile ── */
#kf-cb-input-row {
  padding: 10px 12px; border-top: 1px solid #f3f4f6;
  display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
}
#kf-cb-input {
  flex: 1; min-width: 0;
  border: 1.5px solid #e5e7eb; border-radius: 20px;
  padding: 9px 14px; font-size: 13px; outline: none;
  font-family: inherit; resize: none; line-height: 1.4;
  max-height: 80px; overflow-y: auto;
  transition: border-color .2s;
}
#kf-cb-input:focus { border-color: #e65d00; }
#kf-cb-input::placeholder { color: #9ca3af; }

/* Senden-Button – Pfeil */
#kf-cb-send {
  width: 38px; height: 38px; min-width: 38px; min-height: 38px;
  border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform .15s, opacity .15s;
  background: #e65d00; padding: 0;
}
#kf-cb-send:hover  { transform: scale(1.08); }
#kf-cb-send:active { transform: scale(0.95); }
#kf-cb-send svg { width: 17px; height: 17px; fill: #fff; display: block; flex-shrink: 0; }

/* ── Responsiv ── */
@media (max-width: 480px) {
  #kf-cb-label { display: none; }
  #kf-chatbot-root.kf-pos-right { right: 12px; bottom: 12px; }
  #kf-chatbot-root.kf-pos-left  { left: 12px;  bottom: 12px; }
  #kf-cb-window {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 110px);
    bottom: 96px;
  }
  #kf-chatbot-root.kf-pos-right #kf-cb-window { right: 12px; }
  #kf-chatbot-root.kf-pos-left  #kf-cb-window { left: 12px; }
}
