/* ============================================================
   Experi WhatsApp Click-to-Chat Widget
   Palette: --wa-navy #003f87 | --wa-red #da2532 | --wa-green #25D366
   Fonts:   Barlow (headings) | Roboto (body) — matches site stack
   ============================================================ */

:root {
  --wa-navy:        #003f87;
  --wa-navy-dark:   #003070;
  --wa-red:         #da2532;
  --wa-green:       #25D366;
  --wa-green-dark:  #1ebe5d;
  --wa-white:       #ffffff;
  --wa-offwhite:    #f7fafc;
  --wa-text:        #003f87;
  --wa-muted:       #4a5568;
  --wa-radius:      7px;
  --wa-radius-lg:   20px;
  --wa-shadow:      0 12px 40px rgba(0,63,135,0.22);
  --wa-shadow-btn:  0 8px 24px rgba(37,211,102,0.45);
}

/* ── Root container ──────────────────────────────────────── */
#experi-wa-root {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
}

#experi-wa-root.pos-bottom-right {
  bottom: 28px;
  right:  28px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

#experi-wa-root.pos-bottom-left {
  bottom: 28px;
  left:   28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

#experi-wa-root * {
  box-sizing: border-box;
  pointer-events: auto;
}

/* ── Tooltip card ────────────────────────────────────────── */
#experi-wa-tooltip {
  background: var(--wa-white);
  border-radius: var(--wa-radius-lg);
  box-shadow: var(--wa-shadow);
  width: 300px;
  overflow: hidden;
  transform: translateY(16px) scale(0.95);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.34,1.56,0.64,1),
              transform 0.32s cubic-bezier(0.34,1.56,0.64,1),
              visibility 0s linear 0.32s;
  transform-origin: bottom right;
}

.pos-bottom-left #experi-wa-tooltip {
  transform-origin: bottom left;
}

#experi-wa-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition: opacity 0.32s cubic-bezier(0.34,1.56,0.64,1),
              transform 0.32s cubic-bezier(0.34,1.56,0.64,1),
              visibility 0s linear 0s;
}

/* Tooltip header — navy brand bar */
.experi-wa-tip-header {
  background: linear-gradient(135deg, var(--wa-navy) 0%, #14224d 100%);
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.experi-wa-tip-close {
  position: absolute;
  top:   8px;
  right: 10px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--wa-white);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  animation: none !important;
  -webkit-animation: none !important;
}
.experi-wa-tip-close:hover { background: rgba(255,255,255,0.3); }

/* Agent avatar */
.experi-wa-avatar {
  width:  42px;
  height: 42px;
  border-radius: 50%;
  background: var(--wa-green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.experi-wa-avatar svg {
  width: 24px;
  height: 24px;
  fill: var(--wa-white);
}

.experi-wa-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* Online dot */
.experi-wa-online-dot {
  position: absolute;
  bottom: 2px;
  right:  2px;
  width:  10px;
  height: 10px;
  background: #4ade80;
  border-radius: 50%;
  border: 2px solid var(--wa-navy);
}

.experi-wa-agent-info {
  flex: 1;
  min-width: 0;
}

.experi-wa-agent-name {
  font-family: 'Barlow', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--wa-white);
  margin: 0 0 2px;
  line-height: 1.2;
}

.experi-wa-agent-status {
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin: 0;
}

/* Tooltip body */
.experi-wa-tip-body {
  padding: 16px;
}

/* Chat bubble — looks like a WhatsApp message */
.experi-wa-bubble {
  background: var(--wa-offwhite);
  border-radius: 0 14px 14px 14px;
  padding: 12px 14px;
  position: relative;
  margin-bottom: 4px;
}

.experi-wa-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  border-width: 0 8px 8px 0;
  border-style: solid;
  border-color: transparent var(--wa-offwhite) transparent transparent;
}

.experi-wa-bubble-line1 {
  font-family: 'Barlow', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--wa-text);
  display: block;
  margin-bottom: 3px;
}

.experi-wa-bubble-line2 {
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  color: var(--wa-muted);
  display: block;
}

.experi-wa-bubble-time {
  font-size: 11px;
  color: #a0aec0;
  text-align: right;
  margin-top: 4px;
  display: block;
}

/* CTA button inside tooltip */
.experi-wa-tip-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 20px;
  background: var(--wa-green);
  color: var(--wa-white);
  border-radius: var(--wa-radius);
  font-family: 'Barlow', sans-serif;
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(37,211,102,0.35);
  animation: none !important;
  -webkit-animation: none !important;
}

.experi-wa-tip-cta:hover {
  background: var(--wa-green-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37,211,102,0.45);
  color: var(--wa-white);
  text-decoration: none;
}

.experi-wa-tip-cta svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Trust strip */
.experi-wa-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  font-family: 'Roboto', sans-serif;
  font-size: 11px;
  color: #718096;
}

.experi-wa-trust svg {
  width: 12px;
  height: 12px;
  fill: #25D366;
  flex-shrink: 0;
}

/* ── FAB Button ──────────────────────────────────────────── */
#experi-wa-fab {
  position: relative;
  width:  60px;
  height: 60px;
  border-radius: 50%;
  background: var(--wa-green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--wa-shadow-btn);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1),
              box-shadow 0.2s;
  animation: none !important;
  -webkit-animation: none !important;
  flex-shrink: 0;
}

#experi-wa-fab:hover {
  transform: scale(1.12);
  box-shadow: 0 12px 32px rgba(37,211,102,0.55);
}

#experi-wa-fab svg {
  width:  32px;
  height: 32px;
  fill: var(--wa-white);
  transition: opacity 0.2s, transform 0.2s;
  position: absolute;
}

#experi-wa-fab .wa-icon-wa  { opacity: 1;  transform: rotate(0deg)   scale(1); }
#experi-wa-fab .wa-icon-x   { opacity: 0;  transform: rotate(-90deg) scale(0.6); }

#experi-wa-fab.open .wa-icon-wa { opacity: 0;  transform: rotate(90deg) scale(0.6); }
#experi-wa-fab.open .wa-icon-x  { opacity: 1;  transform: rotate(0deg) scale(1); }

/* Notification badge */
#experi-wa-badge {
  position: absolute;
  top:  -4px;
  right: -4px;
  background: var(--wa-red);
  color: var(--wa-white);
  font-family: 'Barlow', sans-serif;
  font-weight: 700;
  font-size: 11px;
  width:  20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--wa-white);
  pointer-events: none;
  animation: experi-wa-badge-pop 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes experi-wa-badge-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* Pulse ring */
#experi-wa-fab.pulse::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid var(--wa-green);
  opacity: 0;
  animation: experi-wa-pulse 2.2s ease-out infinite;
}

#experi-wa-fab.pulse::after {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 2px solid var(--wa-green);
  opacity: 0;
  animation: experi-wa-pulse 2.2s ease-out 0.5s infinite;
}

@keyframes experi-wa-pulse {
  0%   { transform: scale(0.85); opacity: 0.6; }
  70%  { transform: scale(1.3);  opacity: 0; }
  100% { transform: scale(1.3);  opacity: 0; }
}

/* ── Slide-in entrance ───────────────────────────────────── */
#experi-wa-root {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

#experi-wa-root.ready {
  opacity: 1;
  transform: translateY(0);
}

/* ── Mobile responsive ───────────────────────────────────── */
@media (max-width: 767px) {
  #experi-wa-root.pos-bottom-right,
  #experi-wa-root.pos-bottom-left {
    bottom: 20px;
    right:  16px;
    left:   auto;
  }

  #experi-wa-tooltip {
    width: calc(100vw - 32px);
    max-width: 300px;
  }

  #experi-wa-fab {
    width:  52px;
    height: 52px;
  }

  #experi-wa-fab svg {
    width:  28px;
    height: 28px;
  }
}

/* ── Visibility helpers ──────────────────────────────────── */
.experi-wa-desktop-only { display: none !important; }

@media (min-width: 768px) {
  .experi-wa-desktop-only { display: flex !important; }
}
