/* Progressive Loading Styles */

/* Skeleton Loading Animation */
@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

/* Image Loading States */
.image-container {
  position: relative;
  overflow: hidden;
  background-color: #f5f5f5;
}

.image-loading {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.image-loaded {
  opacity: 1;
}

.image-error {
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
}

/* Progressive Loading Skeleton for Images */
.image-skeleton {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #f3f4f6;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease-out;
}

.image-skeleton.hide {
  opacity: 0;
  pointer-events: none;
}

.image-skeleton-icon {
  color: #d1d5db;
  font-size: 2rem;
  opacity: 0.7;
}

/* Post Content Skeleton */
.post-skeleton {
  padding: 1.5rem;
  background: white;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.skeleton-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  margin-right: 0.75rem;
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-text.long {
  width: 100%;
}

/* Image Gallery Skeleton */
.image-gallery-skeleton {
  background-color: #f5f5f5;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.single-image-skeleton {
  width: 100%;
  height: 400px;
  max-height: 600px;
}

.multi-image-skeleton {
  height: 400px;
}

/* Fade transition for loaded images */
.progressive-image {
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
}

.progressive-image[data-state="loading"] {
  opacity: 0;
}

.progressive-image[data-state="loaded"] {
  opacity: 1;
}

.progressive-image[data-state="error"] {
  opacity: 1;
  background-color: #f8f9fa;
}

/* Blur-to-clear effect (optional enhancement) */
.progressive-blur {
  filter: blur(5px);
  transition: filter 0.3s ease-out;
}

.progressive-blur.loaded {
  filter: blur(0);
}

/* Loading state for different image layouts */
.layout-classic .image-skeleton {
  border-radius: 0.5rem;
}

.layout-banner .image-skeleton {
  border-radius: 0.5rem;
}

.layout-slider .image-skeleton {
  border-radius: 0;
}

/* Mobile optimizations */
@media (max-width: 640px) {
  .image-skeleton-icon {
    font-size: 1.25rem;
  }
  
  .single-image-skeleton {
    height: 300px;
  }
  
  .multi-image-skeleton {
    height: 300px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .skeleton {
    background: linear-gradient(90deg, #e0e0e0 25%, #d0d0d0 50%, #e0e0e0 75%);
  }
  
  .image-skeleton {
    background: linear-gradient(90deg, 
      rgba(224, 224, 224, 0.9) 25%, 
      rgba(208, 208, 208, 0.9) 50%, 
      rgba(224, 224, 224, 0.9) 75%
    );
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .image-skeleton {
    animation: none;
    background: #f0f0f0;
  }
  
  .progressive-image {
    transition: none;
  }
  
  .progressive-blur {
    transition: none;
  }
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
  .skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
  }
  
  .image-skeleton {
    background: #374151;
  }
  
  .image-skeleton-icon {
    color: #6b7280;
  }
  
  .image-container {
    background-color: #2a2a2a;
  }
  
  .image-error {
    background-color: #2a2a2a;
    color: #9ca3af;
  }
} 
