/* ════════════════════════════════════════════════════════════════
   LANZAROTE VAPEO SEGURO — animations.css
   Animaciones modernas y microinteracciones profesionales
   IntersectionObserver reveal + CSS keyframes
   ════════════════════════════════════════════════════════════════ */

/* ── ANIMACIONES BASE ─────────────────────────────────────────── */

/* Fade Up (elemento base para reveal con IntersectionObserver) */
.anim-fade-up {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.anim-fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Fade In */
.anim-fade-in {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.anim-fade-in.visible {
  opacity: 1;
}

/* Slide In (from left) */
.anim-slide-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.anim-slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Slide In (from right) */
.anim-slide-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.anim-slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Reveal scale */
.anim-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.anim-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* ── DELAYS ───────────────────────────────────────────────────── */
.delay-1 { transition-delay: 0.1s !important; }
.delay-2 { transition-delay: 0.2s !important; }
.delay-3 { transition-delay: 0.3s !important; }
.delay-4 { transition-delay: 0.4s !important; }
.delay-5 { transition-delay: 0.5s !important; }
.delay-6 { transition-delay: 0.6s !important; }
.delay-7 { transition-delay: 0.7s !important; }
.delay-8 { transition-delay: 0.8s !important; }

/* ── HERO ANIMACIONES ─────────────────────────────────────────── */

/* Gradiente animado del hero */
@keyframes hero-gradient-shift {
  0%   { opacity: 0.6; transform: scale(1) rotate(0deg); }
  33%  { opacity: 0.8; transform: scale(1.05) rotate(1deg); }
  66%  { opacity: 0.5; transform: scale(0.98) rotate(-1deg); }
  100% { opacity: 0.6; transform: scale(1) rotate(0deg); }
}

.hero-bg-anim {
  animation: hero-gradient-shift 12s ease-in-out infinite;
}

/* Partículas flotantes */
@keyframes float-particle {
  0%   { transform: translateY(0) translateX(0) scale(1); opacity: 0.3; }
  25%  { transform: translateY(-20px) translateX(10px) scale(1.1); opacity: 0.6; }
  50%  { transform: translateY(-10px) translateX(-10px) scale(0.9); opacity: 0.4; }
  75%  { transform: translateY(-30px) translateX(5px) scale(1.05); opacity: 0.5; }
  100% { transform: translateY(0) translateX(0) scale(1); opacity: 0.3; }
}

.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: float-particle var(--duration, 6s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

/* Línea luminosa horizontal */
@keyframes scan-line {
  0%   { top: -2px; opacity: 0; }
  5%   { opacity: 0.5; }
  95%  { opacity: 0.5; }
  100% { top: 100%; opacity: 0; }
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(239,68,68,0.4), rgba(56,189,248,0.4), transparent);
  animation: scan-line 8s linear infinite;
}

/* Entrada del hero */
@keyframes hero-enter {
  0%   { opacity: 0; transform: translateY(24px); }
  100% { opacity: 1; transform: translateY(0); }
}

.hero-title {
  animation: hero-enter 0.8s ease forwards;
}

.hero-subtitle {
  animation: hero-enter 0.8s ease 0.15s forwards;
  opacity: 0;
}

.hero-actions {
  animation: hero-enter 0.8s ease 0.3s forwards;
  opacity: 0;
}

.hero-badges {
  animation: hero-enter 0.8s ease 0.45s forwards;
  opacity: 0;
}

.hero-stats {
  animation: hero-enter 0.8s ease 0.55s forwards;
  opacity: 0;
}

/* ── EFECTO GLOW ──────────────────────────────────────────────── */
@keyframes glow-pulse-red {
  0%, 100% { box-shadow: 0 0 12px rgba(239,68,68,0.3), 0 0 24px rgba(239,68,68,0.1); }
  50%       { box-shadow: 0 0 24px rgba(239,68,68,0.6), 0 0 48px rgba(239,68,68,0.2); }
}

@keyframes glow-pulse-blue {
  0%, 100% { box-shadow: 0 0 12px rgba(56,189,248,0.3), 0 0 24px rgba(56,189,248,0.1); }
  50%       { box-shadow: 0 0 24px rgba(56,189,248,0.6), 0 0 48px rgba(56,189,248,0.2); }
}

@keyframes glow-pulse-green {
  0%, 100% { box-shadow: 0 0 12px rgba(34,197,94,0.3); }
  50%       { box-shadow: 0 0 24px rgba(34,197,94,0.6); }
}

.btn-glow { animation: glow-pulse-red 3s ease-in-out infinite; }
.btn-blue { animation: glow-pulse-blue 3s ease-in-out infinite; }

/* ── SHINE EFFECT en botones ──────────────────────────────────── */
@keyframes shine {
  0%   { left: -100%; opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { left: 200%; opacity: 0; }
}

.btn:hover::before {
  animation: shine 0.7s ease;
}

/* ── PULSE / ALERTA ───────────────────────────────────────────── */
@keyframes alert-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.85; transform: scale(1.01); }
}

.alert-pulse {
  animation: alert-pulse 2.5s ease-in-out infinite;
}

/* Badge animado */
@keyframes badge-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

.badge-animated {
  animation: badge-blink 2s ease-in-out infinite;
}

/* ── COUNTER ANIMATION ────────────────────────────────────────── */
.counter-value {
  display: inline-block;
  transition: transform 0.3s ease;
}

/* ── TOAST NOTIFICATIONS ──────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 90px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--color-card-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transform: translateX(400px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.hide {
  transform: translateX(400px);
  opacity: 0;
}

.toast-success { border-left: 3px solid var(--color-green); }
.toast-error   { border-left: 3px solid var(--color-red); }
.toast-info    { border-left: 3px solid var(--color-blue); }
.toast-warning { border-left: 3px solid var(--color-yellow); }

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-text { font-size: 14px; color: var(--color-text); line-height: 1.4; }

/* ── SKELETON LOADERS ─────────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 100%
  );
  background-size: 400px 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 12px;
}

.skeleton-card {
  height: 180px;
}

/* ── MODAL ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--color-card-2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 25px 60px rgba(0,0,0,0.8);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-white);
}

.modal-close {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 50%;
  color: var(--color-text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover { background: rgba(239,68,68,0.2); color: var(--color-red); }

/* ── STEP FORM TRANSITIONS ────────────────────────────────────── */
.form-step {
  display: none;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.form-step.active {
  display: block;
  opacity: 1;
  transform: translateX(0);
}

/* ── TEST INTERACTIVO ─────────────────────────────────────────── */
.test-question {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-3);
  transition: all var(--transition);
}

.test-question:hover { border-color: rgba(255,255,255,0.12); }
.test-question.answered-yes { border-color: var(--color-red); background: rgba(239,68,68,0.05); }
.test-question.answered-no  { border-color: rgba(34,197,94,0.3); }

.test-result {
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  text-align: center;
  margin-top: var(--space-6);
  animation: hero-enter 0.5s ease;
}

.test-result.low-risk       { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); }
.test-result.medium-risk    { background: rgba(250,204,21,0.1); border: 1px solid rgba(250,204,21,0.3); }
.test-result.high-risk      { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); }
.test-result.very-high-risk { background: rgba(239,68,68,0.15); border: 2px solid var(--color-red); animation: alert-pulse 2s ease-in-out infinite; }

/* ── PARTICLES BACKGROUND ─────────────────────────────────────── */
.particles-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle-dot {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239,68,68,0.4), transparent);
}

/* ── MICRO-INTERACCIONES ──────────────────────────────────────── */

/* Hover ripple effect */
@keyframes ripple {
  0%   { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0; }
}

/* Number count up */
@keyframes count-up {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Entrada página */
.page-enter {
  animation: hero-enter 0.5s ease forwards;
}

/* ── RESPONSIVE ANIMATIONS ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-title, .hero-subtitle, .hero-actions, .hero-badges, .hero-stats {
    opacity: 1;
    animation: none;
  }
  
  .anim-fade-up, .anim-fade-in, .anim-slide-left, .anim-slide-right, .anim-scale {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
