/* ------------------- Modal con carrusel ------------------- */

/* Fondo y posicionamiento del modal (overlay) */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  overflow-y: auto;
  padding: 24px 12px;
  box-sizing: border-box;
}

/* Contenido con fondo blanco y bordes redondeados */
.modal-content {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 20px 24px 24px;
  max-width: 600px;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* Botón cerrar modal (esquina superior derecha) */
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #666;
  transition: color 0.3s;
  user-select: none;
  line-height: 1;
}

.modal-close:hover {
  color: #000;
}

/* Contenedor del carrusel */
#carrusel {
  position: relative;
  width: 100%;
  height: 350px; /* altura suficiente para imagen grande */
  background: #fff;
  overflow: hidden;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  margin-bottom: 12px;
}

/* Imagen carrusel */
#imagenCarrusel {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  display: block;
  user-select: none;
}

/* Botones de navegación prev/next */
.carrusel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0,0,0,0.4);
  border: none;
  color: white;
  font-size: 30px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 50%;
  user-select: none;
  transition: background-color 0.25s;
  z-index: 10;
}

.carrusel-btn:hover {
  background-color: rgba(0,0,0,0.7);
}

#prevBtn {
  left: 12px;
}

#nextBtn {
  right: 12px;
}

/* Contador de imágenes */
#contadorImagenes {
  font-size: 1rem;
  color: #444;
  margin-top: 10px;
  user-select: none;
  text-align: center;
}

/* Datos producto dentro del modal */
#modalDatosProducto {
  margin-top: 20px;
  text-align: center;
}

#modalDatosProducto h3 {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 1.3rem;
  color: #222;
}

#modalDatosProducto p {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #555;
}

#modalDatosProducto span {
  font-weight: 700;
  font-size: 1.2rem;
  color: #249f86;
  display: block;
  margin-bottom: 14px;
}

#modalAgregarCarrito {
  background-color: #249f86;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  transition: background-color 0.3s;
  user-select: none;
}

#modalAgregarCarrito:hover {
  background-color: #1b7f6e;
}

/* Responsive: adaptar modal a pantallas pequeñas */
@media (max-width: 500px) {
  .producto-item {
    width: 48vw;
    margin: 8px 1%;
  }

  .producto {
    width: 100%;
    height: auto;
  }

  .mini-carrusel {
    width: 100%;
    height: auto;
  }

  .modal-content {
    padding: 16px 14px 20px;
  }

  #carrusel {
    height: 250px;
  }

  .carrusel-btn {
    font-size: 24px;
    padding: 6px 10px;
  }

  #modalDatosProducto h3 {
    font-size: 1.1rem;
  }

  #modalDatosProducto span {
    font-size: 1.1rem;
  }
}
