/* ============================================================
   WHATSAPP FAB — Zohar I.T. Solutions
   Premium floating WhatsApp launcher with popup preview card
   ============================================================ */

/* ── Root container ── */
/* z-index sits above both the Charis trigger (9000) and chat window (8999) so
   that when the WhatsApp popup is opened — including when Charis opens it
   directly via window.ZitWhatsApp.open() — it's never obstructed by the
   Charis chat panel sitting above it on screen. */
#wa-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9001;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

/* ── Trigger button ── */
#wa-trigger {
  pointer-events: all;
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366 0%, #075e54 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 28px rgba(37, 211, 102, 0.52);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
  animation: wa-btn-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 1.4s both;
  flex-shrink: 0;
}

@keyframes wa-btn-in {
  from { transform: scale(0) rotate(-45deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

#wa-trigger:hover {
  transform: scale(1.11);
  box-shadow: 0 10px 40px rgba(37, 211, 102, 0.68);
}

/* Dual concentric pulse rings */
#wa-trigger::before {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid rgba(37, 211, 102, 0.38);
  animation: wa-ring 2.6s ease-in-out infinite;
  pointer-events: none;
}

#wa-trigger::after {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 1.5px solid rgba(37, 211, 102, 0.16);
  animation: wa-ring 2.6s ease-in-out 0.9s infinite;
  pointer-events: none;
}

@keyframes wa-ring {
  0%, 100% { transform: scale(1);    opacity: 0.75; }
  50%       { transform: scale(1.20); opacity: 0.12; }
}

/* Icons inside trigger */
.wa-icon-main {
  font-size: 1.75rem;
  color: #fff;
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.2s ease;
}

.wa-icon-close {
  position: absolute;
  font-size: 1.3rem;
  color: #fff;
  opacity: 0;
  transform: rotate(-80deg) scale(0.5);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.2s ease;
}

#wa-trigger.is-open .wa-icon-main {
  opacity: 0;
  transform: rotate(80deg) scale(0.5);
}
#wa-trigger.is-open .wa-icon-close {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Online status dot on trigger */
.wa-trigger-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #4ade80 40%, #22c55e 100%);
  border: 2.5px solid #fff;
  pointer-events: none;
  animation: wa-dot-glow 2.2s ease-in-out infinite;
}

@keyframes wa-dot-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(74, 222, 128, 0.70); }
  50%       { box-shadow: 0 0 14px rgba(74, 222, 128, 1.00); }
}

/* ── Popup preview card ── */
#wa-popup {
  pointer-events: none;
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 48px);
  background: #fff;
  border-radius: 20px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.22),
    0  4px 20px rgba(0, 0, 0, 0.10);
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.94);
  transition:
    opacity 0.32s ease,
    transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, opacity;
}

#wa-popup.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Popup header ── */
.wa-popup-head {
  background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.wa-popup-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.wa-popup-meta {
  flex: 1;
  min-width: 0;
}

.wa-popup-name {
  display: block;
  color: #fff;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-popup-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  margin-top: 3px;
}

.wa-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  animation: wa-dot-glow 2.2s ease-in-out infinite;
}

.wa-dismiss-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.wa-dismiss-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.08);
}

/* ── Popup body (chat preview area) ── */
.wa-popup-body {
  padding: 16px 18px 14px;
  background: #e5ddd5;
  background-image:
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.wa-bubble-wrap {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.wa-bubble {
  background: #fff;
  border-radius: 0 14px 14px 14px;
  padding: 11px 14px 7px;
  max-width: 92%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  position: relative;
}

.wa-bubble p {
  font-size: 0.875rem;
  color: #2d3436;
  line-height: 1.58;
  margin: 0 0 5px;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
.wa-bubble p:last-of-type { margin-bottom: 0; }
.wa-bubble strong { color: #075e54; }

.wa-bubble-time {
  display: block;
  text-align: right;
  font-size: 0.66rem;
  color: rgba(0, 0, 0, 0.38);
  margin-top: 5px;
}

/* Quick topic buttons */
.wa-topics-label {
  font-size: 0.70rem;
  color: rgba(0, 0, 0, 0.48);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin: 0 0 9px;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

.wa-qbtn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 7px;
  background: rgba(255, 255, 255, 0.90);
  border: 1.5px solid rgba(7, 94, 84, 0.16);
  border-radius: 11px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #075e54;
  text-align: left;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  transition: background 0.22s, border-color 0.22s, color 0.22s, transform 0.18s;
  backdrop-filter: blur(4px);
}
.wa-qbtn:last-child { margin-bottom: 0; }

.wa-qbtn i {
  font-size: 0.9rem;
  color: #25d366;
  flex-shrink: 0;
  width: 17px;
  text-align: center;
  transition: color 0.22s;
}

.wa-qbtn:hover,
.wa-qbtn.is-selected {
  background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(7, 94, 84, 0.28);
}
.wa-qbtn:hover i,
.wa-qbtn.is-selected i {
  color: #4ade80;
}

/* ── Popup footer / CTA ── */
.wa-popup-foot {
  padding: 14px 18px;
  background: #f7f7f7;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.wa-start-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.90rem;
  border-radius: 13px;
  text-decoration: none;
  box-shadow: 0 5px 22px rgba(37, 211, 102, 0.38);
  transition: transform 0.22s, box-shadow 0.22s, filter 0.22s;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: 0.01em;
}
.wa-start-btn i { font-size: 1.2rem; }
.wa-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 36px rgba(37, 211, 102, 0.52);
  color: #fff;
  filter: brightness(1.06);
}

.wa-encryption-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.68rem;
  color: rgba(0, 0, 0, 0.38);
  margin: 10px 0 0;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
.wa-encryption-note i { font-size: 0.62rem; }

/* ── Mobile ── */
@media (max-width: 480px) {
  #wa-fab { bottom: 20px; right: 20px; }
  #wa-popup {
    bottom: 72px;
    right: -8px;
    width: calc(100vw - 40px);
    max-width: 340px;
  }
}
