/**
 * Boom Chat Widget - Apple-Quality Design
 * Premium, refined chat interface with meticulous attention to detail
 */

/* ========================================
   Design System - Apple-Inspired
   ======================================== */

:root {
  /* Colors - Primary */
  --boom-primary: #2e5c9a;
  --boom-primary-dark: #264a7d;
  --boom-primary-light: #3e6fb0;
  --boom-bubble: #2e5c9a;

  /* Colors - Apple Gray Scale */
  --boom-gray-50: #f9f9f9;
  --boom-gray-100: #f5f5f7;
  --boom-gray-200: #e8e8ed;
  --boom-gray-300: #d2d2d7;
  --boom-gray-400: #aeaeb2;
  --boom-gray-500: #8e8e93;
  --boom-gray-600: #636366;

  /* Backgrounds */
  --boom-bg: #ffffff;
  --boom-bg-secondary: var(--boom-gray-100);

  /* Text */
  --boom-text: #1d1d1f;
  --boom-text-secondary: var(--boom-gray-600);
  --boom-text-tertiary: var(--boom-gray-500);
  --boom-text-placeholder: rgba(0, 0, 0, 0.35);

  /* Status */
  --boom-online: #30d158;

  /* Shadows - Multi-layer Apple style */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 0.5px rgba(0, 0, 0, 0.03);

  --shadow-md:
    0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 0.5px rgba(0, 0, 0, 0.04);

  --shadow-lg:
    0 8px 24px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.04);

  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.08);

  /* Easing - Apple's spring curves */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.6, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

  --boom-z-index: 2147483010;
  --boom-z-index-minimized: 50; /* Lower z-index for compact widget to respect checkout panels */
}

/* ========================================
   Base Container
   ======================================== */

#boom-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: var(--boom-z-index-minimized); /* Start with lower z-index when minimized */

  /* Typography - SF Pro inspired */
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: var(--boom-text);

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Increase z-index when chat is open */
#boom-chat-widget:has(.boom-chat-window.open) {
  z-index: var(--boom-z-index);
}

#boom-chat-widget button {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

/* ========================================
   Chat Bubble - Refined
   ======================================== */

.boom-chat-bubble {
  display: none;
}

.boom-chat-bubble:hover {
  transform: scale(1.04);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.1),
    0 0 0 0.5px rgba(0, 0, 0, 0.05);
}

.boom-chat-bubble:active {
  transform: scale(0.96);
  transition-duration: 0.1s;
}

.boom-chat-bubble svg {
  width: 28px;
  height: 28px;
  fill: white;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

@keyframes boom-pulse {
  0%,
  100% {
    box-shadow:
      var(--shadow-lg),
      0 0 0 0 rgba(46, 92, 154, 0);
  }
  50% {
    box-shadow:
      var(--shadow-lg),
      0 0 0 8px rgba(46, 92, 154, 0.15);
  }
}

.boom-chat-bubble.pulse {
  animation: boom-pulse 2.5s var(--ease-in-out) infinite;
}

/* Notification Badge */
.boom-notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: #ff3b30;
  border-radius: 50%;
  box-shadow:
    0 2px 8px rgba(255, 59, 48, 0.5),
    0 0 0 2px var(--boom-bg);
  animation: badge-pulse 2s var(--ease-in-out) infinite;
}

@keyframes badge-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.9;
  }
}

/* ========================================
   WhatsApp Bubble
   ======================================== */

.boom-whatsapp-bubble {
  position: absolute;
  bottom: 76px; /* 60px chat bubble height + 16px gap */
  right: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #25d366; /* WhatsApp green */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  text-decoration: none;
  z-index: calc(var(--boom-z-index-minimized) - 2); /* Lower than chat window */

  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px) saturate(180%);

  transition:
    transform 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out),
    opacity 0.25s var(--ease-out),
    visibility 0.25s var(--ease-out);
}

/* Hide WhatsApp bubble when chat is open */
.boom-whatsapp-bubble.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Hide minimized control when panel is open */
#boom-chat-widget .boom-minimized.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s var(--ease-out),
    visibility 0.2s var(--ease-out);
}

.boom-whatsapp-bubble:hover {
  transform: scale(1.04);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.1),
    0 0 0 0.5px rgba(0, 0, 0, 0.05);
}

.boom-whatsapp-bubble:active {
  transform: scale(0.96);
  transition-duration: 0.1s;
}

.boom-whatsapp-bubble svg {
  width: 28px;
  height: 28px;
  fill: white;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Preview Message Bubble */
.boom-preview-message {
  position: absolute;
  bottom: calc(100% + 12px); /* sit above minimized pill */
  right: 0; /* align to pill's right edge */
  min-width: 260px;
  max-width: 360px;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.25s var(--ease-out),
    transform 0.25s var(--ease-out);
  z-index: calc(var(--boom-z-index-minimized) + 10); /* Higher than WhatsApp bubble */
}

/* ========================================
   Minimized Control (Logo + CTA)
   ======================================== */

#boom-chat-widget .boom-minimized {
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px; /* more top/bottom padding */
  min-height: clamp(50px, 5.6vw, 58px);
  background: #ffffff;
  border-radius: 9999px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 0 0 0.5px rgba(0, 0, 0, 0.04);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(24px) saturate(180%);
  z-index: calc(var(--boom-z-index-minimized) + 5); /* Above WhatsApp bubble */
  transition:
    transform 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out),
    background 0.25s var(--ease-out);
  min-width: 280px;
}

#boom-chat-widget .boom-minimized:hover {
  transform: translateY(-1px);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.08),
    0 6px 16px rgba(0, 0, 0, 0.08),
    0 0 0 0.5px rgba(0, 0, 0, 0.05);
}

#boom-chat-widget .boom-mini-logo {
  width: clamp(32px, 3.8vw, 38px);
  height: clamp(32px, 3.8vw, 38px);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* White background to support transparent PNG logos */
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 0 0 0.5px rgba(0, 0, 0, 0.04),
    0 2px 8px rgba(0, 0, 0, 0.06);
  position: relative;
}

#boom-chat-widget .boom-mini-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

#boom-chat-widget .boom-mini-logo .boom-user-icon {
  width: 20px;
  height: 20px;
}

/* When using icon fallback, show primary color background */
#boom-chat-widget .boom-mini-logo:has(.boom-user-icon) {
  background: var(--boom-primary);
}

#boom-chat-widget .boom-mini-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: #ff3b30;
  border-radius: 50%;
  box-shadow:
    0 2px 8px rgba(255, 59, 48, 0.5),
    0 0 0 2px var(--boom-bg);
  animation: badge-pulse 2s var(--ease-in-out) infinite;
}

@keyframes badge-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.9;
  }
}

#boom-chat-widget .boom-mini-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: clamp(34px, 4.4vw, 40px);
  padding: 0 20px;
  background: var(--boom-primary);
  color: var(--boom-cta-text);
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
  box-shadow:
    0 2px 8px color-mix(in srgb, var(--boom-primary) 35%, transparent),
    0 1px 4px color-mix(in srgb, var(--boom-primary) 40%, transparent),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  transition:
    transform 0.15s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    background 0.2s var(--ease-out),
    opacity 0.2s var(--ease-out);
  border: none;
  white-space: nowrap;
}

#boom-chat-widget .boom-mini-cta:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 12px color-mix(in srgb, var(--boom-primary) 45%, transparent),
    0 2px 6px color-mix(in srgb, var(--boom-primary) 55%, transparent),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

#boom-chat-widget .boom-mini-cta:active {
  transform: translateY(0);
}

#boom-chat-widget .boom-mini-cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#boom-chat-widget .boom-mini-cta-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  filter: drop-shadow(0 0.5px 1px rgba(0, 0, 0, 0.2));
}

.boom-preview-message.show {
  opacity: 1;
  transform: translateY(0);
}

.boom-preview-content {
  background: #ffffff;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--boom-text);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 0 0 0.5px rgba(0, 0, 0, 0.04);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  position: relative;
}

/* Downward pointer that connects to minimized pill */
.boom-preview-content::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 24px; /* tweak to point near CTA */
  width: 12px;
  height: 12px;
  background: #ffffff;
  transform: rotate(45deg);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.08);
}

/* ========================================
   Chat Window - Premium
   ======================================== */

.boom-chat-window {
  position: fixed;
  right: 20px;
  top: 20px;
  bottom: 20px; /* nearly full height */
  width: 380px;
  background: var(--boom-bg-secondary);
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px) translateX(8px) scale(0.94);
  transition:
    opacity 0.25s var(--ease-out),
    transform 0.25s var(--ease-out);
  overscroll-behavior: contain;
  touch-action: none;
  z-index: calc(var(--boom-z-index) + 1); /* Must be above overlay */
}

.boom-chat-window.open {
  display: flex;
  animation: windowOpen 0.3s var(--ease-out) forwards;
}

@keyframes windowOpen {
  0% {
    opacity: 0;
    transform: translateY(24px) translateX(8px) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Light page overlay when panel is open */
.boom-agent-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.06);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease-out);
  z-index: var(--boom-z-index); /* Base layer - below chat window */
}
.boom-agent-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ========================================
   Chat Header - Gradient & Blur
   ======================================== */

.boom-chat-header {
  background: transparent;
  color: var(--boom-text);
  padding: 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.boom-chat-header-top {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 10px 10px 0 10px;
  background: #ffffff;
  border-radius: 9999px;
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow-sm);
}

.boom-chat-header-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--boom-gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.boom-chat-header-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.boom-chat-header-logo.no-logo {
  background: var(--boom-primary);
}

.boom-chat-header-logo svg {
  width: 14px;
  height: 14px;
  fill: white;
}

.boom-chat-header-text {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.boom-chat-header-brand {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--boom-primary);
}

.boom-powered-by {
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  opacity: 0.75;
  text-decoration: none;
  letter-spacing: -0.01em;
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
  display: inline-block;
}
.boom-powered-by {
  display: none;
}

.boom-powered-by:hover {
  opacity: 0.95;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.boom-chat-refresh {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s var(--ease-out),
    transform 0.15s var(--ease-out);
  flex-shrink: 0;
}

.boom-chat-refresh:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.boom-chat-refresh:active {
  transform: scale(0.95);
}

.boom-chat-refresh svg {
  width: 18px;
  height: 18px;
}

.boom-chat-close {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--boom-primary) !important;
  color: #ffffff !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s var(--ease-out),
    transform 0.15s var(--ease-out);
  flex-shrink: 0;
  padding: 0;
  border: none;
  cursor: pointer;
}

.boom-chat-close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.boom-chat-close:hover {
  background: var(--boom-primary-dark) !important;
  transform: scale(1.05);
}

.boom-chat-close:active {
  transform: scale(0.95);
}

/* Header always visible - removed hide logic */

/* ========================================
   Messages Area - Refined
   ======================================== */

.boom-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--boom-bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
}

/* Center hero vertically when visible */
.boom-chat-window.hero-visible .boom-chat-messages {
  justify-content: center;
}

/* Agent hero (intro) */
.boom-agent-hero {
  padding: 20px 20px 8px;
  text-align: center;
}
.boom-agent-hero .boom-hero-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin: 12px auto 10px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.boom-agent-hero .boom-hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.boom-agent-hero .boom-hero-avatar .boom-user-icon {
  width: 28px;
  height: 28px;
}

/* When using icon fallback, show primary color background */
.boom-agent-hero .boom-hero-avatar:has(.boom-user-icon) {
  background: var(--boom-primary);
}
.boom-agent-hero .boom-hero-title {
  margin: 6px 0 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.boom-agent-hero .boom-hero-sub {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--boom-text-secondary);
}
.boom-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.boom-suggestion-chip {
  background: #ffffff !important;
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  color: var(--boom-text);
  border-radius: 9999px;
  padding: 8px 16px !important;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  transition:
    background 0.2s var(--ease-out),
    transform 0.15s var(--ease-out);
  cursor: pointer;
}
.boom-suggestion-chip:hover {
  background: var(--boom-gray-200);
  transform: translateY(-1px);
}

.boom-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.boom-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.boom-chat-messages::-webkit-scrollbar-thumb {
  background: var(--boom-gray-300);
  border-radius: 3px;
}

.boom-chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--boom-gray-400);
}

/* Load More Button */
#boom-chat-widget .boom-load-more-btn {
  display: block;
  width: auto;
  margin: 0 auto 16px auto;
  padding: 8px 16px; /* override base button reset */
  background: var(--boom-primary);
  color: white;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  box-shadow: var(--shadow-sm);
  text-align: center;
  min-height: 32px; /* ensure visible tap target */
}

#boom-chat-widget .boom-load-more-btn:hover {
  background: var(--boom-primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

#boom-chat-widget .boom-load-more-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Loading state for Load More button */
#boom-chat-widget .boom-load-more-btn.loading {
  position: relative;
  opacity: 0.9;
}

#boom-chat-widget .boom-load-more-btn.loading::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: #ffffff;
  margin-left: 8px;
  vertical-align: -3px;
  animation: boom-spin 0.8s linear infinite;
}

@keyframes boom-spin {
  to {
    transform: rotate(360deg);
  }
}

.boom-chat-message-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.boom-chat-message-wrapper.user {
  flex-direction: row-reverse;
}

.boom-chat-message-wrapper.animate-in {
  animation: messageSend 0.4s var(--ease-spring);
}

@keyframes messageSend {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }
  50% {
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.boom-chat-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.boom-chat-message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.boom-chat-message-avatar svg {
  width: 16px;
  height: 16px;
  fill: var(--boom-primary);
}

.boom-chat-message {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 18px;
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.boom-chat-message a {
  color: inherit;
  text-decoration: underline;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.boom-chat-message a:hover {
  opacity: 0.8;
}

.boom-chat-message strong {
  font-weight: 600;
}

.boom-chat-message em {
  font-style: italic;
}

.boom-chat-message ul,
.boom-chat-message ol {
  margin: 8px 0;
  padding-left: 20px;
}

.boom-chat-message li {
  margin: 4px 0;
}

.boom-chat-message p {
  margin: 0;
}

.boom-chat-message p + p {
  margin-top: 8px;
}

.boom-chat-message-wrapper.bot .boom-chat-message {
  background: white;
  color: var(--boom-text);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.boom-chat-message-wrapper.user .boom-chat-message {
  background: var(--boom-primary);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.12),
    inset 0 -1px 0 rgba(255, 255, 255, 0.15);
}

.boom-chat-message-wrapper.user .boom-chat-message a {
  color: white;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.6);
}

.boom-chat-message-wrapper.user .boom-chat-message a:hover {
  text-decoration-color: white;
}

.boom-chat-message-wrapper.user .boom-chat-message-avatar {
  display: none;
}

.boom-chat-typing {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.boom-chat-typing .boom-chat-message {
  padding: 16px 20px;
  display: flex;
  gap: 6px;
  background: white;
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  align-items: center;
}

.boom-chat-typing-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #000000; /* Pure black */
  animation: typing 1.4s ease-in-out infinite;
}

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

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

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

/* ========================================
   Input Area - Premium
   ======================================== */

.boom-chat-input-area {
  padding: 16px 20px 8px;
  border-top: none;
  background: transparent; /* match chat background */
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
}

.boom-chat-input-wrapper {
  flex: 1;
  position: relative;
}

.boom-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0 8px;
}

.boom-powered-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--boom-text-tertiary);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.boom-powered-link:hover {
  opacity: 1;
}

.boom-powered-text {
  display: inline-block;
}

.boom-powered-logo {
  height: 14px;
  width: auto;
  display: block;
  opacity: 0.9;
}

#boom-chat-widget .boom-chat-input-container {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  background: #ffffff !important;
  border: none !important;
  border-radius: 22px !important;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0) !important;
  width: 100% !important;
  min-height: 44px !important;
  padding-right: 52px !important; /* space for send icon */
}

#boom-chat-widget .boom-chat-input {
  width: 100% !important;
  padding: 12px 52px 12px 16px !important; /* space for send button */
  border: none !important;
  border-radius: 22px !important;
  font-size: 15px !important;
  font-family: inherit !important;
  color: var(--boom-text) !important;
  background: transparent !important;
  outline: none !important;
  resize: none !important;
  max-height: 120px !important;
  overflow-y: auto !important;
  line-height: 1.4 !important;
  letter-spacing: -0.01em !important;
  box-sizing: border-box !important;

  transition:
    border-color 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    background 0.2s var(--ease-out);
}

#boom-chat-widget .boom-chat-input::placeholder {
  color: rgba(0, 0, 0, 0.32) !important;
  font-weight: 400 !important;
}
/* Quick actions removed per user request */

#boom-chat-widget .boom-chat-input:focus {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--boom-primary) 10%, transparent),
    0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

#boom-chat-widget .boom-chat-input:disabled {
  background: var(--boom-gray-100) !important;
  color: var(--boom-text-tertiary) !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
}

/* Upload Button - Temporarily disabled */
/* .boom-upload-btn {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--boom-text-tertiary);
  transition:
    background 0.2s var(--ease-out),
    color 0.2s var(--ease-out),
    transform 0.15s var(--ease-out);
}

.boom-upload-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.boom-upload-btn:hover {
  background: var(--boom-gray-200);
  color: var(--boom-text-secondary);
  transform: translateY(-50%) scale(1.08);
}

.boom-upload-btn:active {
  transform: translateY(-50%) scale(0.92);
}

.boom-upload-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
} */

/* Image in Message Bubble - Temporarily disabled */
/* .boom-message-image {
  max-width: 250px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  margin-bottom: 4px;
}

.boom-chat-message-wrapper.user .boom-message-image {
  margin-left: auto;
} */

/* Error Toast Notification */
.boom-error-toast {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #ff3b30;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

.boom-error-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Connectivity Error Banner */
.boom-connectivity-error {
  background: #fff9f0;
  border: 1px solid #ffe5cc;
  border-radius: 12px;
  margin: 12px;
  padding: 16px;
  color: #664d03;
  font-size: 13px;
  line-height: 1.5;
  animation: slideIn 0.3s var(--ease-out);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.boom-connectivity-error-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.boom-connectivity-error-icon {
  flex-shrink: 0;
  color: #ff9800;
  margin-top: 2px;
}

.boom-connectivity-error-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.boom-connectivity-error-title {
  font-weight: 600;
  font-size: 14px;
  color: #1d1d1f;
}

.boom-connectivity-error-message {
  font-size: 13px;
  color: #636366;
  line-height: 1.5;
}

.boom-connectivity-error-link {
  color: #007aff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s var(--ease-out);
}

.boom-connectivity-error-link:hover {
  color: #0051d5;
  text-decoration: underline;
}

.boom-connectivity-retry {
  background: #007aff;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition:
    background 0.2s var(--ease-out),
    transform 0.15s var(--ease-out);
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

.boom-connectivity-retry:hover {
  background: #0051d5;
  transform: translateY(-1px);
}

.boom-connectivity-retry:active {
  transform: translateY(0);
}

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

.boom-chat-send {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--boom-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  cursor: pointer;

  transition:
    transform 0.15s ease,
    opacity 0.2s ease,
    background 0.2s ease;
}

.boom-chat-send:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.05);
  background: var(--boom-primary-dark);
}

.boom-chat-send:active:not(:disabled) {
  transform: translateY(-50%) scale(0.95);
}

.boom-chat-send:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  background: var(--boom-gray-400);
}

.boom-chat-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.boom-chat-send.enabled {
  background: var(--boom-primary);
  opacity: 1;
}

/* ========================================
   Mobile Responsive
   ======================================== */

/* Prevent body scroll when chat is open on mobile */
@media (max-width: 768px) {
  body:has(.boom-chat-window.open) {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  #boom-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  .boom-chat-bubble {
    display: none;
  }

  .boom-chat-bubble svg {
    width: 26px;
    height: 26px;
  }

  .boom-whatsapp-bubble {
    width: 56px;
    height: 56px;
    bottom: 72px; /* 56px chat bubble height + 16px gap */
  }

  .boom-whatsapp-bubble svg {
    width: 26px;
    height: 26px;
  }

  .boom-chat-window {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    height: 100dvh; /* Use dynamic viewport height for mobile keyboard handling */
    max-height: none;
    border-radius: 0;
  }

  .boom-minimized {
    display: inline-flex;
  }

  .boom-chat-header {
    flex-shrink: 0;
  }

  .boom-chat-header-top {
    padding: 16px 18px 14px;
  }

  .boom-chat-header-status {
    padding: 8px 18px;
  }

  .boom-chat-messages {
    padding: 16px;
    /* Ensure messages area can scroll independently */
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }

  .boom-chat-input-area {
    padding: 12px 16px 4px;
    flex-shrink: 0;
  }

  .boom-footer {
    /* Add safe area for devices with notches */
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  #boom-chat-widget .boom-chat-input-container {
    min-height: 48px !important; /* Slightly taller for better touch target */
  }

  #boom-chat-widget .boom-chat-input {
    font-size: 16px !important; /* Prevent zoom on iOS */
  }

  .boom-preview-message {
    max-width: calc(100vw - 40px);
    bottom: calc(100% + 12px); /* Position above minimized widget */
    right: 0;
  }

  /* Hero adjustments for mobile */
  .boom-agent-hero {
    padding: 30px 20px 16px;
  }

  .boom-agent-hero .boom-hero-avatar {
    width: 64px;
    height: 64px;
  }

  .boom-agent-hero .boom-hero-avatar .boom-user-icon {
    width: 32px;
    height: 32px;
  }

  .boom-agent-hero .boom-hero-title {
    font-size: 22px;
  }

  /* Suggestion chips responsive sizing */
  .boom-suggestion-chip {
    font-size: 14px;
    padding: 10px 18px !important;
    white-space: nowrap;
  }

  .boom-suggestions {
    gap: 8px;
    flex-wrap: wrap;
  }
}

/* ========================================
   Print & Accessibility
   ======================================== */

@media print {
  #boom-chat-widget {
    display: none !important;
  }
}

.boom-chat-bubble:focus-visible,
.boom-whatsapp-bubble:focus-visible,
.boom-chat-close:focus-visible,
.boom-chat-refresh:focus-visible,
.boom-chat-send:focus-visible,
.boom-chat-input:focus-visible,
.boom-upload-btn:focus-visible,
.boom-mini-logo:focus-visible,
.boom-mini-cta:focus-visible {
  outline: 2px solid var(--boom-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
