/* ═══════════════════════════════════════════════════════════
   EuroMóveis — Botão flutuante WhatsApp (Opção A)
   ═══════════════════════════════════════════════════════════ */

.em-wa-float {
  --emwa-color:    #25D366;
  --emwa-color-d:  #128C7E;
  --emwa-size:     58px;
  --emwa-offset:   22px;
  --emwa-z:        9998;

  position: fixed;
  bottom: var(--emwa-offset);
  z-index: var(--emwa-z);
  display: flex;
  align-items: center;
  /* Container é invisível clicável — só o botão (e o tooltip quando
     visível) devem capturar cliques. Evita bloquear cliques em elementos
     do wizard que ficam por baixo da zona do tooltip. */
  pointer-events: none;
}
/* Botão SEMPRE no canto do ecrã, tooltip expande para dentro */
.em-wa-float--right { right: var(--emwa-offset); flex-direction: row;         }
.em-wa-float--left  { left:  var(--emwa-offset); flex-direction: row-reverse; }

/* Botão principal */
.em-wa-float__btn {
  width: var(--emwa-size);
  height: var(--emwa-size);
  border-radius: 50%;
  background: var(--emwa-color);
  color: #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45), 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  cursor: pointer;
  /* Re-activa clicks — container tem pointer-events:none. */
  pointer-events: auto;
}
.em-wa-float__btn:hover,
.em-wa-float__btn:focus {
  transform: scale(1.1);
  box-shadow: 0 8px 22px rgba(37, 211, 102, 0.55), 0 4px 8px rgba(0, 0, 0, 0.2);
  background: var(--emwa-color);
  color: #fff !important;
  text-decoration: none !important;
}
.em-wa-float__btn svg {
  width: 58%;
  height: 58%;
  display: block;
}

/* Pulse animation */
.em-wa-float--pulse .em-wa-float__btn::before,
.em-wa-float--pulse .em-wa-float__btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--emwa-color);
  opacity: 0.5;
  z-index: -1;
  animation: emWaPulse 2.4s cubic-bezier(0.25, 0.25, 0.35, 1) infinite;
  pointer-events: none;
}
.em-wa-float--pulse .em-wa-float__btn::after {
  animation-delay: 1.2s;
}
@keyframes emWaPulse {
  0%   { transform: scale(1);    opacity: 0.55; }
  100% { transform: scale(1.85); opacity: 0; }
}
/* Reduced motion — respeita user preference */
@media (prefers-reduced-motion: reduce) {
  .em-wa-float--pulse .em-wa-float__btn::before,
  .em-wa-float--pulse .em-wa-float__btn::after {
    animation: none;
  }
}

/* Tooltip */
.em-wa-float__tip {
  background: #fff;
  color: #2a2622;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.16);
  position: relative;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 260px;
}
/* Posição RIGHT: tooltip à ESQUERDA do botão, seta aponta para a DIREITA */
.em-wa-float--right .em-wa-float__tip {
  margin-right: 12px;
  transform: translateX(8px);
}
.em-wa-float--right .em-wa-float__tip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  margin-top: -7px;
  border-left: 7px solid #fff;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}
/* Posição LEFT: tooltip à DIREITA do botão, seta aponta para a ESQUERDA */
.em-wa-float--left .em-wa-float__tip {
  margin-left: 12px;
  transform: translateX(-8px);
}
.em-wa-float--left .em-wa-float__tip::after {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  margin-top: -7px;
  border-right: 7px solid #fff;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

/* Mostrar tooltip: hover no botão (apenas dispositivos com rato), focus
   teclado, ou classe show-tip via JS. Em touch o :hover é "sticky" — evitamos.
   Usamos :has() no container porque este tem pointer-events:none. */
@media (hover: hover) {
  .em-wa-float:has(.em-wa-float__btn:hover) .em-wa-float__tip {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }
}
.em-wa-float--show-tip .em-wa-float__tip,
.em-wa-float:has(.em-wa-float__btn:focus-visible) .em-wa-float__tip {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .em-wa-float {
    --emwa-size: 54px;
    --emwa-offset: 16px;
  }
  .em-wa-float__tip {
    font-size: 12px;
    padding: 9px 13px;
    max-width: 190px;
  }
}

/* ── Print / no-print ── */
@media print {
  .em-wa-float { display: none !important; }
}
