/* Carrusel Moderno Custom - Standard LP Motor */
.px_custom_carousel {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
}

.px_carousel_container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Estilos para pocas imágenes (centradas) */
.px_custom_carousel.px_center_mode .px_carousel_container {
  justify-content: center;
  gap: 4px;
  transform: none !important;
}

.px_custom_carousel.px_center_mode .px_carousel_item {
  flex: 0 0 auto;
  min-width: 200px;
  max-width: 240px;
  position: relative;
}

/* Estilos para muchas imágenes (llenar contenedor) */
.px_custom_carousel.px_fill_mode .px_carousel_container {
  justify-content: flex-start;
  gap: 2px;
}

.px_custom_carousel.px_fill_mode .px_carousel_item {
  flex: 0 0 auto;
  width: 260px; /* Ancho fijo para mantener la consistencia en el grid */
  position: relative;
}

.px_carousel_item {
  height: 100%;
  cursor: pointer;
  overflow: hidden;
  border-radius: 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: #e9ecef;
  /* aspect-ratio removed to allow variable width based on image */
}

.px_carousel_item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.px_carousel_item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Recortar para llenar, evitando espacios vacíos */
  transition: transform 0.3s ease;
}

.px_carousel_item:hover img {
  transform: scale(1.05);
}

/* Controles de navegación */
.px_carousel_nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.px_carousel_nav:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.px_carousel_nav.prev {
  left: 12px;
}

.px_carousel_nav.next {
  right: 12px;
}

.px_carousel_nav i {
  font-size: 18px;
  color: #333;
}

/* Ocultar navegación en modo centrado */
.px_custom_carousel.px_center_mode .px_carousel_nav {
  display: none;
}



/* Responsive */
@media (max-width: 768px) {
  .px_custom_carousel {
    height: 180px;
  }
  
  .px_custom_carousel.px_center_mode .px_carousel_item {
    min-width: 160px;
    max-width: 180px;
  }
  
  .px_custom_carousel.px_fill_mode .px_carousel_item {
    width: 160px;
  }
  
  .px_carousel_nav {
    width: 36px;
    height: 36px;
  }
  
  .px_carousel_nav i {
    font-size: 16px;
  }
  
  .px_carousel_nav.prev {
    left: 8px;
  }
  
  .px_carousel_nav.next {
    right: 8px;
  }
}

@media (max-width: 480px) {
  .px_custom_carousel {
    height: 160px;
  }
  
  .px_custom_carousel.px_center_mode .px_carousel_item {
    min-width: 140px;
    max-width: 160px;
  }
  
  .px_custom_carousel.px_fill_mode .px_carousel_item {
    width: 140px;
  }
  
  .px_custom_carousel.px_center_mode .px_carousel_container {
    gap: 3px;
  }
}

/* Loading state */
.px_carousel_item.loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* Modo touch para móviles */
.px_custom_carousel.touch_enabled {
  touch-action: pan-y;
}

.px_custom_carousel.touch_enabled .px_carousel_container {
  transition: transform 0.3s ease;
}

.px_custom_carousel.touch_enabled.dragging .px_carousel_container {
  transition: none;
}

/* ============================================
   LIGHTBOX GALLERY - PX Gallery
   ============================================ */

.px-gallery-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.97);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.px-gallery-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Header */
.px-gallery-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  padding-top: env(safe-area-inset-top, 0);
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
  z-index: 10;
}

.px-gallery-counter {
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.px-gallery-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  padding: 5px 10px;
  line-height: 1;
  opacity: 0.9;
  transition: opacity 0.2s, transform 0.2s;
}

.px-gallery-close:hover,
.px-gallery-close:active {
  opacity: 1;
  transform: scale(1.1);
}

/* Main container */
.px-gallery-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 50px 0 90px 0;
}

/* Slides container */
.px-gallery-slides {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Image wrapper */
.px-gallery-image-wrapper {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, opacity 0.3s ease;
  will-change: transform;
}

.px-gallery-image-wrapper.dragging {
  transition: none !important;
}

.px-gallery-image-wrapper.zoomed {
  cursor: grab;
}

.px-gallery-image-wrapper.zoomed:active {
  cursor: grabbing;
}

.px-gallery-image-wrapper.prev-slide {
  transform: translateX(-100%);
  opacity: 0;
}

.px-gallery-image-wrapper.next-slide {
  transform: translateX(100%);
  opacity: 0;
}

.px-gallery-image-wrapper.active-slide {
  transform: translateX(0);
  opacity: 1;
}

/* Image */
.px-gallery-image {
  max-width: 95%;
  max-height: 95%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.25s ease;
  transform-origin: center center;
  border-radius: 2px;
  box-shadow: 0 5px 30px rgba(0,0,0,0.4);
}

.px-gallery-image.loading {
  opacity: 0.3;
}

/* Navigation arrows */
.px-gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: background 0.2s, transform 0.2s;
  z-index: 10;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.px-gallery-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.px-gallery-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.px-gallery-nav.prev {
  left: 15px;
}

.px-gallery-nav.next {
  right: 15px;
}

.px-gallery-nav:disabled {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
}

/* Thumbnails */
.px-gallery-thumbnails {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px;
  padding-bottom: max(15px, env(safe-area-inset-bottom, 15px));
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 100000; /* Asegurar que se vean encima */
}

.px-gallery-thumbnails::-webkit-scrollbar {
  display: none;
}

.px-gallery-thumb {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s, border-color 0.2s;
  border: 2px solid transparent;
}

.px-gallery-thumb:hover {
  opacity: 0.8;
}

.px-gallery-thumb.active {
  opacity: 1;
  border-color: #fff;
  transform: scale(1.1);
}

.px-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block; /* Asegurar renderizado */
}

/* Zoom indicator */
.px-gallery-zoom-hint {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

.px-gallery-zoom-hint.visible {
  opacity: 1;
}

/* Loader */
.px-gallery-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: px-gallery-spin 0.8s linear infinite;
  z-index: 5;
}

@keyframes px-gallery-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .px-gallery-nav {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }
  
  .px-gallery-nav.prev {
    left: 8px;
  }
  
  .px-gallery-nav.next {
    right: 8px;
  }
  
  .px-gallery-thumbnails {
    height: 70px;
    padding: 10px;
    gap: 6px;
  }
  
  .px-gallery-thumb {
    width: 45px;
    height: 45px;
  }
  
  .px-gallery-zoom-hint {
    bottom: 85px;
    font-size: 13px;
  }
  
  .px-gallery-image {
    max-width: 100%;
    max-height: 100%;
  }
  
  .px-gallery-main {
    padding: 45px 0 75px 0;
  }
}

/* Hide nav on very small screens when only 1 image */
@media (max-width: 480px) {
  .px-gallery-nav {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}

/* Hide smartPhoto if it exists to avoid conflicts */
.smartphoto {
  display: none !important;
}