/* Globo inteligente de WhatsApp (13.11.2026).

   NO crea un botón flotante nuevo: el sitio ya tiene .wa-float (56px, verde,
   abajo a la derecha) desde hace tiempo, y sus reglas viven dentro del
   <style data-noa-critical-inline>, que está fijado por hash en la CSP y no
   se puede tocar sin recalcular .htaccess. Así que este fichero sólo añade
   el globo, y el script lo cuelga justo encima de ese botón.

   Todo va en un fichero externo (nada inline) para no mover los 47 hashes.

   Posición: los valores de aquí son sólo el punto de partida. El script
   mide el rectángulo real del botón al abrir el globo y escribe right,
   bottom y --wa-tail en el style del elemento. Hace falta porque .wa-float
   lleva además la clase .reveal, que le aplica un translateY(-22px) que
   sólo se anula por encima de 901px: calculado "a mano" el globo se le
   montaba encima entre 6 y 10px en tablet y móvil.

   El sitio NO tiene barra inferior fija en móvil, así que no hace falta el
   bottom:84px del encargo: los números salen de la geometría real del
   botón. Si algún día se añade una barra, el globo la esquiva solo, porque
   el botón ya tendría que esquivarla. */

.wa-bubble {
  position: fixed;
  right: 40px;
  bottom: 112px;
  /* Justo por debajo de .wa-float (1300) y muy por debajo de los modales
     (10050+) y del aviso de cookies (10050). */
  z-index: 1299;
  width: 290px;
  max-width: calc(100vw - 32px);
  padding: 16px 16px 14px;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(11, 31, 53, .16);
  color: #0b1f35;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif);
  text-align: left;
  opacity: 0;
  transform: translateY(14px) scale(.94);
  transform-origin: right bottom;
  transition:
    opacity .42s cubic-bezier(.16, 1, .3, 1),
    transform .42s cubic-bezier(.16, 1, .3, 1),
    visibility 0s linear .42s;
  visibility: hidden;
  pointer-events: none;
}

.wa-bubble.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity .42s cubic-bezier(.16, 1, .3, 1),
    transform .42s cubic-bezier(.16, 1, .3, 1),
    visibility 0s;
}

/* Pico que apunta al botón redondo. Dos capas: la de abajo hace de borde. */
/* El pico se centra bajo el botón. El script pone --wa-tail a
   (ancho del botón / 2 - 9); 19 es el valor para los 56px de escritorio y
   sirve de reserva si el script no llega a medir. */
.wa-bubble::before,
.wa-bubble::after {
  content: "";
  position: absolute;
  right: var(--wa-tail, 19px);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
}

.wa-bubble::before {
  bottom: -9px;
  border-top: 9px solid #e8eaed;
}

.wa-bubble::after {
  bottom: -8px;
  border-top: 9px solid #fff;
}

/* ---------- cabecera ---------- */

.wa-bubble__head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-right: 22px; /* hueco para la aspa */
}

.wa-bubble__avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
}

/* El avatar es el logotipo sobre fondo blanco, dentro de un globo también
   blanco: sin un aro no se vería el círculo, de ahí el borde gris fino en
   lugar del aro blanco de 2px que lleva una foto.

   Sin padding y con `cover`: apple-touch-icon.png ya trae sus propios
   márgenes (la tinta ocupa 132 de 180 px y cabe entera en el círculo
   inscrito, que necesita 159), así que recortarlo más no daría ni un 8% de
   tamaño y sí un fichero nuevo. Con una foto de persona esta regla vale
   igual; sólo conviene subir el borde a `2px solid #fff`. */
.wa-bubble__avatar {
  display: block;
  width: 38px;
  height: 38px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1px solid #dfe4e9;
  box-shadow: 0 2px 8px rgba(11, 31, 53, .12);
  object-fit: cover;
  background: #fff;
}

/* Punto verde de "en línea" con onda. */
.wa-bubble__badge {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #25d366;
  border: 2px solid #fff;
  box-sizing: border-box;
}

.wa-bubble__badge::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid #25d366;
  animation: waBubblePulse 2.1s ease-out infinite;
}

@keyframes waBubblePulse {
  0% { transform: scale(.75); opacity: .85; }
  70% { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}

.wa-bubble__who {
  min-width: 0;
}

/* Son <span>, así que sin esto el nombre y el estado salen en la misma
   línea pegados ("Noa GardenEn línea · Asesor"). */
.wa-bubble__name,
.wa-bubble__status {
  display: block;
}

.wa-bubble__name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  color: #0b1f35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-bubble__status {
  margin: 1px 0 0;
  font-size: 11.5px;
  line-height: 1.3;
  color: #6b7a8c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-bubble__status b {
  font-weight: 500;
  color: #1da851;
}

/* ---------- aspa ---------- */

.wa-bubble__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9aa7b4;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.wa-bubble__close:hover,
.wa-bubble__close:focus-visible {
  background: #f1f3f5;
  color: #44535f;
}

.wa-bubble__close svg {
  display: block;
  width: 13px;
  height: 13px;
}

/* ---------- texto ---------- */

.wa-bubble__text {
  margin: 12px 0 13px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #44535f;
}

/* ---------- botón ---------- */

.wa-bubble__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 11px 14px;
  box-sizing: border-box;
  background: #25d366;
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background .22s ease, transform .22s ease, box-shadow .22s ease;
}

.wa-bubble__cta:hover,
.wa-bubble__cta:focus-visible {
  background: #1da851;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(37, 211, 102, .32);
}

.wa-bubble__cta svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---------- entrada en cascada ---------- */

.wa-bubble__head,
.wa-bubble__text,
.wa-bubble__cta {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity .4s cubic-bezier(.16, 1, .3, 1),
    transform .4s cubic-bezier(.16, 1, .3, 1);
}

.wa-bubble__cta {
  transition:
    opacity .4s cubic-bezier(.16, 1, .3, 1),
    transform .4s cubic-bezier(.16, 1, .3, 1),
    background .22s ease,
    box-shadow .22s ease;
}

.wa-bubble.is-open .wa-bubble__head,
.wa-bubble.is-open .wa-bubble__text,
.wa-bubble.is-open .wa-bubble__cta {
  opacity: 1;
  transform: translateY(0);
}

.wa-bubble.is-open .wa-bubble__head { transition-delay: .1s; }
.wa-bubble.is-open .wa-bubble__text { transition-delay: .16s; }
.wa-bubble.is-open .wa-bubble__cta { transition-delay: .22s; }

/* ---------- se esconde donde se esconde el botón ---------- */

/* Mismas condiciones que ya tiene .wa-float en el CSS crítico: modales
   abiertos y panel de compartir. El script inserta el globo justo detrás
   del botón, así que el combinador ~ funciona igual. */
.contact-modal.is-open ~ .wa-bubble,
.kuula-modal.is-open ~ .wa-bubble,
.legal-modal.is-open ~ .wa-bubble,
.prices-modal.is-open ~ .wa-bubble,
body.noa-share-open .wa-bubble,
.wa-bubble.is-context-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(12px) scale(.96) !important;
}

/* Con el menú abierto el botón se va arriba del todo; el globo no le sigue,
   simplemente desaparece. */
@media (max-width: 900px) {
  body.nav-menu-open .wa-bubble {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* ---------- móvil ---------- */

@media (max-width: 600px) {
  .wa-bubble {
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 60px);
    padding: 14px 14px 13px;
    border-radius: 16px;
  }

  .wa-bubble__text { font-size: 13px; }
}

/* Pantallas muy bajas: no hay sitio para el globo sin tapar el contenido. */
@media (max-height: 460px) {
  .wa-bubble { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wa-bubble,
  .wa-bubble__head,
  .wa-bubble__text,
  .wa-bubble__cta {
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    transform: none !important;
  }

  .wa-bubble__badge::after { animation: none; }
}
