/* ==========================================================================
   Honey Translations - Fixed Floating Action Buttons (Bottom-Right Stack)
   Exact order from TOP to BOTTOM:
   1. Chat (Blue circle with speech bubble icon & "1" badge)
   2. WhatsApp (Green circle with WhatsApp icon)
   3. Call (Green circle with phone icon & yellow "24/7" pill badge)
   4. Scroll to top (Blue circle with up arrow icon)
   ========================================================================== */

/* Single Fixed Floating Container (Pinned in Bottom-Right Corner) */
.floating-toolbar {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 9998;
  pointer-events: auto;
  margin: 0;
  padding: 0;
}

@media (max-width: 575px) {
  .floating-toolbar {
    right: 14px;
    bottom: 14px;
    gap: 10px;
  }
}

/* Individual Floating Item */
.floating-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
}

.floating-item-call {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* All 4 Floating Buttons: Exactly 52px on Desktop, 48px below 576px */
.floating-btn {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, opacity 0.3s ease, visibility 0.3s ease;
  text-decoration: none;
  position: relative;
  box-sizing: border-box;
  padding: 0;
}

@media (max-width: 575px) {
  .floating-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }
}

.floating-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  color: #ffffff;
}

.floating-btn:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

.floating-btn i {
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 575px) {
  .floating-btn i {
    font-size: 19px;
  }
}

/* 1. Chat Icon (Image avatar & badge) */
.btn-ai-chat {
  background-color: #ffffff;
  padding: 0;
  overflow: visible;
}

.btn-ai-chat:hover {
  background-color: var(--pale-sky);
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.35);
}

.floating-chat-icon-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.chat-badge-count {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 2. WhatsApp (Green with WhatsApp logo) */
.btn-floating-whatsapp {
  background-color: #25d366;
}

.btn-floating-whatsapp:hover {
  background-color: #20bd5a;
}

/* 3. Call (Green with Phone icon & Yellow 24/7 Badge) */
.btn-call-247 {
  background-color: #22c55e;
}

.btn-call-247:hover {
  background-color: #16a34a;
}

.badge-247-pill {
  background-color: #facc15;
  color: #000000;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 1px 7px;
  border-radius: 9999px;
  border: 1.5px solid #ffffff;
  margin-bottom: -7px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  line-height: 1.3;
}

/* 4. Scroll to top (Lowest: Blue circle with up arrow icon) */
.back-to-top {
  background-color: var(--link);
  color: #ffffff;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  cursor: pointer;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.back-to-top:hover {
  background-color: var(--link);
  color: #ffffff;
}

/* Fallback: ensure back-to-top never occupies page flow */
a.back-to-top:not(.floating-btn) {
  position: fixed !important;
  right: 20px !important;
  bottom: 20px !important;
  display: none !important;
}

/* Hover Tooltips */
.floating-tooltip {
  position: absolute;
  right: 66px;
  background-color: var(--ink);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  z-index: 10;
}

.floating-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  border-width: 6px 0 6px 6px;
  border-style: solid;
  border-color: transparent transparent transparent var(--ink);
}

.floating-btn:hover .floating-tooltip,
.floating-btn:focus-visible .floating-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

@media (max-width: 768px) {
  .floating-tooltip {
    display: none;
  }
}

/* ==========================================================================
   AI Customer Support Chat Dock / Modal (#cb-win)
   Dimensions:
   - Width: 300px, Height: 250px
   - Position: Fixed, directly above the floating chatbot icon
   - Mobile: max-width: calc(100vw - 28px), max-height: calc(100vh - 30px)
   - Background: White, 14px rounded corners, subtle shadow
   - Scrollable messages, input and Send button fixed at bottom
   ========================================================================== */
.floating-panel-overlay {
  display: none !important;
}

#cb-win,
.floating-chat-dock {
  position: fixed;
  right: 20px;
  bottom: 288px;
  width: 300px;
  height: 250px;
  max-width: calc(100vw - 30px);
  max-height: calc(100vh - 30px);
  box-sizing: border-box;
  background-color: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 32px var(--border), 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--sky-tint);
  z-index: 10010;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-x: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s ease;
}

#cb-win.is-active,
.floating-chat-dock.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1) !important;
}

@media (max-width: 575px) {
  #cb-win,
  .floating-chat-dock {
    right: 14px;
    bottom: 260px;
    width: 300px;
    height: 250px;
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 30px);
    border-radius: 14px;
    transform-origin: bottom right;
  }
}

.chat-header {
  background: linear-gradient(135deg, var(--sky) 0%, var(--sky) 100%);
  color: #ffffff;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 0.75rem;
  color: #ffffff;
  flex-shrink: 0;
}

.ai-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #22c55e;
  border: 1.5px solid var(--border);
}

.chat-header-info h3 {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.15;
}

.chat-status-text {
  font-family: var(--font-sans, 'Lato', sans-serif);
  font-size: 0.65rem;
  color: var(--aqua-tint);
  display: block;
  line-height: 1.15;
}

.chat-close-btn {
  font-size: 1.25rem;
  color: #ffffff;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 1px 5px;
  border-radius: 4px;
  opacity: 0.85;
  transition: opacity 0.15s, background-color 0.15s;
}

.chat-close-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.16);
}

.chat-messages {
  flex: 1;
  min-height: 0;
  padding: 8px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--pale-sky);
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--aqua-tint) transparent;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--aqua-tint);
  border-radius: 4px;
}

.chat-bubble {
  max-width: 90%;
  padding: 7px 10px;
  border-radius: 8px;
  font-family: var(--font-sans, 'Lato', sans-serif);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.chat-bubble p {
  margin: 0 0 3px 0;
}

.chat-bubble p:last-child {
  margin: 0;
}

.cb-welcome-bubble {
  max-width: 100% !important;
}

.cb-welcome-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
  line-height: 1.35;
}

.cb-welcome-sub {
  color: var(--ink);
  margin-bottom: 6px;
  font-size: 11px;
  line-height: 1.3;
}

.bot-bubble {
  background-color: #ffffff;
  color: var(--ink);
  border: 1px solid var(--border);
  align-self: flex-start;
  box-shadow: 0 1px 4px var(--shadow);
  border-bottom-left-radius: 3px;
}

.user-bubble {
  background-color: var(--link);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
  box-shadow: 0 1px 4px var(--border);
}

.bubble-sender {
  font-family: var(--font-sans, 'Lato', sans-serif);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--link);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.chat-notice-box {
  background-color: var(--pale-sky);
  border: 1px solid var(--aqua-tint);
  color: var(--link);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  margin-top: 5px;
  display: flex;
  gap: 0.4rem;
  line-height: 1.35;
}

.chat-notice-box i {
  font-size: 0.78rem;
  margin-top: 1px;
  flex-shrink: 0;
  color: var(--link);
}

/* Quick-Reply Option Buttons */
.chat-quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.chat-quick-btn {
  background-color: var(--sky-tint);
  color: var(--link);
  border: 1px solid var(--aqua-tint);
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.chat-quick-btn:hover {
  background-color: var(--link);
  color: #FFFFFF;
  border-color: var(--link);
}

/* Typing Indicator Animation */
.chat-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px !important;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--link);
  border-radius: 50%;
  animation: cbTypingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes cbTypingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Message Input & Send Bar Fixed at Bottom */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background-color: #ffffff;
  border-top: 1px solid var(--sky-tint);
  flex-shrink: 0;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-family: var(--font-sans, 'Lato', sans-serif);
  font-size: 12px;
  border: 1.5px solid var(--sky-tint);
  border-radius: 18px;
  outline: none;
  background-color: var(--pale-sky);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-sizing: border-box;
}

.chat-input:focus {
  border-color: var(--link);
  background-color: #ffffff;
  box-shadow: 0 0 0 2px var(--border);
}

.chat-send-btn {
  background-color: var(--link);
  color: #ffffff;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 12.5px;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 6px var(--border);
}

.chat-send-btn:hover {
  background-color: var(--link);
  transform: scale(1.06);
}

.chat-send-btn:active {
  transform: scale(0.96);
}
