:root {
  --primary-color: #6200ea;
  --secondary-color: #03dac6;
  --card-bg: #fff;
  --text-color: #333;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


h1 {
  font-family: 'Fredoka', sans-serif;
  font-size: 2.8em;
  margin-top: 1%;
  margin-bottom: 2%;
  color: white;
  text-align: center;
  background: var(--primary-color);
  padding: 12px 25px;
  border-radius: 50px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  display: block;
  width: fit-content;
  margin: 30px auto;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background-color: #f5f5f5;
  padding-bottom: 80px;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.card img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  max-height: 180px; /* ajustalo según el alto que quieras dentro de la tarjeta */
  display: block;
  margin: 0 auto; /* centra la imagen */
}

.card-content {
  padding: 15px;
}

.card-title {
  font-size: 18px;
  color: var(--text-color);
  margin-bottom: 10px;
}

.stock {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
}

.btn-add {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.btn-add:hover {
  background-color: #4500c2;
}

.btn-cart {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--secondary-color);
  color: black;
  padding: 15px 20px;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.btn-cart:hover {
  transform: scale(1.05);
}

.cantidad input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
  font-family: 'Segoe UI', sans-serif;
  color: var(--text-color);
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  margin-bottom: 2%;
}

.mensaje-cantidad {
  font-size: 13px;
  color: red;
  margin-top: 1px;
  display: none;
  margin-bottom: 1%;
}

input[type="number"].invalido {
  border: 2px solid #ccc;
  background-color: #f0f0f0;
  color: #888;
}

/* Efecto al enfocar */
.cantidad input[type="number"]:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(98, 0, 234, 0.2);
}

.modal-carrito {
  display: none; /* o 'flex' cuando esté activo */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
}

.modal-contenido {
  background-color: #fff;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 1000px; /* Aumenta el ancho máximo */
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.modal-contenido h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  margin-bottom: 20px;
  color: #333;
}

.cerrar {
  float: right;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}

.modal-carrito table {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
  font-family: 'Playfair Display', serif;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.modal-carrito thead {
  background-color: #f8f8f8;
}

.modal-carrito th, .modal-carrito td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
}

.modal-carrito th {
  font-weight: bold;
  color: #333;
}

.modal-carrito tbody tr:hover {
  background-color: #f1f1f1;
}

.modal-carrito img {
  max-width: 50px;
  height: auto;
  border-radius: 4px;
}
button.eliminar-btn {
  background-color: #ff4d4d;
  color: white;
  border: none;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

button.eliminar-btn:hover {
  background-color: #e60000;
}

.modal-carrito {
  display: none; /* Oculto por defecto */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 9999;
  overflow: auto;
}

.modal-carrito.activo {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-contenido {
  position: relative;
  background-color: white;
  padding: 20px;
  border-radius: 10px;
  max-width: 90%;
  width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}


.cerrar {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  z-index: 10000;
  transition: color 0.3s ease;
}

.cerrar:hover {
  color: #e74c3c; /* Rojo atractivo al pasar el mouse */
}

.precio-final-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
}

.precio-final-container label {
  background-color: #f4f4f4;
  border-left: 5px solid #4CAF50;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Título */
.modal-contenido h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 20px;
  text-align: center;
  color: #333;
}

/* Tabla del carrito */
#contenidoCarrito {
  overflow-x: auto;
}

#contenidoCarrito table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#contenidoCarrito th, #contenidoCarrito td {
  padding: 6px 8px;
  border: 1px solid #ddd;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
}

#contenidoCarrito th {
  background-color: #f7f7f7;
  color: #333;
}

/* Botón eliminar */
.eliminar-btn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 4px;
  cursor: pointer;
}

/* Formulario de confirmación */
.formulario-confirmacion {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.campo {
  margin-bottom: 12px;
}

.campo label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: #555;
}

.campo input {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

/* Botón confirmar */
.confirmar-btn {
  width: 100%;
  background: #2ecc71;
  color: white;
  padding: 10px;
  font-size: 15px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s;
}

.confirmar-btn:hover {
  background: #27ae60;
}

/* Responsive específico */
@media (max-width: 480px) {
  .modal-contenido {
    padding: 12px;
  }

  #contenidoCarrito th, #contenidoCarrito td {
    font-size: 10px;
    padding: 4px 6px;
  }

  .eliminar-btn {
    padding: 3px 6px;
    font-size: 12px;
  }

  .confirmar-btn {
    padding: 8px;
    font-size: 14px;
  }

  .cerrar {
    font-size: 20px;
  }

  .modal-contenido h2 {
    font-size: 18px;
  }
}


/* RESPONSIVIDAD PARA CELULARES */
@media (max-width: 600px) {
  h1 {
    font-size: 1.8em;
    padding: 10px 20px;
    margin: 20px auto;
  }

  .container {
    padding: 10px;
    gap: 15px;
    grid-template-columns: 1fr;
  }

  .card img {
    height: 150px;
  }

  .card-content {
    padding: 10px;
  }

  .card-title {
    font-size: 16px;
  }

  .stock {
    font-size: 13px;
  }

  .btn-add {
    padding: 8px 12px;
    font-size: 14px;
  }

  .btn-cart {
    padding: 12px 16px;
    font-size: 14px;
    bottom: 15px;
    right: 15px;
  }
}
