/* Lazy Loading Background Images Styles */

/* Loading state for background images */
[data-lazy-bg] {
  background-color: #f5f5f5; /* Placeholder color */
  transition: background-image 0.3s ease-in-out;
  position: relative;
}

/* Loaded state */
[data-lazy-bg].bg-loaded {
  background-color: transparent;
}

/* Error state */
[data-lazy-bg].bg-error {
  background-color: #e0e0e0;
}

/* Loading animation skeleton */
[data-lazy-bg]:not(.bg-loaded):not(.bg-error)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, #f5f5f5 25%, #e8e8e8 50%, #f5f5f5 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
  z-index: -1;
}

/* Shimmer animation */
@keyframes loading-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Smooth transition when image loads */
[data-lazy-bg] {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Ensure content is visible during loading */
[data-lazy-bg] > * {
  position: relative;
  z-index: 1;
}

/* Responsive image handling */
@media (max-width: 767px) {
  [data-lazy-bg] {
    background-size: cover;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  [data-lazy-bg] {
    background-size: cover;
  }
}

@media (min-width: 1024px) {
  [data-lazy-bg] {
    background-size: cover;
  }
}

/* Performance optimization */
[data-lazy-bg] {
  will-change: background-image;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  [data-lazy-bg] {
    transition: none;
  }
  
  [data-lazy-bg]:not(.bg-loaded):not(.bg-error)::before {
    animation: none;
  }
}
