/* ═══════════════════════════════════════════════════════════════
 * LAZY LOADING ANIMATIONS
 * ═══════════════════════════════════════════════════════════════ */

/* Sección lazy - estado inicial (oculta, abajo) */
.lazy-section {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  position: relative; /* Para que position:absolute de los wrappers funcione */
}

/* Estado cuando la sección es visible en viewport */
.lazy-section.section-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Estado cuando la sección sale del viewport */
.lazy-section.section-hidden {
  opacity: 0;
  transform: translateY(30px);
}

/* Estado cuando la sección se ha cargado */
.lazy-section.lazy-loaded {
  /* Mantener las transiciones */
}

/* ═══════════════════════════════════════════════════════════════
 * SCROLL ANIMATIONS (Para secciones SSR sin lazy loading)
 * ═══════════════════════════════════════════════════════════════ */

/* Sección animada - estado inicial (oculta, abajo) */
.animated-section {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  will-change: opacity, transform;
}

/* Estado cuando la sección es visible en viewport */
.animated-section.section-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Estado cuando la sección sale del viewport */
.animated-section.section-hidden {
  opacity: 0;
  transform: translateY(30px);
}

/* Reducir movimiento para usuarios con preferencia de accesibilidad */
@media (prefers-reduced-motion: reduce) {
  .animated-section {
    transition: opacity 0.3s ease-out;
    transform: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
 * SKELETON LOADER
 * ═══════════════════════════════════════════════════════════════ */

/* Animación shimmer ahora es global en style.css - usar clase .skeleton-shimmer */

/* Dark mode skeleton */
@media (prefers-color-scheme: dark) {
  .skeleton-card {
    background: #1a1a1a;
    border-color: #333;
  }

  .skeleton-image {
    background-color: #2a2a2a;
  }
}

/* Skeleton card structure */
.skeleton-card {
  /* Propiedades específicas del skeleton */
  pointer-events: none;
  user-select: none;
  /* Coincidir con el tamaño de las cards reales */
  width: 230px;
  min-width: 230px;
  max-width: 260px;
  height: 470px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  /* Las propiedades base (background, border, box-shadow, etc.) se heredan de .card-base */
}

.skeleton-card .card-link {
  cursor: default;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* .skeleton-card .card-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
} */

/* Skeleton image placeholder */
.skeleton-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.skeleton-image .skeleton-shimmer {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* Skeleton title */
/* .skeleton-title {
  height: 20px;
  width: 80%;
  border-radius: 4px;
  margin-bottom: 12px;
} */

/* Skeleton price container */
.skeleton-price {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.skeleton-price-current {
  height: 24px;
  width: 80px;
  border-radius: 4px;
}

.skeleton-price-old {
  height: 20px;
  width: 60px;
  border-radius: 4px;
}

/* Skeleton button */
.skeleton-button {
  height: 40px;
  width: 100%;
  border-radius: 6px;
}

/* ═══════════════════════════════════════════════════════════════
 * FADE-IN ANIMATION REUTILIZABLE
 * ═══════════════════════════════════════════════════════════════ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════════
 * ANIMACIÓN ESCALONADA REUTILIZABLE
 * Uso: Agrega clase "staggered-fade-in" a cada item que quieras animar
 * ═══════════════════════════════════════════════════════════════ */

.staggered-fade-in {
  animation: fadeInUp 0.4s ease-out forwards;
  opacity: 0;
  transform: translateY(30px); /* Estado inicial para la animación */
}

/* Delays escalonados - funcionan con cualquier elemento */
.staggered-fade-in:nth-child(1) { animation-delay: 0.05s; }
.staggered-fade-in:nth-child(2) { animation-delay: 0.1s; }
.staggered-fade-in:nth-child(3) { animation-delay: 0.15s; }
.staggered-fade-in:nth-child(4) { animation-delay: 0.2s; }
.staggered-fade-in:nth-child(5) { animation-delay: 0.25s; }
.staggered-fade-in:nth-child(6) { animation-delay: 0.3s; }
.staggered-fade-in:nth-child(7) { animation-delay: 0.35s; }
.staggered-fade-in:nth-child(8) { animation-delay: 0.4s; }
.staggered-fade-in:nth-child(n+9) { animation-delay: 0.45s; }

/* Compatibilidad con carousel (usa la clase genérica) */
.carousel-card.animated {
  animation: fadeInUp 0.4s ease-out forwards;
  opacity: 0;
  transform: translateY(30px);
}

.carousel-card.animated:nth-child(1) { animation-delay: 0.05s; }
.carousel-card.animated:nth-child(2) { animation-delay: 0.1s; }
.carousel-card.animated:nth-child(3) { animation-delay: 0.15s; }
.carousel-card.animated:nth-child(4) { animation-delay: 0.2s; }
.carousel-card.animated:nth-child(5) { animation-delay: 0.25s; }
.carousel-card.animated:nth-child(n+6) { animation-delay: 0.3s; }

/* ═══════════════════════════════════════════════════════════════
 * SKELETON TRACK (para mantener el diseño del carousel)
 * ═══════════════════════════════════════════════════════════════ */

.skeleton-track {
  display: flex;
  gap: 0.8rem;
  /* Coincidir con los estilos del carousel real */
  cursor: default;
  padding: 1rem 0;
}

/* ═══════════════════════════════════════════════════════════════
 * LOADING STATE
 * ═══════════════════════════════════════════════════════════════ */

.lazy-section.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════
 * RESPONSIVE
 * ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .lazy-section {
    transform: translateY(30px);
  }
}
