/* ======================================================
   Estilos para Múltiples Imágenes de Productos
   ====================================================== */

/* Wrapper mejorado para tarjetas con múltiples imágenes */
.product-image-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
}

/* Contador de imágenes */
.product-image-counter {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 5;
  pointer-events: none;
}

/* Botones de navegación de imágenes */
.product-image-nav-prev,
.product-image-nav-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  opacity: 0;
}

.product-card:hover .product-image-nav-prev,
.product-card:hover .product-image-nav-next {
  opacity: 1;
}

.product-image-nav-prev {
  left: 0.5rem;
}

.product-image-nav-next {
  right: 0.5rem;
}

.product-image-nav-prev:hover,
.product-image-nav-next:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: translateY(-50%) scale(1.1);
}

.product-image-nav-prev:active,
.product-image-nav-next:active {
  transform: translateY(-50%) scale(0.95);
}

/* Galerías de miniaturas */
.product-image-thumbnails {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.2), transparent);
  overflow-x: auto;
  scroll-behavior: smooth;
  justify-content: center;
  flex-wrap: wrap;
}

.product-image-thumb {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border: 2px solid transparent;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.product-image-thumb:hover {
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.05);
}

.product-image-thumb.active {
  border-color: #2196F3;
  box-shadow: 0 0 0 2px white, 0 0 0 4px #2196F3;
}

/* Estilos para la imagen principal mejorados */
.product-main-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  transition: opacity 0.3s ease;
}

/* Animación de cambio de imagen */
@keyframes fadeInImage {
  from {
    opacity: 0.5;
  }
  to {
    opacity: 1;
  }
}

.product-main-image {
  animation: fadeInImage 0.3s ease;
}

/* Responsive para dispositivos móviles */
@media (max-width: 768px) {
  .product-image-nav-prev,
  .product-image-nav-next {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .product-image-nav-prev,
  .product-image-nav-next {
    opacity: 0.7;
  }

  .product-card:hover .product-image-nav-prev,
  .product-card:hover .product-image-nav-next {
    opacity: 0.9;
  }

  .product-image-counter {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    bottom: 0.5rem;
    right: 0.5rem;
  }

  .product-image-thumbnails {
    padding: 0.4rem;
    gap: 0.3rem;
  }

  .product-image-thumb {
    width: 40px;
    height: 40px;
  }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
  .product-image-thumb {
    width: 45px;
    height: 45px;
  }
}

/* Desktops grandes */
@media (min-width: 1200px) {
  .product-image-nav-prev,
  .product-image-nav-next {
    width: 40px;
    height: 40px;
  }

  .product-image-thumb {
    width: 55px;
    height: 55px;
  }
}

/* Asegurar que el badge siga siendo visible */
.product-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  color: #FF6B35;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Mejorar accesibilidad con focus states */
.product-image-nav-prev:focus-visible,
.product-image-nav-next:focus-visible,
.product-image-thumb:focus-visible {
  outline: 2px solid #2196F3;
  outline-offset: 2px;
}

/* Indicador visual de carga de imagen */
.product-main-image[loading="lazy"] {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

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

/* Print styles */
@media print {
  .product-image-nav-prev,
  .product-image-nav-next,
  .product-image-counter,
  .product-image-thumbnails {
    display: none !important;
  }
}
