/* =====================================================
   FLOATING CHAT WIDGET STYLESHEET (ULTRA PREMIUM AESTHETICS)
   Path: css/components/floating-chat-widget.css
===================================================== */

/* -----------------------------------------------------
   0. CONTAINER OVERFLOW UNLOCK
----------------------------------------------------- */
#cta-whatsapp-container,
#floating-chat-placeholder,
#esi-chatbot {
  position: static !important;
  overflow: visible !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* -----------------------------------------------------
   1. WHATSAPP FLOATING CTA BUTTON (Bottom-most at Bottom Right)
----------------------------------------------------- */
.wa-icon {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  text-decoration: none !important;
  z-index: 99980 !important;
  visibility: visible !important;
  opacity: 1 !important;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wa-icon:hover {
  transform: translateY(-4px) scale(1.05) !important;
}

.wa-circle {
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: #25d366 !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.45) !important;
  border: 2px solid #ffffff !important;
  font-size: 30px !important;
  box-sizing: border-box !important;
  transition: box-shadow 0.3s ease !important;
}

.wa-icon:hover .wa-circle {
  box-shadow: 0 12px 30px rgba(37, 211, 102, 0.6) !important;
}

.wa-text {
  background: #ffffff !important;
  color: #15803d !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  font-family: inherit !important;
  padding: 8px 16px !important;
  border-radius: 50px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
  border: 1px solid #dcfce7 !important;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.wa-icon:hover .wa-text {
  opacity: 1 !important;
  transform: translateX(0) !important;
}

/* -----------------------------------------------------
   2. ESI AI CHATBOT FAB (Above WhatsApp Button)
----------------------------------------------------- */
#esi-chatbot {
  font-family: inherit;
}

@keyframes esiFabGlow {
  0% {
    box-shadow: 0 8px 25px rgba(20, 82, 40, 0.45), 0 0 0 0 rgba(20, 82, 40, 0.35);
  }

  70% {
    box-shadow: 0 8px 25px rgba(20, 82, 40, 0.45), 0 0 0 12px rgba(20, 82, 40, 0);
  }

  100% {
    box-shadow: 0 8px 25px rgba(20, 82, 40, 0.45), 0 0 0 0 rgba(20, 82, 40, 0);
  }
}

#esi-fab {
  position: fixed !important;
  bottom: 92px !important;
  right: 24px !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #1e7a52 0%, #155c3e 50%, #0d3d22 100%) !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
  animation: esiFabGlow 3s infinite !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99990 !important;
  cursor: pointer !important;
  outline: none !important;
  visibility: visible !important;
  opacity: 1 !important;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease !important;
}

#esi-fab svg {
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: transform 0.3s ease;
}

#esi-fab:hover {
  transform: translateY(-4px) scale(1.08) !important;
}

#esi-fab:hover svg {
  transform: rotate(12deg) scale(1.1);
}

#esi-fab.open {
  background: linear-gradient(135deg, #0d3d22 0%, #062316 100%) !important;
  animation: none !important;
}

#fab-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px #ef4444;
}

/* -----------------------------------------------------
   3. ESI AI CHATBOT POPUP WINDOW CARD (Full Popup Layout)
----------------------------------------------------- */
#esi-popup {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  top: auto !important;
  width: 400px !important;
  max-width: calc(100vw - 32px) !important;
  height: min(740px, calc(100dvh - var(--nav-height, 72px) - 36px)) !important;
  max-height: calc(100dvh - var(--nav-height, 72px) - 36px) !important;
  border-radius: 22px !important;
  background: #ffffff !important;
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(226, 232, 240, 0.8) !important;
  z-index: 99995 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(0.92);
  transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  box-sizing: border-box !important;
}

#esi-popup.visible {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1) !important;
  display: flex !important;
}

/* Hide WhatsApp and Floating FAB when popup is open */
body.esi-chat-open .wa-icon,
body.esi-chat-open #esi-fab,
#esi-popup.visible~#esi-fab {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: scale(0.8) translateY(12px) !important;
}

/* Header Styling */
.esi-header {
  background: linear-gradient(135deg, #062316 0%, #0d3d22 50%, #145228 100%) !important;
  color: #ffffff !important;
  padding: 14px 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

.esi-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.esi-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.esi-header-name {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.2;
  letter-spacing: 0.2px;
}

.esi-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.70rem;
  color: rgba(255, 255, 255, 0.88);
  margin-top: 3px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 10px #4ade80;
  animation: esiPulse 2s infinite ease-in-out;
}

.esi-header-actions {
  display: flex;
  gap: 6px;
}

.header-btn {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: background 0.2s ease, transform 0.2s ease !important;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  transform: scale(1.08) !important;
}

/* Chat Body */
.esi-messages {
  flex: 1;
  min-height: 0;
  padding: 16px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  scrollbar-width: thin;
  scrollbar-color: rgba(203, 213, 225, 0.7) transparent;
}

.esi-messages::-webkit-scrollbar {
  width: 4px;
}

.esi-messages::-webkit-scrollbar-thumb {
  background: rgba(203, 213, 225, 0.7);
  border-radius: 10px;
}

.date-divider {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
  margin: 2px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.bot-av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e7a52 0%, #0d3d22 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(13, 61, 34, 0.25);
}

.bubble {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 18px 18px 18px 4px;
  background: #ffffff;
  color: #0f172a;
  font-size: 11px !important;
  line-height: 1.55;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  border: 1px solid #e2e8f0;
}

.msg-row.user {
  display: flex !important;
  justify-content: flex-end !important;
  width: 100% !important;
}

.user-msg-container {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  margin-left: auto !important;
  max-width: 86% !important;
}

.bubble.user-b {
  align-self: flex-end !important;
  width: fit-content !important;
  max-width: 100% !important;
  word-break: normal !important;
  white-space: pre-wrap !important;
  border-radius: 16px 16px 4px 16px !important;
  background: linear-gradient(135deg, #145228 0%, #0d3d22 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 6px 18px rgba(13, 61, 34, 0.25) !important;
  font-weight: 500 !important;
  font-size: 11px !important;
  padding: 8px 13px !important;
  letter-spacing: 0.1px !important;
}

.msg-meta {
  font-size: 9.5px !important;
  color: #94a3b8;
  margin-top: 4px;
  padding: 0 4px;
  font-weight: 500;
}

.msg-meta.user-m {
  text-align: right;
}

/* Visitor Email Prompt Card (Ultra Premium Design) */
.email-bubble {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid #e2e8f0 !important;
  padding: 14px 16px !important;
  border-radius: 18px 18px 18px 4px !important;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(0, 0, 0, 0.03) !important;
  max-width: 100% !important;
}

.email-title {
  font-size: 12px !important;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.email-copy {
  font-size: 11px !important;
  color: #64748b;
  margin-bottom: 12px;
  line-height: 1.5;
}

.email-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.email-input-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.email-input-icon {
  position: absolute;
  left: 12px;
  font-size: 11px;
  color: #94a3b8;
  pointer-events: none;
  transition: color 0.2s ease;
}

.email-input-box:focus-within .email-input-icon {
  color: #145228;
}

.email-input {
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 8px 12px 8px 32px !important;
  font-size: 11px !important;
  border-radius: 10px !important;
  border: 1.5px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-family: inherit !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.email-input:focus {
  border-color: #145228 !important;
  box-shadow: 0 0 0 3.5px rgba(20, 82, 40, 0.15) !important;
  background: #ffffff !important;
}

.email-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 2px;
}

.email-action {
  font-family: inherit;
  font-size: 11px !important;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.email-btn-submit {
  flex: 1;
  gap: 6px;
  background: linear-gradient(135deg, #1e7a52 0%, #145228 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 10px !important;
  padding: 8px 14px !important;
  box-shadow: 0 3px 10px rgba(20, 82, 40, 0.25) !important;
}

.email-btn-submit:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(20, 82, 40, 0.35) !important;
}

.email-btn-submit:active {
  transform: translateY(0) !important;
}

.email-btn-submit:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  background: #94a3b8 !important;
  box-shadow: none !important;
  transform: none !important;
}

.email-btn-skip {
  background: #f0fdf4 !important;
  color: #145228 !important;
  border: 1px solid #bbf7d0 !important;
  border-radius: 10px !important;
  padding: 8px 16px !important;
  white-space: nowrap;
  cursor: pointer !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(20, 82, 40, 0.08) !important;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.email-btn-skip:hover {
  background: #dcfce7 !important;
  color: #0d3d22 !important;
  border-color: #86efac !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px rgba(20, 82, 40, 0.15) !important;
}

/* Typing Indicator Animation */
.typing-bubble {
  padding: 8px 12px;
  background: #ffffff;
  border-radius: 18px 18px 18px 4px;
  border: 1px solid #e2e8f0;
  display: flex;
  gap: 5px;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1e7a52;
  animation: esiPulse 1.2s infinite ease-in-out;
}

.tdot:nth-child(2) {
  animation-delay: 0.2s;
}

.tdot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes esiPulse {

  0%,
  100% {
    transform: scale(0.7);
    opacity: 0.4;
  }

  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Quick Prompt Chips (Floating Soft Green Buttons with Symmetrical Spacing) */
.quick-chips {
  margin: 6px 14px 6px 14px !important;
  padding: 4px 0 4px 0 !important;
  display: flex;
  gap: 8px !important;
  overflow-x: auto !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  scrollbar-width: none !important;
  box-sizing: border-box !important;
}

.quick-chips::-webkit-scrollbar {
  display: none !important;
}

.quick-chips::after {
  content: "" !important;
  display: block !important;
  flex: 0 0 14px !important;
  height: 1px !important;
  pointer-events: none !important;
}

.chip {
  background: #f0fdf4 !important;
  color: #145228 !important;
  border: 1px solid #bbf7d0 !important;
  padding: 6px 12px !important;
  border-radius: 50px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(20, 82, 40, 0.08) !important;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  font-family: inherit;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

.chip:hover {
  background: linear-gradient(135deg, #1e7a52 0%, #0d3d22 100%) !important;
  color: #ffffff !important;
  border-color: #145228 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 14px rgba(20, 82, 40, 0.3) !important;
}

.chip:disabled,
.chip[disabled] {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
  box-shadow: none !important;
}

.chip.used {
  opacity: 0.75;
  cursor: pointer;
}

/* Input Row */
.esi-input-row {
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: center;
}

.esi-input {
  flex: 1;
  border: 1px solid #cbd5e1 !important;
  border-radius: 50px !important;
  padding: 8px 14px !important;
  font-size: 11px !important;
  outline: none !important;
  transition: all 0.2s ease !important;
  font-family: inherit;
  box-sizing: border-box;
}

.esi-input:disabled {
  background-color: #f1f5f9 !important;
  color: #94a3b8 !important;
  cursor: not-allowed !important;
  border-color: #e2e8f0 !important;
}

.esi-input:focus {
  border-color: #145228 !important;
  box-shadow: 0 0 0 4px rgba(20, 82, 40, 0.15) !important;
}

.send-btn {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #1e7a52 0%, #145228 100%) !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(20, 82, 40, 0.35) !important;
  transition: all 0.25s ease !important;
}

.send-btn:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 6px 20px rgba(20, 82, 40, 0.5) !important;
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* -----------------------------------------------------
   6. RESPONSIVE MOBILE & TABLET STYLES
----------------------------------------------------- */

/* Tablet & iPad Mini (481px - 1024px) */
@media (max-width: 1024px) and (min-width: 481px) {
  .wa-text {
    display: none !important;
    /* Hide text label on touch screens */
  }

  .wa-icon {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 99980 !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .wa-circle {
    width: 52px !important;
    height: 52px !important;
    font-size: 26px !important;
  }

  #esi-fab {
    position: fixed !important;
    bottom: 82px !important;
    right: 20px !important;
    width: 52px !important;
    height: 52px !important;
    z-index: 99990 !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  #esi-fab i {
    font-size: 22px !important;
  }

  #esi-popup {
    position: fixed !important;
    top: auto !important;
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
    width: 380px !important;
    max-width: calc(100vw - 40px) !important;
    height: min(640px, calc(100dvh - var(--nav-height, 72px) - 36px)) !important;
    max-height: calc(100dvh - var(--nav-height, 72px) - 36px) !important;
    border-radius: 20px !important;
    z-index: 99995 !important;
  }
}

/* Smartphone Mobile (<= 480px) */
@media (max-width: 480px) {
  .wa-text {
    display: none !important;
  }

  .wa-icon {
    position: fixed !important;
    bottom: 16px !important;
    right: 16px !important;
    z-index: 99980 !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .wa-circle {
    width: 48px !important;
    height: 48px !important;
    font-size: 24px !important;
  }

  #esi-fab {
    position: fixed !important;
    bottom: 74px !important;
    right: 16px !important;
    width: 48px !important;
    height: 48px !important;
    z-index: 99990 !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  #esi-fab i {
    font-size: 20px !important;
  }

  #esi-popup {
    position: fixed !important;
    top: calc(var(--nav-height, 60px) + 10px) !important;
    bottom: 12px !important;
    right: 12px !important;
    left: 12px !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
    height: auto !important;
    max-height: calc(100dvh - var(--nav-height, 60px) - 22px) !important;
    border-radius: 18px !important;
    z-index: 99995 !important;
  }

  .esi-header {
    padding: 14px 16px !important;
  }

  .esi-messages {
    padding: 14px 12px !important;
  }
}