/* ======================================================
   WBTM AI Chatbot Widget — Professional Styling
   Copyright: mage-people.com
   ====================================================== */
:root {
  --wbtm-ai-primary: #2563eb;
  --wbtm-ai-primary-dark: #1d4ed8;
  --wbtm-ai-bg: #ffffff;
  --wbtm-ai-msg-bg: #f1f5f9;
  --wbtm-ai-bot-bg: #eff6ff;
  --wbtm-ai-user-bg: var(--wbtm-ai-primary);
  --wbtm-ai-text: #1e293b;
  --wbtm-ai-muted: #64748b;
  --wbtm-ai-border: #e2e8f0;
  --wbtm-ai-radius: 18px;
  --wbtm-ai-shadow: 0 8px 40px rgba(0,0,0,.18);
  --wbtm-ai-z: 999999;
  --wbtm-ai-w: 380px;
  --wbtm-ai-h: 540px;
}

#wbtm-chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--wbtm-ai-z);
  font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  font-size: 14px;
}

/* Bubble */
#wbtm-chatbot-bubble {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--wbtm-ai-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37,99,235,.45);
  transition: transform .2s, box-shadow .2s;
  margin-left: auto;
}
#wbtm-chatbot-bubble:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(37,99,235,.55); }
#wbtm-chatbot-bubble svg  { width: 26px; height: 26px; }

/* Panel */
#wbtm-chatbot-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: var(--wbtm-ai-w);
  height: var(--wbtm-ai-h);
  background: var(--wbtm-ai-bg);
  border-radius: 20px;
  box-shadow: var(--wbtm-ai-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wbtm-slide-up .22s ease;
}
#wbtm-chatbot-panel[hidden] { display: none !important; }
@keyframes wbtm-slide-up {
  from { opacity:0; transform: translateY(20px); }
  to   { opacity:1; transform: translateY(0); }
}

/* Header */
#wbtm-chatbot-header {
  background: var(--wbtm-ai-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.wbtm-chatbot-name { font-weight: 700; font-size: 15px; }
.wbtm-chatbot-header-actions { display: flex; gap: 6px; }
.wbtm-chatbot-header-actions button {
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wbtm-chatbot-header-actions button:hover { background: rgba(255,255,255,.35); }

/* Messages */
#wbtm-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
#wbtm-chatbot-messages::-webkit-scrollbar { width: 4px; }
#wbtm-chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#wbtm-chatbot-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Message bubbles */
.wbtm-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.wbtm-msg.wbtm-bot  { align-self: flex-start; }
.wbtm-msg.wbtm-user { align-self: flex-end; flex-direction: row-reverse; }

.wbtm-msg-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--wbtm-ai-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; color: #fff;
}

.wbtm-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.wbtm-bot  .wbtm-msg-bubble { background: var(--wbtm-ai-bot-bg); color: var(--wbtm-ai-text); border-bottom-left-radius: 4px; }
.wbtm-user .wbtm-msg-bubble { background: var(--wbtm-ai-user-bg); color: #fff; border-bottom-right-radius: 4px; }

/* Markdown-like formatting in bot messages */
.wbtm-msg-bubble strong { font-weight: 700; }
.wbtm-msg-bubble em { font-style: italic; }
.wbtm-msg-bubble a { color: var(--wbtm-ai-primary); text-decoration: underline; }
.wbtm-user .wbtm-msg-bubble a { color: #bfdbfe; }

/* Typing indicator */
.wbtm-typing { display: flex; align-items: center; gap: 4px; padding: 12px 14px; }
.wbtm-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--wbtm-ai-muted);
  animation: wbtm-bounce .9s infinite;
  display: inline-block;
}
.wbtm-typing span:nth-child(2) { animation-delay: .15s; }
.wbtm-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes wbtm-bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

/* Action buttons from bot */
.wbtm-msg-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wbtm-action-btn {
  padding: 6px 14px;
  border-radius: 20px;
  background: transparent;
  border: 1.5px solid var(--wbtm-ai-primary);
  color: var(--wbtm-ai-primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.wbtm-action-btn:hover { background: var(--wbtm-ai-primary); color: #fff; }
.wbtm-action-btn.wbtm-btn-primary { background: var(--wbtm-ai-primary); color: #fff; }

/* ── Interactive Seat Map ── */
.wbtm-seat-map { margin-top: 8px; }
.wbtm-seat-legend {
  display: flex; gap: 12px; margin-bottom: 8px; font-size: 11px; color: #666;
  align-items: center; flex-wrap: wrap;
}
.wbtm-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.wbtm-seat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--wbtm-ai-border);
  border-radius: 8px;
  background: #fafafa;
}
.wbtm-seat-chip {
  display: flex; align-items: center; justify-content: center;
  min-width: 34px; height: 30px;
  border-radius: 6px;
  font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1.5px solid transparent;
  transition: all .15s; padding: 0 3px;
  font-family: inherit;
}
.wbtm-seat-available {
  background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7;
}
.wbtm-seat-available:hover {
  background: #c8e6c9; border-color: #66bb6a; transform: scale(1.08);
}
.wbtm-seat-booked {
  background: #ffebee; color: #c62828; border-color: #ef9a9a;
  cursor: not-allowed; opacity: .6; text-decoration: line-through;
}
.wbtm-seat-selected {
  background: var(--wbtm-ai-primary); color: #fff;
  border-color: var(--wbtm-ai-primary); transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.wbtm-selected-display {
  margin-top: 6px; font-size: 12px; font-weight: 500; color: var(--wbtm-ai-primary);
  min-height: 18px;
}
.wbtm-confirm-seats {
  margin-top: 8px; width: 100%; padding: 10px;
  font-size: 14px; font-weight: 600;
}
.wbtm-confirm-seats:disabled { opacity: .5; cursor: not-allowed; }

/* Quick actions strip */
#wbtm-chatbot-quick-actions {
  padding: 8px 12px 4px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid var(--wbtm-ai-border);
  flex-shrink: 0;
}
.wbtm-quick-btn {
  padding: 5px 12px;
  border-radius: 16px;
  background: var(--wbtm-ai-msg-bg);
  border: 1px solid var(--wbtm-ai-border);
  color: var(--wbtm-ai-text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
}
.wbtm-quick-btn:hover { background: var(--wbtm-ai-primary); color: #fff; border-color: var(--wbtm-ai-primary); }

/* Input row */
#wbtm-chatbot-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--wbtm-ai-border);
  background: #fff;
  flex-shrink: 0;
}
#wbtm-chatbot-input {
  flex: 1;
  border: 1.5px solid var(--wbtm-ai-border);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  resize: none;
  max-height: 90px;
  overflow-y: auto;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color .2s;
}
#wbtm-chatbot-input:focus { border-color: var(--wbtm-ai-primary); }
#wbtm-chatbot-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--wbtm-ai-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
}
#wbtm-chatbot-send:hover  { background: var(--wbtm-ai-primary-dark); transform: scale(1.05); }
#wbtm-chatbot-send:active { transform: scale(.95); }
#wbtm-chatbot-send svg { width: 18px; height: 18px; }
#wbtm-chatbot-send:disabled { background: #94a3b8; cursor: not-allowed; transform: none; }

/* Position variant: bottom-left */
#wbtm-chatbot-widget.wbtm-pos-left { right: auto; left: 24px; }
#wbtm-chatbot-widget.wbtm-pos-left #wbtm-chatbot-panel { right: auto; left: 0; }

/* Responsive */
@media (max-width: 500px) {
  #wbtm-chatbot-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    bottom: 70px;
    right: 0;
    border-radius: 16px;
  }
  #wbtm-chatbot-widget { right: 10px; bottom: 16px; }
}

/* Notification badge on bubble */
.wbtm-bubble-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
#wbtm-chatbot-bubble { position: relative; }
