/* ===== animaciones.css - animar-interfaz ===== */
:root {
  --color-primario: #2661AD;
  --color-secundario: #E0B84C;
  --color-acento: #E07A8A;
  --color-fondo: #F8F8F8;
  --color-tarjeta: #0F1A29;
  --color-texto: #0F1A29;
}

/* --- Fade-in al hacer scroll --- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Hover en tarjetas --- */
.tarjeta {
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.tarjeta:hover {
  transform: translateY(-4px);
  border-color: var(--color-acento) !important;
  box-shadow: 0 12px 26px -10px rgba(38, 97, 173, .22);
}

/* --- Hover en botones --- */
.btn {
  transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
}
.btn:hover {
  transform: translateY(-2px);
}
.btn:active {
  transform: translateY(0);
}

/* --- Pulso del botón flotante de WhatsApp --- */
.whatsapp-flotante {
  position: fixed !important;
}
.whatsapp-flotante::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #25D366;
  opacity: .55;
  animation: pulso 2.4s ease-out infinite;
  z-index: -1;
  pointer-events: none;
}
@keyframes pulso {
  0% { transform: scale(1); opacity: .55; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* --- Acordeón de FAQs --- */
.faq-item {
  transition: border-color .25s ease, box-shadow .25s ease;
}
.faq-item.abierto {
  border-color: var(--color-acento);
}
.faq-pregunta {
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-pregunta .icono {
  transition: transform .25s ease;
  color: var(--color-acento);
}
.faq-item.abierto .icono {
  transform: rotate(180deg);
}
.faq-respuesta {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease, padding .35s ease, opacity .3s ease;
  opacity: 0;
}
.faq-item.abierto .faq-respuesta {
  max-height: 320px;
  opacity: 1;
}

/* --- Barra de progreso de fases --- */
.fases {
  position: relative;
  padding-left: 32px;
}
.fases .linea-base {
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: rgba(38, 97, 173, .15);
}
.fases .linea-progreso {
  position: absolute;
  left: 9px;
  top: 6px;
  width: 2px;
  height: 0%;
  background: var(--color-acento);
  transition: height .8s ease;
}
.fase {
  position: relative;
}
.fase::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-fondo);
  border: 2px solid rgba(38, 97, 173, .25);
  transition: border-color .4s ease, background .4s ease;
}
.fase.activa::before {
  border-color: var(--color-acento);
  background: var(--color-acento);
}

/* --- Subrayado animado en menú --- */
header nav > a,
header nav .group > a {
  position: relative;
}
header nav > a::after,
header nav .group > a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  height: 2px;
  width: 0;
  background: var(--color-acento);
  transition: width .25s ease;
}
header nav > a:hover::after,
header nav .group > a:hover::after {
  width: 100%;
}

/* --- Barra CTA fija al hacer scroll --- */
.barra-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(15, 26, 41, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(224, 122, 138, 0.4);
  transform: translateY(100%);
  transition: transform .3s ease;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}
.barra-cta.visible {
  transform: translateY(0);
}

/* --- Shimmer al cargar imágenes --- */
.img-wrap {
  position: relative;
  overflow: hidden;
}
.img-wrap.cargando::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(38, 97, 173,0.08) 25%, rgba(224, 122, 138,0.18) 50%, rgba(38, 97, 173,0.08) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  z-index: 2;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Confirmación animada de formulario --- */
.confirmacion-envio {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .4s ease, transform .4s ease;
}
.confirmacion-envio.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Latido infinito del botón interactivo del asistente virtual --- */
#openAssistantBtn {
  animation: latido-asistente 2.4s ease-in-out infinite;
  transform-origin: center center;
}
#openAssistantBtn:hover {
  animation: none;
  transform: scale(1.08);
  transition: transform .2s ease;
}
@keyframes latido-asistente {
  0% {
    transform: scale(1);
    box-shadow: 0 10px 25px -5px rgba(38, 97, 173, 0.4), 0 8px 10px -6px rgba(224, 122, 138, 0.3);
  }
  14% {
    transform: scale(1.12);
    box-shadow: 0 16px 32px -4px rgba(38, 97, 173, 0.55), 0 12px 16px -4px rgba(224, 122, 138, 0.45);
  }
  28% {
    transform: scale(1);
    box-shadow: 0 10px 25px -5px rgba(38, 97, 173, 0.4), 0 8px 10px -6px rgba(224, 122, 138, 0.3);
  }
  42% {
    transform: scale(1.1);
    box-shadow: 0 14px 28px -4px rgba(38, 97, 173, 0.5), 0 10px 14px -4px rgba(224, 122, 138, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 10px 25px -5px rgba(38, 97, 173, 0.4), 0 8px 10px -6px rgba(224, 122, 138, 0.3);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 10px 25px -5px rgba(38, 97, 173, 0.4), 0 8px 10px -6px rgba(224, 122, 138, 0.3);
  }
}

/* --- Accesibilidad: respeta "reducir movimiento" --- */
@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none; opacity: 1; transform: none; }
  .whatsapp-flotante::before { animation: none; display: none; }
  #openAssistantBtn { animation: none !important; }
  .tarjeta, .btn, .faq-respuesta, .faq-pregunta .icono,
  .fases .linea-progreso, .fase::before, header nav > a::after,
  .barra-cta, .img-wrap.cargando::before, .confirmacion-envio {
    transition: none !important;
    animation: none !important;
  }
}
