/* ============================================
   BOTÓN FLOTANTE DE WHATSAPP — KS AGENCY
   Versión corregida: posición + responsive
   ============================================ */

.ks-wa-float {
  position: fixed;
  right: 24px;
  bottom: 100px;          /* ← Subido para no tapar barras fijas inferiores */
  z-index: 10001;        /* ← Por encima de modales, overlays y el stats-bar */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: inherit;
}

/* Alternativa: botón a la izquierda (añade class="ks-wa-float ks-wa-float--left") */
.ks-wa-float.ks-wa-float--left {
  right: auto;
  left: 24px;
  align-items: flex-start;
}

/* ---------- Burbuja ---------- */
.ks-wa-float-btn {
  position: relative;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4), 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.ks-wa-float-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 30px rgba(37, 211, 102, 0.5), 0 4px 10px rgba(0, 0, 0, 0.3);
}

.ks-wa-float-btn:focus-visible {
  outline: 3px solid #ec4899;
  outline-offset: 3px;
}

.ks-wa-float-icon-open,
.ks-wa-float-icon-close {
  font-size: 28px;
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ks-wa-float-icon-close {
  opacity: 0;
  transform: scale(0.5) rotate(-45deg);
}

.ks-wa-float-icon-open {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.ks-wa-float.is-open .ks-wa-float-icon-open {
  opacity: 0;
  transform: scale(0.5) rotate(45deg);
}

.ks-wa-float.is-open .ks-wa-float-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Pulso de aviso */
.ks-wa-float-ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #25D366;
  opacity: 0.55;
  animation: ks-wa-ping 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}

.ks-wa-float.is-open .ks-wa-float-ping {
  animation: none;
  opacity: 0;
}

@keyframes ks-wa-ping {
  0% { transform: scale(1); opacity: 0.55; }
  75%, 100% { transform: scale(1.9); opacity: 0; }
}

/* ---------- Popup ---------- */
.ks-wa-float-popup {
  width: min(320px, 82vw);
  margin-bottom: 14px;
  border-radius: 18px;
  background: #14151a;
  color: #fff;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transform-origin: bottom right;
  transform: translateY(12px) scale(0.94);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
}

.ks-wa-float.ks-wa-float--left .ks-wa-float-popup {
  transform-origin: bottom left;
}

.ks-wa-float.is-open .ks-wa-float-popup {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Fix: [hidden] debe ocultar completamente el popup */
.ks-wa-float-popup[hidden] {
  display: none !important;
}

.ks-wa-float-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s ease;
}

.ks-wa-float-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.ks-wa-float-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 14px;
  background: linear-gradient(135deg, #1c1e26, #14151a);
}

.ks-wa-float-avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #25D366;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}

.ks-wa-float-header-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ks-wa-float-header-text strong {
  font-size: 14.5px;
  letter-spacing: 0.2px;
}

.ks-wa-float-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.55);
}

.ks-wa-float-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25D366;
  display: inline-block;
}

.ks-wa-float-body {
  padding: 4px 18px 16px;
}

.ks-wa-float-body p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
}

.ks-wa-float-body p:last-child {
  margin-bottom: 0;
}

.ks-wa-float-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 6px 14px 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #25D366;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.ks-wa-float-cta:hover {
  background: #1fb959;
  transform: translateY(-1px);
}

.ks-wa-float-cta i {
  font-size: 17px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .ks-wa-float {
    right: 16px;
    bottom: 16px;        /* ← En móvil vuelve abajo, pantalla más chica */
  }

  .ks-wa-float.ks-wa-float--left {
    left: 16px;
    right: auto;
  }

  .ks-wa-float-btn {
    width: 54px;
    height: 54px;
  }

  .ks-wa-float-icon-open,
  .ks-wa-float-icon-close {
    font-size: 24px;
  }

  .ks-wa-float-popup {
    width: min(300px, 78vw);
    margin-bottom: 12px;
  }
}

/* Si hay bottom-bar o navegación fija en móvil (ej: 60px de alto) */
@media (max-width: 768px) and (display-mode: standalone), (max-width: 768px) {
  .ks-wa-float.has-bottom-bar {
    bottom: 76px;  /* Ajusta según la altura de tu bottom bar */
  }
}

/* ---------- Accesibilidad: reduce motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .ks-wa-float-btn,
  .ks-wa-float-popup,
  .ks-wa-float-icon-open,
  .ks-wa-float-icon-close {
    transition: none;
  }

  .ks-wa-float-ping {
    animation: none;
    display: none;
  }
}