/* ════════════════════════════════════════════════════════════
   MX CHATBOT WIDGET — Fully Scoped (no global CSS conflicts)
   All rules are scoped under #mx-chatbot-container
   ════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ── Toggle Button ───────────────────────────────────────── */
#mx-chat-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 212, 255, 0.35);
  z-index: 999999;
  transition: transform 0.2s, box-shadow 0.2s;
  font-size: 22px;
}
#mx-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(0, 212, 255, 0.5);
}
#mx-chat-toggle .mx-chat-icon-open  { display: flex; }
#mx-chat-toggle .mx-chat-icon-close { display: none; }
#mx-chat-toggle.mx-open .mx-chat-icon-open  { display: none; }
#mx-chat-toggle.mx-open .mx-chat-icon-close { display: flex; }

/* ── Notification badge ──────────────────────────────────── */
#mx-chat-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #0d0d0f;
  display: block;
  animation: mx-pulse 2s infinite;
}
@keyframes mx-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.85); }
}

/* ── Chat Window ─────────────────────────────────────────── */
#mx-chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 370px;
  max-height: 540px;
  border-radius: 18px;
  background: #13141a;
  border: 1px solid #2a2b38;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 212, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999998;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  color: #e8e9ec;
  transform: translateY(18px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
}
#mx-chat-window.mx-visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ──────────────────────────────────────────────── */
#mx-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #1c1d26;
  border-bottom: 1px solid #2a2b38;
  flex-shrink: 0;
}
#mx-chat-header .mx-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.25);
}
#mx-chat-header .mx-header-text { flex: 1; }
#mx-chat-header .mx-header-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
#mx-chat-header .mx-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #6b7280;
  margin-top: 1px;
}
#mx-chat-header .mx-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: mx-pulse 2s infinite;
}
#mx-chat-header .mx-close-btn {
  background: transparent;
  border: 1px solid #2a2b38;
  color: #6b7280;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
  flex-shrink: 0;
}
#mx-chat-header .mx-close-btn:hover {
  border-color: #00d4ff;
  color: #00d4ff;
  background: rgba(0, 212, 255, 0.07);
}

/* ── Messages Area ───────────────────────────────────────── */
#mx-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
#mx-chat-messages::-webkit-scrollbar { width: 3px; }
#mx-chat-messages::-webkit-scrollbar-track { background: transparent; }
#mx-chat-messages::-webkit-scrollbar-thumb { background: #2a2b38; border-radius: 2px; }

/* ── Message Rows ────────────────────────────────────────── */
.mx-msg-row {
  display: flex;
  gap: 8px;
  animation: mx-fadeUp 0.18s ease;
}
.mx-msg-row.mx-user { flex-direction: row-reverse; }
@keyframes mx-fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mx-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  align-self: flex-end;
}
.mx-msg-avatar.mx-bot  { background: linear-gradient(135deg, #00d4ff, #7c3aed); }
.mx-msg-avatar.mx-user { background: #1c1d26; border: 1px solid #2a2b38; color: #6b7280; }

.mx-bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
}
.mx-bubble.mx-bot {
  background: #111214;
  border: 1px solid #2a2b38;
  border-bottom-left-radius: 4px;
}
.mx-bubble.mx-user {
  background: #151b3a;
  border: 1px solid #263060;
  border-bottom-right-radius: 4px;
  color: #c7d2fe;
}
.mx-bubble a { color: #00d4ff; text-decoration: none; }
.mx-bubble a:hover { text-decoration: underline; }
.mx-bubble strong { color: #00d4ff; }

/* ── Typing Indicator ────────────────────────────────────── */
#mx-typing-row {
  display: none;
  align-items: center;
  gap: 8px;
}
#mx-typing-row.mx-visible { display: flex; }
.mx-typing-dots {
  display: flex;
  gap: 4px;
  background: #111214;
  border: 1px solid #2a2b38;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
}
.mx-typing-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #6b7280;
  animation: mx-bounce 1.2s infinite;
  display: block;
}
.mx-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.mx-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mx-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

/* ── Input Area ──────────────────────────────────────────── */
#mx-chat-input-area {
  flex-shrink: 0;
  background: #1c1d26;
  border-top: 1px solid #2a2b38;
  padding: 10px 12px;
}
#mx-input-inner {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
#mx-chat-input {
  flex: 1;
  background: #24252f;
  border: 1px solid #2a2b38;
  color: #e8e9ec;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 13px;
  border-radius: 10px;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 100px;
  overflow-y: auto;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#mx-chat-input::placeholder { color: #6b7280; }
#mx-chat-input:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.07);
}
#mx-send-btn {
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 3px 12px rgba(0, 212, 255, 0.25);
}
#mx-send-btn:hover  { opacity: 0.9; }
#mx-send-btn:active { transform: scale(0.95); }
#mx-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }
#mx-send-btn svg { width: 17px; height: 17px; }

/* ── Footer hint ─────────────────────────────────────────── */
#mx-chat-footer-hint {
  text-align: center;
  font-size: 10px;
  color: #4b5563;
  margin-top: 6px;
}

/* ── Error bubble ────────────────────────────────────────── */
.mx-error-bubble {
  color: #ef4444;
  font-size: 12.5px;
  background: rgba(239, 68, 68, 0.08);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  #mx-chat-window {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 90px;
  }
  #mx-chat-toggle {
    right: 16px;
    bottom: 20px;
  }
}

/* ── Quick Action Buttons ─────────────────────────────────────────────── */
.mx-chatbot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px 4px 42px;
  animation: mx-fadeUp 0.2s ease;
}

.mx-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid #2a2b38;
  background: #1c1d26;
  color: #9ca3af;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  letter-spacing: 0.01em;
}
.mx-btn:hover {
  border-color: #00d4ff;
  color: #00d4ff;
  background: rgba(0, 212, 255, 0.07);
  transform: translateY(-1px);
}
.mx-btn:active { transform: scale(0.96); }

.mx-btn-call:hover     { border-color: #10b981; color: #10b981; background: rgba(16,185,129,0.08); }
.mx-btn-whatsapp:hover { border-color: #25d366; color: #25d366; background: rgba(37,211,102,0.08); }
.mx-btn-email:hover    { border-color: #f59e0b; color: #f59e0b; background: rgba(245,158,11,0.08); }
.mx-btn-schedule:hover { border-color: #a78bfa; color: #a78bfa; background: rgba(167,139,250,0.08); }

@media (max-width: 480px) {
  .mx-chatbot-actions { padding-left: 8px; }
  .mx-btn { font-size: 10px; padding: 4px 9px; }
}

