/* ============================================================
   Brata Media Press — whatsapp.css
   WhatsApp Business floating chat button + tooltip
   ============================================================ */

/* ── Root Wrapper ─────────────────────────────────────────── */
#wa-float-root {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  /* Clears back-to-top button (44px + gap) */
  bottom: 88px;
}

/* ── WhatsApp Floating Button ─────────────────────────────── */
.wa-float-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 20px rgba(37,211,102,0.4),
    0 2px 8px rgba(0,0,0,0.3);
  transition:
    transform 0.25s cubic-bezier(0.34,1.56,0.64,1),
    box-shadow 0.25s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.wa-float-btn:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow:
    0 8px 32px rgba(37,211,102,0.55),
    0 4px 16px rgba(0,0,0,0.35);
}

.wa-float-btn:active {
  transform: scale(0.96);
}

.wa-float-btn:focus-visible {
  outline: 2px solid #25D366;
  outline-offset: 3px;
}

/* WhatsApp icon */
.wa-icon {
  width: 32px;
  height: 32px;
  color: #FFFFFF;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

/* ── Pulse Ripple Animation ───────────────────────────────── */
.wa-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(37,211,102,0.5);
  animation: waPulseRing 2.2s ease-out infinite;
  pointer-events: none;
}

.wa-float-btn::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(37,211,102,0.25);
  animation: waPulseRing 2.2s ease-out 0.6s infinite;
  pointer-events: none;
}

@keyframes waPulseRing {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Pause pulse on hover — cleaner UX */
.wa-float-btn:hover .wa-pulse,
.wa-float-btn:hover::before {
  animation-play-state: paused;
}

/* ── Online dot on button ─────────────────────────────────── */
.wa-float-btn::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #44CC55;
  border-radius: 50%;
  border: 2px solid #128C7E;
  z-index: 3;
  animation: onlineBlink 3s ease-in-out infinite;
}

@keyframes onlineBlink {
  0%, 90%, 100% { opacity: 1; }
  95% { opacity: 0.3; }
}

/* ── Tooltip / Chat Preview Bubble ───────────────────────── */
.wa-tooltip {
  position: relative;
  background: #FFFFFF;
  border-radius: 14px 14px 14px 2px;
  padding: 14px 16px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.18),
    0 2px 8px rgba(0,0,0,0.1);
  max-width: 280px;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.95);
  transform-origin: bottom right;
  transition:
    opacity 0.28s cubic-bezier(0.34,1.56,0.64,1),
    transform 0.28s cubic-bezier(0.34,1.56,0.64,1),
    visibility 0.28s;
  pointer-events: none;
}

.wa-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Dismiss button inside tooltip */
.wa-tooltip::before {
  content: '';
  display: none; /* managed by JS */
}

/* Tooltip caret (arrow) pointing down-right */
.wa-tooltip-caret {
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 4px solid transparent;
  border-top: 8px solid #FFFFFF;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.08));
}

/* Tooltip inner layout */
.wa-tooltip-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Avatar with online dot */
.wa-tooltip-avatar {
  position: relative;
  flex-shrink: 0;
}
.wa-tooltip-avatar img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #25D366;
  background: #f3f3f3;
}
.wa-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background: #44CC55;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* Text content */
.wa-tooltip-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wa-tooltip-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #111;
  letter-spacing: 0.02em;
  display: block;
}
.wa-tooltip-msg {
  font-family: 'Barlow', sans-serif;
  font-size: 12px;
  color: #555;
  line-height: 1.45;
  display: block;
}

/* ── Label "Need Help?" tag ───────────────────────────────── */
.wa-help-label {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(37,211,102,0.35);
  animation: waLabelFadeIn 0.4s ease 1.5s both;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.wa-help-label:hover {
  opacity: 0.9;
  transform: translateX(-2px);
}

.wa-help-label.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
}

@keyframes waLabelFadeIn {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Entrance Animation ───────────────────────────────────── */
#wa-float-root {
  animation: waEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) 2s both;
}

@keyframes waEnter {
  from { opacity: 0; transform: translateY(20px) scale(0.8); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Mobile Adjustments ───────────────────────────────────── */
@media (max-width: 768px) {
  #wa-float-root {
    bottom: 84px;
    right: 16px;
  }
  .wa-float-btn {
    width: 54px;
    height: 54px;
  }
  .wa-icon {
    width: 28px;
    height: 28px;
  }
  .wa-tooltip {
    max-width: 240px;
    min-width: 200px;
    right: 0;
  }
  .wa-help-label { display: none; }
}

@media (max-width: 380px) {
  .wa-tooltip { min-width: 180px; }
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .wa-pulse,
  .wa-float-btn::before,
  .wa-float-btn::after,
  #wa-float-root { animation: none !important; }
  .wa-tooltip { transition: opacity 0.15s, visibility 0.15s; }
  .wa-float-btn { transition: none; }
}
