/* Skeleton loading styles */
.skeleton-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #e2e2e2;
  z-index: 1;
  overflow: hidden;
}

.skeleton-loader::after {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0) 0%, 
    rgba(255, 255, 255, 0.2) 50%, 
    rgba(255, 255, 255, 0) 100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* Progressive image container */
.progressive-image-container {
  position: relative;
  display: block;
  overflow: hidden;
  background-color: #f0f0f0;
  width: 100%;
  height: 0;
  /* padding-bottom is set dynamically via ng-style */
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.progressive-image-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Aspect ratio classes */
.progressive-image-container.ratio-1x1 {
  padding-bottom: 100%; /* 1:1 square */
}

.progressive-image-container.ratio-4x3 {
  padding-bottom: 75%; /* 4:3 */
}

.progressive-image-container.ratio-16x9 {
  padding-bottom: 56.25%; /* 16:9 */
}

.progressive-image-container.ratio-3x2 {
  padding-bottom: 66.67%; /* 3:2 */
}

.progressive-image-container.ratio-2x1 {
  padding-bottom: 50%; /* 2:1 */
}

/* Support for custom ratio with inline style */
.progressive-image-container.ratio-custom {
  /* Will use inline style for padding-bottom */
}

/* Progressive image */
.progressive-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  transition: opacity 0.3s ease-in-out, filter 0.3s ease-in-out;
}

/* Estilos específicos para las imágenes progresivas */
.progressive-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease-in-out;
  display: block; /* Asegurar que las imágenes sean visibles */
}

.progressive-image.thumb {
  z-index: 1;
  filter: blur(10px);
  opacity: 0.8;
}

.progressive-image.small {
  z-index: 2;
  opacity: 0;
}

.progressive-image.small.loaded {
  opacity: 1;
}

.progressive-image.full {
  z-index: 3;
  opacity: 0;
}

.progressive-image.full.loaded {
  opacity: 1;
}

.progressive-image-container.thumb-loaded .progressive-image.thumb {
  opacity: 1;
}

.progressive-image-container.loaded .progressive-image.thumb {
  opacity: 0;
}

/* Skeleton overlay */
.skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  z-index: 4;
  transition: opacity 0.3s ease-out;
}

.progressive-image-container.thumb-loaded .skeleton {
  opacity: 0.5;
}

.progressive-image-container.loaded .skeleton {
  opacity: 0;
  z-index: 0;
}

/* Image info overlay */
.image-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0));
  color: white;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.progressive-image-container:hover .image-info {
  opacity: 1;
}

.image-info h3 {
  margin: 0;
  font-size: 16px;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* Image grid styles */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  grid-gap: 1rem;
}

.image-grid figure {
  margin: 0;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-grid figure:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.image-grid figure h2 {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0));
  color: white;
  font-size: 1.2rem;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}
