/* ── XXL Chatbot Widget ─────────────────────────────────────────────────────── */

:root {
  --xxl-color:       #f97316;
  --xxl-color-dark:  #ea6600;
  --xxl-wa-color:    #25D366;
  --xxl-wa-dark:     #1da851;
  --xxl-radius:      16px;
  --xxl-shadow:      0 8px 32px rgba(0,0,0,.18);
  --xxl-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Floating Widget Wrapper ── */
#xxl-chat-widget {
  position: fixed;
  bottom: 24px;
  z-index: 999999;
  font-family: var(--xxl-font);
  font-size: 15px;
  line-height: 1.5;
}

#xxl-chat-widget.xxl-pos-right { right: 24px; }
#xxl-chat-widget.xxl-pos-left  { left: 24px; }

/* ── Toggle Button (floating only) ── */
#xxl-chat-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--xxl-color);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--xxl-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .2s;
  position: relative;
}
#xxl-chat-btn:hover   { background: var(--xxl-color-dark); transform: scale(1.08); }
#xxl-chat-btn svg     { width: 28px; height: 28px; }
#xxl-chat-btn.xxl-btn-open { background: #6b7280; }

/* Pulse animation on load */
#xxl-chat-btn::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--xxl-color);
  opacity: .4;
  animation: xxl-pulse 2.5s ease-out infinite;
}
@keyframes xxl-pulse {
  0%   { transform: scale(1); opacity: .4; }
  70%  { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}
#xxl-chat-btn.xxl-btn-open::before { display: none; }

/* ── Chat Window — Floating Mode ── */
#xxl-chat-widget .xxl-chat-window {
  position: absolute;
  bottom: 74px;
  width: 340px;
  height: 500px;
  background: #fff;
  border-radius: var(--xxl-radius);
  box-shadow: var(--xxl-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(.97);
  transition: opacity .25s, transform .25s;
}
.xxl-pos-right .xxl-chat-window { right: 0; }
.xxl-pos-left  .xxl-chat-window { left: 0; }

#xxl-chat-widget .xxl-chat-window.xxl-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ── Chat Window — Inline Mode ── */
.xxl-inline-chatbot {
  font-family: var(--xxl-font);
  font-size: 15px;
  line-height: 1.5;
  width: 100%;
}

.xxl-inline-chatbot .xxl-chat-window {
  position: relative;
  width: 100%;
  height: 520px;
  background: #fff;
  border-radius: var(--xxl-radius);
  box-shadow: var(--xxl-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 1;
  pointer-events: all;
  transform: none;
}

/* Hide close button in inline mode (no toggle needed) */
.xxl-inline-chatbot .xxl-chat-close {
  display: none;
}

/* ── Conversation Progress Bar ── */
.xxl-progress-wrap {
  height: 3px;
  background: rgba(0,0,0,.08);
  flex-shrink: 0;
  display: none; /* shown via JS once chat starts */
  overflow: hidden;
}
.xxl-progress-fill {
  height: 100%;
  background: var(--xxl-color);
  width: 0%;
  transition: width .4s ease;
  opacity: .7;
}

/* ── Header ── */
.xxl-chat-header {
  background: var(--xxl-color);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}
.xxl-chat-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  opacity: .8;
  transition: opacity .15s;
}
.xxl-chat-close:hover { opacity: 1; }

/* ── Messages ── */
.xxl-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.xxl-chat-messages::-webkit-scrollbar       { width: 4px; }
.xxl-chat-messages::-webkit-scrollbar-track { background: transparent; }
.xxl-chat-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

.xxl-msg { display: flex; align-items: flex-end; gap: 6px; }
.xxl-msg-user   { justify-content: flex-end; flex-direction: row-reverse; }
.xxl-msg-bot    { justify-content: flex-start; }
.xxl-msg-action { justify-content: center; }

.xxl-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  word-break: break-word;
}
.xxl-msg-user .xxl-bubble {
  background: var(--xxl-color);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.xxl-msg-bot .xxl-bubble {
  background: #f3f4f6;
  color: #111827;
  border-bottom-left-radius: 4px;
}

/* ── Typing Indicator ── */
.xxl-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}
.xxl-typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: xxl-bounce .9s ease-in-out infinite;
}
.xxl-typing-indicator span:nth-child(2) { animation-delay: .15s; }
.xxl-typing-indicator span:nth-child(3) { animation-delay: .3s; }
@keyframes xxl-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* ── Rating ── */
.xxl-rating { text-align: center; }
.xxl-rating p { font-size: 13px; color: #6b7280; margin: 0 0 8px; }
.xxl-rating-btn {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 50px;
  font-size: 20px;
  padding: 6px 14px;
  cursor: pointer;
  margin: 0 4px;
  transition: background .15s;
}
.xxl-rating-btn:hover { background: #f3f4f6; }

/* ── Consent Banner ── */
.xxl-chat-consent {
  background: #fef3c7;
  border-top: 1px solid #fcd34d;
  padding: 14px 16px;
  font-size: 13px;
  color: #78350f;
  flex-shrink: 0;
}
.xxl-chat-consent p { margin: 0 0 8px; }
.xxl-chat-consent a { color: #92400e; }
.xxl-consent-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  background: var(--xxl-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: background .15s;
}
.xxl-consent-btn:hover { background: var(--xxl-color-dark); }

/* ── Input Area ── */
.xxl-chat-input-area {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  gap: 8px;
  flex-shrink: 0;
  background: #fff;
}
.xxl-chat-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 50px;
  padding: 9px 16px;
  font-size: 14px;
  outline: none;
  font-family: var(--xxl-font);
  transition: border .15s;
}
.xxl-chat-input:focus { border-color: var(--xxl-color); }
.xxl-chat-input:disabled { background: #f9fafb; color: #9ca3af; }
.xxl-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--xxl-color);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.xxl-chat-send:hover:not(:disabled) { background: var(--xxl-color-dark); }
.xxl-chat-send:disabled { background: #d1d5db; cursor: default; }
.xxl-chat-send svg { width: 18px; height: 18px; }

/* ── Quick Reply Chips ── */
.xxl-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 6px 12px 2px;
}
.xxl-chip {
  background: #fff;
  border: 1.5px solid var(--xxl-color);
  color: var(--xxl-color);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--xxl-font);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.xxl-chip:hover { background: var(--xxl-color); color: #fff; }

/* ── Contact Buttons (WA + Mail + Reset) ── */
.xxl-contact-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 4px 0;
}
.xxl-wa-btn,
.xxl-mail-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 10px;
  text-decoration: none !important;
  transition: filter .2s, transform .15s;
  cursor: pointer;
  border: none;
  font-family: var(--xxl-font);
}
.xxl-wa-btn  { background: #25D366; color: #fff !important; }
.xxl-mail-btn{ background: #3b82f6; color: #fff !important; }
.xxl-wa-btn:hover,
.xxl-mail-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.xxl-wa-btn:visited,
.xxl-mail-btn:visited { color: #fff !important; }

.xxl-wa-truncate-note {
  font-size: 11px;
  color: #6b7280;
  margin: 2px 0 4px;
  text-align: center;
}

.xxl-reset-btn {
  background: none;
  border: 1.5px solid #d1d5db;
  color: #6b7280;
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--xxl-font);
  transition: border-color .15s, color .15s;
}
.xxl-reset-btn:hover { border-color: #9ca3af; color: #374151; }

/* ── Teaser Badge (floating only) ── */
#xxl-teaser-badge {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  max-width: 220px;
  padding: 8px 12px;
  position: relative;
  cursor: pointer;
}
#xxl-teaser-badge::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  border: 8px solid transparent;
  border-top-color: #e5e7eb;
  border-bottom: 0;
}

/* ── Header Avatar ── */
.xxl-header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
  flex-shrink: 0;
}
.xxl-chat-header span { flex: 1; }

/* ── Message Avatar ── */
.xxl-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-bottom: 2px;
}
.xxl-msg-user .xxl-msg-avatar { display: none; }

/* ── Feedback Submit Button ── */
.xxl-feedback-submit {
  display: inline-block;
  padding: 6px 16px;
  background: var(--xxl-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--xxl-font);
  transition: background .15s;
}
.xxl-feedback-submit:hover { background: var(--xxl-color-dark); }

/* ── Proactive Bubble (floating only) ── */
.xxl-proactive-bubble {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  max-width: 240px;
  padding: 10px 30px 10px 14px;
  position: relative;
  cursor: pointer;
  animation: xxl-bubble-in .4s ease-out;
}
.xxl-proactive-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-right: 1.5px solid #e5e7eb;
  border-bottom: 1.5px solid #e5e7eb;
  transform: rotate(45deg);
}
.xxl-proactive-close {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 16px;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
}
.xxl-proactive-close:hover { color: #374151; }
@keyframes xxl-bubble-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Game Cards ── */
.xxl-game-cards { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 4px 44px; }
.xxl-game-card { display: flex; gap: 10px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px; max-width: 280px; flex: 1 1 240px; }
.xxl-game-card-img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.xxl-game-card-body { min-width: 0; }
.xxl-game-card-body strong { font-size: 13px; display: block; margin-bottom: 2px; }
.xxl-game-card-desc { font-size: 11px; color: #6b7280; margin: 0; line-height: 1.3; }

/* ── Mobile ── */
@media (max-width: 480px) {
  #xxl-chat-widget .xxl-chat-window {
    width: calc(100vw - 24px);
    height: 70vh;
    bottom: 80px;
  }
  .xxl-pos-right .xxl-chat-window { right: 0; left: auto; }
  .xxl-pos-left  .xxl-chat-window { left: 0; right: auto; }

  .xxl-inline-chatbot .xxl-chat-window {
    height: 70vh;
  }

  .xxl-game-cards { padding-left: 0; }
  .xxl-game-card { flex-direction: column; align-items: center; text-align: center; }
  .xxl-game-card-img { width: 80px; height: 80px; }
}
