/* ===========================================================
   Botón flotante de WhatsApp (multi-número, estilo chat) + pulso
   Se coloca por encima del botón "volver arriba" mediante
   la variable --wa-bottom (ver whatsapp-float.js -> CONFIG.bottomOffset)
   =========================================================== */

:root {
  --wa-color: #25D366;
  --wa-color-dark: #1ebe57;
  --wa-header-color: #075E54;
  --wa-bubble-bg: #f0f2f5;
  --wa-size: 60px;
  --wa-bottom: 90px;   /* distancia desde abajo: dejar hueco para el botón scroll-to-top */
  --wa-side: 20px;
}

.wa-float-container {
  position: fixed;
  bottom: var(--wa-bottom);
  z-index: 9998; /* por debajo de modales, por encima del scroll-to-top */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.wa-float-container.wa-pos-right { right: var(--wa-side); align-items: flex-end; }
.wa-float-container.wa-pos-left  { left: var(--wa-side); align-items: flex-start; }

/* ---------- Botón principal ---------- */
.wa-float-btn {
  position: relative;
  width: var(--wa-size);
  height: var(--wa-size);
  border-radius: 50%;
  background: var(--wa-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  border: none;
  outline: none;
  transition: transform 0.2s ease, background 0.2s ease;
  z-index: 2;
}

.wa-float-btn:hover {
  background: var(--wa-color-dark);
  transform: scale(1.06);
}

.wa-float-btn svg {
  width: 32px;
  height: 32px;
  fill: #fff;
  position: relative;
  z-index: 2;
}

/* Anillo de pulso */
.wa-float-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--wa-color);
  opacity: 0.6;
  z-index: 1;
  animation: wa-pulse 2.2s ease-out infinite;
}

.wa-float-container.wa-no-pulse .wa-float-btn::before {
  animation: none;
  display: none;
}

@keyframes wa-pulse {
  0%   { transform: scale(1);   opacity: 0.55; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* Contador / badge opcional */
.wa-float-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  z-index: 3;
  box-shadow: 0 0 0 2px #fff;
}

/* ---------- Tooltip ---------- */
.wa-float-tooltip {
  position: absolute;
  bottom: 8px;
  right: calc(100% + 12px);
  background: #fff;
  color: #333;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateX(6px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.wa-pos-left .wa-float-tooltip {
  right: auto;
  left: calc(100% + 12px);
  transform: translateX(-6px);
}

.wa-float-tooltip.wa-show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.wa-float-tooltip::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  border-width: 6px 0 6px 6px;
  border-style: solid;
  border-color: transparent transparent transparent #fff;
}

.wa-pos-left .wa-float-tooltip::after {
  right: auto;
  left: -6px;
  border-width: 6px 6px 6px 0;
  border-color: transparent #fff transparent transparent;
}

/* ---------- Panel estilo chat (multi-número) ---------- */
.wa-chat-panel {
  margin-bottom: 14px;
  width: 320px;
  max-width: 86vw;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: max-height 0.3s ease, opacity 0.25s ease, transform 0.25s ease;
}

.wa-chat-panel.wa-open {
  max-height: 600px;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header tipo cabecera de chat de WhatsApp */
.wa-chat-header {
  background: var(--wa-header-color);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  position: relative;
}

.wa-chat-header-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-chat-header-icon svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.wa-chat-header-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  overflow: hidden;
}

.wa-chat-header-title {
  font-weight: 700;
  font-size: 15px;
}

.wa-chat-header-sub {
  font-size: 12px;
  opacity: 0.85;
}

.wa-chat-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.wa-chat-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Cuerpo: fondo tipo "papel tapiz" del chat + lista de contactos */
.wa-chat-body {
  background: #e5ddd5;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
}

.wa-chat-contact {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wa-chat-contact:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.wa-chat-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: var(--wa-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
}

.wa-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-chat-contact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wa-chat-contact-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #111;
}

.wa-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wa-color);
  display: inline-block;
}

.wa-chat-contact-role {
  display: block;
  font-size: 12px;
  color: #777;
}

.wa-chat-bubble {
  display: block;
  position: relative;
  background: var(--wa-bubble-bg);
  border-radius: 0 8px 8px 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: #333;
  line-height: 1.35;
}

.wa-chat-send {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  background: var(--wa-color);
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.wa-chat-send svg {
  width: 13px;
  height: 13px;
  fill: #fff;
  margin-left: 1px;
}

.wa-chat-footer {
  background: #fff;
  padding: 8px 14px;
  font-size: 11px;
  color: #999;
  text-align: center;
  border-top: 1px solid #eee;
}

/* Icono del botón principal cambia a "cerrar" cuando el panel está abierto */
.wa-float-btn .wa-icon-close {
  display: none;
}
.wa-float-container.wa-menu-open .wa-float-btn .wa-icon-whatsapp { display: none; }
.wa-float-container.wa-menu-open .wa-float-btn .wa-icon-close { display: block; }
.wa-float-container.wa-menu-open .wa-float-btn::before { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  :root {
    --wa-size: 54px;
    --wa-bottom: 80px;
    --wa-side: 14px;
  }
  .wa-chat-panel { width: 90vw; }
  .wa-chat-contact-role { display: none; }
}
