/* VBM AI Chat Widget - Intercom Style from Figma Design */
/* Based on IntercomChat.tsx and chatbot.css */
/* FLATSOME THEME OVERRIDE - Use !important only where needed */

:root {
  --vbm-chat-primary: linear-gradient(135deg, rgb(255, 215, 0), rgb(255, 165, 0));
  --vbm-chat-primary-hover: linear-gradient(135deg, rgb(255, 200, 0), rgb(255, 150, 0));
  --vbm-chat-background: #ffffff;
  --vbm-chat-foreground: #111827;
  --vbm-chat-muted: #6b7280;
  --vbm-chat-border: #e5e7eb;
  --vbm-chat-content-bg: #f9fafb;
  --vbm-chat-hover-bg: #fffbf0;
  --vbm-chat-status-online: #4ade80;
  --vbm-chat-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Reset & Base */
.vbm-chatbot-container {
  font-family: var(--vbm-chat-font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.vbm-chatbot-container * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ============================================
   LAUNCHER BUTTON
   ============================================ */
.vbm-chatbot-launcher {
  position: fixed;
  bottom: 110px; /* Increased from 20px to avoid Back to Top button */
  right: 45px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--vbm-chat-primary);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 165, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999999;
  padding: 0;
}

.vbm-chatbot-launcher:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 165, 0, 0.5);
}

.vbm-chatbot-launcher:active {
  transform: scale(1.05);
}

.vbm-chatbot-launcher svg {
  width: 32px;
  height: 32px;
  stroke: white;
  stroke-width: 2;
  fill: none;
}

/* ============================================
   CHAT WINDOW
   ============================================ */
.vbm-chatbot-window {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 40px);
  background: var(--vbm-chat-background);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  display: none;
  flex-direction: column;
  z-index: 999999;
  overflow: hidden;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: vbm-chatbot-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.vbm-chatbot-window.vbm-chatbot-open {
  display: flex;
}

.vbm-chatbot-window.vbm-chatbot-minimized {
  height: 80px;
}

@keyframes vbm-chatbot-slide-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================
   HEADER
   ============================================ */
.vbm-chatbot-header {
  background: var(--vbm-chat-primary);
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 72px;
}

.vbm-chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.vbm-chatbot-back-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: background 0.2s;
  flex-shrink: 0;
}

.vbm-chatbot-back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.vbm-chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.vbm-chatbot-header-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: white;
  padding: 2px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.vbm-chatbot-header-title {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vbm-chatbot-header-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.vbm-chatbot-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--vbm-chat-status-online);
  display: inline-block;
  animation: vbm-pulse 2s ease-in-out infinite;
}

@keyframes vbm-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.vbm-chatbot-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.vbm-chatbot-header-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: background 0.2s;
}

.vbm-chatbot-header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.vbm-chatbot-header-btn svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   CONTENT AREA
   ============================================ */
.vbm-chatbot-content {
  flex: 1;
  overflow-y: auto;
  background: var(--vbm-chat-content-bg);
  position: relative;
}

/* Custom Scrollbar */
.vbm-chatbot-content::-webkit-scrollbar {
  width: 6px;
}

.vbm-chatbot-content::-webkit-scrollbar-track {
  background: transparent;
}

.vbm-chatbot-content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.vbm-chatbot-content::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ============================================
   WELCOME VIEW
   ============================================ */
.vbm-chatbot-welcome {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.vbm-chatbot-welcome-header {
  text-align: center;
}

.vbm-chatbot-welcome-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 16px;
  object-fit: cover;
  border: 4px solid #ffd700;
  background: white;
}

.vbm-chatbot-welcome-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--vbm-chat-foreground);
  line-height: 1.3;
}

.vbm-chatbot-welcome-subtitle {
  color: var(--vbm-chat-muted);
  font-size: 14px;
  line-height: 1.5;
}

/* Welcome Actions */
.vbm-chatbot-welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vbm-chatbot-welcome-btn {
  background: white;
  border: 1px solid var(--vbm-chat-border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-family: var(--vbm-chat-font-family);
  width: 100%;
}

.vbm-chatbot-welcome-btn:hover {
  border-color: #ffa500;
  background: var(--vbm-chat-hover-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 165, 0, 0.15);
}

.vbm-chatbot-welcome-btn:active {
  transform: translateY(0);
}

.vbm-chatbot-welcome-btn-primary {
  background: var(--vbm-chat-primary);
  border: none;
  color: white;
}

.vbm-chatbot-welcome-btn-primary:hover {
  background: var(--vbm-chat-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3);
}

.vbm-chatbot-welcome-btn svg {
  flex-shrink: 0;
  color: #ffa500;
  width: 20px;
  height: 20px;
}

.vbm-chatbot-welcome-btn-primary svg {
  color: white;
}

.vbm-chatbot-welcome-btn-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  line-height: 1.4;
}

.vbm-chatbot-welcome-btn-desc {
  font-size: 12px;
  opacity: 0.8;
  line-height: 1.4;
}

/* Welcome Footer */
.vbm-chatbot-welcome-footer {
  border-top: 1px solid var(--vbm-chat-border);
  padding-top: 20px;
}

.vbm-chatbot-welcome-footer-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--vbm-chat-foreground);
}

.vbm-chatbot-faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vbm-chatbot-faq-item {
  background: white;
  border: 1px solid var(--vbm-chat-border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  font-size: 13px;
  color: #374151;
  font-family: var(--vbm-chat-font-family);
  width: 100%;
}

.vbm-chatbot-faq-item:hover {
  border-color: #ffa500;
  background: var(--vbm-chat-hover-bg);
  color: var(--vbm-chat-foreground);
}

/* ============================================
   CONVERSATIONS LIST VIEW
   ============================================ */
.vbm-chatbot-conversations {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
}

.vbm-chatbot-conversations-header {
  padding: 20px;
  background: white;
  border-bottom: 1px solid var(--vbm-chat-border);
}

.vbm-chatbot-conversations-header h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--vbm-chat-foreground);
}

.vbm-chatbot-conversations-header p {
  font-size: 13px;
  color: var(--vbm-chat-muted);
}

.vbm-chatbot-conversations-list {
  flex: 1;
  overflow-y: auto;
}

.vbm-chatbot-conversation-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: white;
  border: none;
  border-bottom: 1px solid var(--vbm-chat-border);
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  text-align: left;
  position: relative;
  font-family: var(--vbm-chat-font-family);
}

.vbm-chatbot-conversation-item:hover {
  background: var(--vbm-chat-content-bg);
}

.vbm-chatbot-conversation-unread {
  background: var(--vbm-chat-hover-bg);
}

.vbm-chatbot-conversation-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.vbm-chatbot-conversation-content {
  flex: 1;
  min-width: 0;
}

.vbm-chatbot-conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  gap: 8px;
}

.vbm-chatbot-conversation-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--vbm-chat-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vbm-chatbot-conversation-time {
  font-size: 12px;
  color: #9ca3af;
  flex-shrink: 0;
}

.vbm-chatbot-conversation-message {
  font-size: 13px;
  color: var(--vbm-chat-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vbm-chatbot-conversation-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffa500;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.vbm-chatbot-new-conversation-btn {
  margin: 16px 20px;
  padding: 12px;
  background: var(--vbm-chat-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: var(--vbm-chat-font-family);
  font-size: 14px;
}

.vbm-chatbot-new-conversation-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3);
}

/* ============================================
   MESSAGES VIEW
   ============================================ */
.vbm-chatbot-messages {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vbm-chatbot-messages-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vbm-chatbot-message {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: vbm-message-appear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes vbm-message-appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.vbm-chatbot-message-bot {
  align-self: flex-start;
}

.vbm-chatbot-message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.vbm-chatbot-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.vbm-chatbot-message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vbm-chatbot-message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  word-break: break-word;
}

.vbm-chatbot-message-bot .vbm-chatbot-message-bubble {
  background: white;
  color: var(--vbm-chat-foreground);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.vbm-chatbot-message-user .vbm-chatbot-message-bubble {
  background: var(--vbm-chat-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.vbm-chatbot-message-time {
  font-size: 11px;
  color: #9ca3af;
  padding: 0 4px;
}

.vbm-chatbot-message-user .vbm-chatbot-message-time {
  text-align: right;
}

/* ============================================
   INPUT AREA
   ============================================ */
.vbm-chatbot-input-container {
  padding: 16px;
  background: white;
  border-top: 1px solid var(--vbm-chat-border);
  flex-shrink: 0;
}

.vbm-chatbot-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: transparent !important; /* Transparent background */
  border: 1px solid var(--vbm-chat-border);
  border-radius: 12px;
  padding: 8px;
  transition: border-color 0.2s;
  box-shadow: none !important; /* Remove shadow */
}

.vbm-chatbot-input-wrapper:focus-within {
  border-color: #ffa500;
  box-shadow: none !important; /* Remove shadow on focus */
}

.vbm-chatbot-attach-btn {
  background: transparent;
  border: none;
  color: var(--vbm-chat-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.vbm-chatbot-attach-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.vbm-chatbot-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  max-height: 120px;
  box-shadow: none !important; /* Remove shadow */
  min-height: 20px;
  overflow-y: auto;
  padding: 8px 4px;
  color: var(--vbm-chat-foreground);
  font-family: var(--vbm-chat-font-family);
  line-height: 1.5;
}

.vbm-chatbot-input::placeholder {
  color: #9ca3af;
}

.vbm-chatbot-send-btn {
  background: var(--vbm-chat-primary);
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.vbm-chatbot-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
}

.vbm-chatbot-send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.vbm-chatbot-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vbm-chatbot-input-footer {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
}

/* ============================================
   RESPONSIVE - MOBILE (REWRITTEN FOR STABILITY)
   ============================================ */
@media (max-width: 480px) {
  /* Launcher button - always visible when chat closed */
  .vbm-chatbot-launcher {
    position: fixed !important;
    bottom: 100px !important; /* Avoid Back to Top button */
    right: 16px !important;
    width: 56px !important;
    height: 56px !important;
    z-index: 999999 !important;
    display: flex !important;
  }

  .vbm-chatbot-launcher svg {
    width: 28px;
    height: 28px;
  }

  /* Chat window - fullscreen on mobile with dynamic viewport height */
  .vbm-chatbot-window {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 100dvh !important; /* Dynamic viewport height - adjusts for keyboard */
    height: -webkit-fill-available !important; /* iOS Safari fallback */
    max-height: 100dvh !important;
    max-height: -webkit-fill-available !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
    display: none;
  }

  .vbm-chatbot-window.vbm-chatbot-open {
    display: flex !important;
  }

  /* Header - always show on mobile with proper spacing */
  .vbm-chatbot-header {
    position: sticky !important;
    top: 0 !important;
    padding: 12px 16px !important;
    min-height: 56px !important;
    display: flex !important;
    flex-shrink: 0 !important;
    background: var(--vbm-chat-primary) !important;
    z-index: 10 !important;
  }

  .vbm-chatbot-header-logo {
    width: 36px !important;
    height: 36px !important;
  }

  .vbm-chatbot-header-title {
    font-size: 15px !important;
    font-weight: 600 !important;
  }

  .vbm-chatbot-header-status {
    font-size: 12px !important;
  }

  /* Close button - larger touch target */
  .vbm-chatbot-close-btn {
    width: 40px !important;
    height: 40px !important;
    flex-shrink: 0 !important;
  }

  /* Back button - larger touch target */
  .vbm-chatbot-back-btn {
    width: 40px !important;
    height: 40px !important;
    flex-shrink: 0 !important;
  }

  /* Content area - proper scrolling */
  .vbm-chatbot-content {
    flex: 1 !important;
    min-height: 0 !important; /* Important for flex child scrolling */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Welcome view */
  .vbm-chatbot-welcome {
    padding: 20px 16px !important;
    overflow-y: auto !important;
  }

  .vbm-chatbot-welcome-logo {
    width: 64px !important;
    height: 64px !important;
  }

  .vbm-chatbot-welcome-title {
    font-size: 20px !important;
  }

  .vbm-chatbot-welcome-subtitle {
    font-size: 14px !important;
  }

  /* Messages view - flex container */
  .vbm-chatbot-messages {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important; /* Critical for proper flex scrolling */
    overflow: hidden !important;
    padding: 0 !important;
  }

  .vbm-chatbot-messages-container {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 12px 16px !important;
    padding-bottom: 8px !important;
  }

  .vbm-chatbot-message {
    max-width: 88% !important;
  }

  .vbm-chatbot-message-bubble {
    font-size: 15px !important;
    padding: 10px 14px !important;
  }

  /* Input area - sticky at bottom, above keyboard */
  .vbm-chatbot-input-container {
    position: sticky !important;
    bottom: 0 !important;
    padding: 10px 12px !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important; /* Safe area for notched phones */
    flex-shrink: 0 !important;
    background: var(--vbm-chat-background) !important;
    border-top: 1px solid var(--vbm-chat-border) !important;
    z-index: 20 !important;
  }

  .vbm-chatbot-input-wrapper {
    padding: 6px 8px !important;
    gap: 6px !important;
  }

  .vbm-chatbot-input {
    font-size: 16px !important; /* Prevent iOS zoom - must be 16px+ */
    padding: 8px 4px !important;
    min-height: 24px !important;
    max-height: 80px !important; /* Limit height on mobile */
  }

  /* Buttons - smaller on mobile to fit */
  .vbm-chatbot-attach-btn {
    width: 36px !important;
    height: 36px !important;
    padding: 6px !important;
  }

  .vbm-chatbot-send-btn {
    width: 36px !important;
    height: 36px !important;
    padding: 6px !important;
  }

  .vbm-chatbot-attach-btn svg,
  .vbm-chatbot-send-btn svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* Hide input footer on mobile to save space */
  .vbm-chatbot-input-footer {
    display: none !important;
  }

  /* Conversations view */
  .vbm-chatbot-conversations {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .vbm-chatbot-conversations-list {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* FAQ items - larger touch targets */
  .vbm-chatbot-faq-item {
    padding: 12px 14px !important;
    font-size: 14px !important;
  }

  /* Welcome buttons - larger touch targets */
  .vbm-chatbot-welcome-btn {
    padding: 14px !important;
    font-size: 14px !important;
  }

  .vbm-chatbot-welcome-btn-title {
    font-size: 14px !important;
  }

  .vbm-chatbot-welcome-btn-desc {
    font-size: 12px !important;
  }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
  .vbm-chatbot-header {
    padding: 10px 12px !important;
    min-height: 50px !important;
  }

  .vbm-chatbot-header-logo {
    width: 32px !important;
    height: 32px !important;
  }

  .vbm-chatbot-header-title {
    font-size: 14px !important;
  }

  .vbm-chatbot-welcome-logo {
    width: 56px !important;
    height: 56px !important;
  }

  .vbm-chatbot-welcome-title {
    font-size: 18px !important;
  }

  .vbm-chatbot-message-bubble {
    font-size: 14px !important;
    padding: 8px 12px !important;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.vbm-chatbot-hidden {
  display: none !important;
}

.vbm-chatbot-visible {
  display: flex !important;
}

/* Focus States for Accessibility */
.vbm-chatbot-launcher:focus,
.vbm-chatbot-header-btn:focus,
.vbm-chatbot-back-btn:focus,
.vbm-chatbot-welcome-btn:focus,
.vbm-chatbot-faq-item:focus,
.vbm-chatbot-conversation-item:focus,
.vbm-chatbot-new-conversation-btn:focus,
.vbm-chatbot-attach-btn:focus,
.vbm-chatbot-send-btn:focus {
  outline: 2px solid #ffa500;
  outline-offset: 2px;
}

.vbm-chatbot-input:focus {
  outline: none;
}

/* Loading Animation */
.vbm-chatbot-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.vbm-chatbot-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: vbm-typing 1.4s ease-in-out infinite;
}

.vbm-chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.vbm-chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes vbm-typing {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* ============================================
   FLATSOME THEME FIX - Override specific issues
   ============================================ */

/* Fix buttons and interactive elements */
.vbm-chatbot-launcher,
.vbm-chatbot-header-btn,
.vbm-chatbot-back-btn,
.vbm-chatbot-welcome-btn,
.vbm-chatbot-faq-item,
.vbm-chatbot-conversation-item,
.vbm-chatbot-new-conversation-btn,
.vbm-chatbot-attach-btn,
.vbm-chatbot-send-btn {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* Fix font family - Flatsome may override */
.vbm-chatbot-container,
.vbm-chatbot-container * {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Fix z-index - Ensure chatbot is always on top */
.vbm-chatbot-launcher {
  z-index: 999999 !important;
}

.vbm-chatbot-window {
  z-index: 999999 !important;
}

/* Fix button text decoration */
.vbm-chatbot-welcome-btn,
.vbm-chatbot-faq-item,
.vbm-chatbot-conversation-item,
.vbm-chatbot-header-btn,
.vbm-chatbot-back-btn {
  text-decoration: none !important;
}

/* Fix link styles */
.vbm-chatbot-container a,
.vbm-chatbot-container button {
  text-decoration: none !important;
}

/* Fix box model */
.vbm-chatbot-container *,
.vbm-chatbot-container *::before,
.vbm-chatbot-container *::after {
  box-sizing: border-box !important;
}

/* Fix Flatsome button override */
button.vbm-chatbot-launcher,
button.vbm-chatbot-welcome-btn,
button.vbm-chatbot-header-btn,
button.vbm-chatbot-back-btn,
button.vbm-chatbot-faq-item {
  background-image: none !important;
  background-clip: padding-box !important;
  -webkit-background-clip: padding-box !important;
}

button.vbm-chatbot-launcher {
  background: var(--vbm-chat-primary) !important;
}

button.vbm-chatbot-welcome-btn-primary {
  background: var(--vbm-chat-primary) !important;
  color: white !important;
}

button.vbm-chatbot-send-btn {
  background: var(--vbm-chat-primary) !important;
  color: white !important;
}

/* Ensure colors are preserved */
.vbm-chatbot-header {
  background: var(--vbm-chat-primary) !important;
  color: white !important;
}

.vbm-chatbot-message-user .vbm-chatbot-message-bubble {
  background: var(--vbm-chat-primary) !important;
  color: white !important;
}

/* Fix input */
.vbm-chatbot-input {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: var(--vbm-chat-foreground) !important;
}

/* ============================================
   MOBILE KEYBOARD & INPUT FIXES
   ============================================ */
@media (max-width: 480px) {
  /* Ensure input wrapper displays buttons fully */
  .vbm-chatbot-input-wrapper {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 48px !important;
    background: #f9fafb !important;
    border: 1px solid var(--vbm-chat-border) !important;
    border-radius: 24px !important;
  }

  /* Ensure buttons are visible and touchable */
  .vbm-chatbot-attach-btn,
  .vbm-chatbot-send-btn {
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 36px !important;
    min-height: 36px !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Input text area */
  .vbm-chatbot-input {
    flex: 1 !important;
    min-width: 0 !important; /* Allow shrinking */
    width: auto !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    border-radius: 0 !important;
  }

  /* Prevent iOS form styling */
  .vbm-chatbot-container input,
  .vbm-chatbot-container textarea,
  .vbm-chatbot-container button {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
  }

  /* Handle keyboard open state (via JS class) */
  .vbm-chatbot-window.keyboard-open {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    /* Height is set by JS based on viewport */
  }

  .vbm-chatbot-window.keyboard-open .vbm-chatbot-content {
    flex: 1 !important;
    overflow-y: auto !important;
    min-height: 0 !important;
  }

  .vbm-chatbot-window.keyboard-open .vbm-chatbot-messages {
    flex: 1 !important;
    min-height: 0 !important;
  }

  .vbm-chatbot-window.keyboard-open .vbm-chatbot-messages-container {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
  }

  .vbm-chatbot-window.keyboard-open .vbm-chatbot-input-container {
    flex-shrink: 0 !important;
    position: relative !important;
    bottom: auto !important;
    background: white !important;
    border-top: 1px solid #e5e7eb !important;
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 480px) {
    .vbm-chatbot-window {
      /* iOS needs this to handle keyboard properly */
      position: fixed !important;
      top: 0 !important;
      left: 0 !important;
      right: 0 !important;
      bottom: 0 !important;
    }

    .vbm-chatbot-window.keyboard-open {
      bottom: auto !important;
    }
  }
}
