* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #e5d3b3;
  color: #fff;
}


/* --- Configuración del Carrusel --- */
.main-container {
  max-width: 950px;
  margin: 0 auto;
  padding: 0 20px;
}

.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

#gallery {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  gap: 20px;
  padding: 20px 0;
  scrollbar-width: none;
}

#gallery::-webkit-scrollbar {
  display: none;
}

.gallery-item {
  flex: 0 0 280px;
  background: white;
  border-radius: 15px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
}

.gallery-item:hover {
  transform: translateY(-5px);
}

.gallery-item img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
}

.gallery-item-title {
  padding: 15px;
  text-align: center;
  font-weight: bold;
  color: #333;
}

/* --- Botones Redondos del Carrusel --- */
.nav-btn-gallery {
  width: 35px;
  height: 35px;
  min-width: 35px;
  background: rgba(255, 255, 255, 0.572);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  position: absolute;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.nav-btn-gallery.prev {
  left: -25px;
}

.nav-btn-gallery.next {
  right: -25px;
}

/* --- Estilos del Lightbox --- */
#lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;padding: 20px;
    /* ← AGREGAR */
    box-sizing: border-box;
    /* ← AGREGAR */
  /* Muy alto para que no lo tape nada */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#lightbox.active {
  opacity: 1;
  visibility: visible;
}

/* --- Botón Cerrar (Mejorado) --- */
.close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 50px;
  /* Más grande para móviles */
  color: white;
  cursor: pointer;
  z-index: 10001;
  /* Por encima de todo */
  line-height: 1;
  user-select: none;
  transition: transform 0.2s;
}

.close-btn:hover {
  transform: scale(1.2);
  color: #ffcc00;
  /* Un color dorado como el bodegón */
}

/* --- Centrado del Loader --- */
.loader {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

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

#lightboxImg {
  max-width: 90%;
  max-height: 80vh;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

#lightboxImg.loaded {
  opacity: 1;
}
#lightboxTitle {
  margin-top: 15px;
  font-size: 1.2rem;
  font-weight: bold;
}

#counter {
  margin-top: 5px;
  opacity: 0.7;
}

/* --- Botones del Lightbox --- */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 35px;
  height: 35px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.678);
  font-size: 25px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prev-btn {
  left: 30px;
}

.next-btn {
  right: 30px;
}

.close-btn {
  position: absolute;
  top: 30px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-btn-gallery.prev {
    left: -15px;
  }

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

  .nav-btn {
    top: auto;
    bottom: 30px;
  }

  .prev-btn {
    left: 20%;
  }

  .next-btn {
    right: 20%;
  }
}