/* Botón flotante de WhatsApp con globito «Contáctame».
   Ver templates/partials/whatsapp_float.html. */

.ac-wa {
  position: fixed;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: bottom 0.25s ease;
}

.ac-wa__btn {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  box-shadow: 0 10px 24px -8px rgba(18, 140, 126, 0.65), 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Globito de conversación con su piquito apuntando al botón. */
.ac-wa__bubble {
  position: relative;
  padding: 9px 14px;
  border: 1px solid rgba(37, 211, 102, 0.55);
  border-radius: 14px;
  background: #fff;
  color: #075e54;
  font: 700 0.86rem/1.1 var(--ac-sans, sans-serif);
  white-space: nowrap;
  box-shadow: 0 8px 22px -10px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.12);
  animation: ac-wa-pop 0.5s 1.2s both cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.ac-wa__bubble {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.15;
}

.ac-wa__title {
  font-weight: 800;
  color: #075e54;
}

.ac-wa__sub {
  font-weight: 700;
  color: #128c7e;
  font-size: 0.92em;
}

.ac-wa__bubble::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  width: 12px;
  height: 12px;
  border-top: 1px solid rgba(37, 211, 102, 0.55);
  border-right: 1px solid rgba(37, 211, 102, 0.55);
  background: #fff;
  border-radius: 2px;
  transform: translateY(-50%) rotate(45deg);
}

.ac-wa:hover .ac-wa__btn,
.ac-wa:focus-visible .ac-wa__btn {
  transform: scale(1.07);
  box-shadow: 0 14px 30px -8px rgba(18, 140, 126, 0.75), 0 2px 6px rgba(0, 0, 0, 0.2);
}

.ac-wa:focus-visible {
  outline: none;
}

.ac-wa:focus-visible .ac-wa__btn {
  outline: 3px solid #075e54;
  outline-offset: 3px;
}

@keyframes ac-wa-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes ac-wa-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(37, 211, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

@keyframes ac-wa-pop {
  from {
    opacity: 0;
    transform: translateX(8px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Móvil: barra fija abajo con el formato de la marca (berenjena con filete
   dorado), el mensaje de asesoría a la izquierda y el botón verde a la derecha. */
@media (max-width: 980px) {
  .ac-wa {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 8px 8px 16px;
    overflow: hidden;
    border: 1px solid rgba(217, 178, 106, 0.32);
    border-left: 3px solid #d9b26a;
    border-radius: 16px;
    background:
      radial-gradient(120% 140% at 0% 0%, rgba(154, 47, 99, 0.55) 0%, rgba(42, 15, 30, 0) 55%),
      linear-gradient(100deg, rgba(42, 15, 30, 0.97) 0%, rgba(58, 18, 40, 0.97) 100%);
    box-shadow:
      0 16px 34px -14px rgba(20, 6, 14, 0.75),
      inset 0 1px 0 rgba(247, 242, 232, 0.08);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    animation: ac-wa-rise 0.45s 0.6s both cubic-bezier(0.2, 0.9, 0.3, 1.2);
  }

  .ac-wa__bubble {
    min-width: 0;
    gap: 3px;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    animation: none;
  }

  .ac-wa__bubble::after {
    display: none;
  }

  .ac-wa__title {
    overflow: hidden;
    color: var(--ac-paper, #f7f2e8);
    font: 600 1.06rem/1.1 var(--ac-serif, Georgia, serif);
    letter-spacing: 0.005em;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .ac-wa__sub {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #d9b26a;
    font: 700 0.66rem/1 var(--ac-sans, sans-serif);
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }

  /* Punto verde, como el «en línea» de WhatsApp (decorativo). */
  .ac-wa__sub::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
  }

  .ac-wa__btn {
    position: relative;
    flex: none;
    width: 46px;
    height: 46px;
    box-shadow: 0 8px 18px -6px rgba(37, 211, 102, 0.75);
  }

  /* Halo suave que late en el botón verde. */
  .ac-wa__btn::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55);
    animation: ac-wa-pulse 2.4s 1.4s infinite;
  }

  .ac-wa__btn svg {
    width: 26px;
    height: 26px;
  }

  .ac-wa:active {
    transform: scale(0.99);
  }

  /* Que la barra no tape el final de la página. */
  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ac-wa,
  .ac-wa__btn {
    transition: none;
  }

  .ac-wa,
  .ac-wa__bubble,
  .ac-wa__btn::before {
    animation: none;
  }
}

@media print {
  .ac-wa {
    display: none !important;
  }
}
