/* Skeleton Loading Styles - Modern Shimmer Effect */

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

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #1a1a1a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
  }
}

/* Product Card Skeleton */
.product-card-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.product-card-skeleton .skeleton-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
}

.product-card-skeleton .skeleton-title {
  height: 20px;
  width: 80%;
}

.product-card-skeleton .skeleton-price {
  height: 24px;
  width: 40%;
}

.product-card-skeleton .skeleton-button {
  height: 40px;
  width: 100%;
  margin-top: 8px;
}

/* Slider Skeleton */
.slider-skeleton {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(90deg, #e0e0e0 25%, #d0d0d0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 12px;
}

@media (max-width: 768px) {
  .slider-skeleton {
    aspect-ratio: 4 / 3;
  }
}

/* Progressive Image Loading */
.progressive-image-wrapper {
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
}

/* Aspect ratio boxes - prevent CLS */
.aspect-ratio-box {
  position: relative;
  width: 100%;
  height: 0;
}

.aspect-ratio-box.ratio-1-1 { padding-bottom: 100%; }
.aspect-ratio-box.ratio-16-9 { padding-bottom: 56.25%; }
.aspect-ratio-box.ratio-4-3 { padding-bottom: 75%; }
.aspect-ratio-box.ratio-3-2 { padding-bottom: 66.67%; }

.aspect-ratio-box > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Blur-up effect */
.img-blur-up {
  filter: blur(20px);
  transform: scale(1.1);
  transition: filter 0.4s ease-out, transform 0.4s ease-out;
}

.img-blur-up.loaded {
  filter: blur(0);
  transform: scale(1);
}

/* Fade-in effect */
.img-fade-in {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.img-fade-in.loaded {
  opacity: 1;
}

/* Loading spinner overlay */
.image-loading-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s;
}

.image-loading-overlay.hidden {
  opacity: 0;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Lazy load placeholder */
.lazy-placeholder {
  background: linear-gradient(135deg, #f5f5f5 0%, #ececec 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
}

/* Hide real content while skeleton shows */
.skeleton-container.loading .real-content {
  display: none;
}

.skeleton-container.loaded .skeleton {
  display: none;
}

/* Smooth transition when skeleton disappears */
.skeleton-container {
  transition: opacity 0.3s ease-in;
}
