/* Estilos del Carrito Simplificado */
.cart-modal {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  max-height: 90vh; /* Limitar altura máxima del modal */
  background: white;
  border-left: 1px solid #ddd;
  z-index: 1001;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.cart-modal.open {
  right: 0;
}

/* Header del carrito */
.cart-header {
  background: #f8f9fa;
  color: #333;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ddd;
  flex-shrink: 0; /* Evita que el header se encoja */
}

.cart-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
}

.close-cart {
  background: none;
  border: none;
  color: #666;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.close-cart:hover {
  background: #e9ecef;
}

/* Contenido del carrito */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background: white;
}

/* Item individual del carrito */
.cart-item {
  background: white;
  margin: 0;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.cart-item:last-child {
  border-bottom: none;
}

.item-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.item-price {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.25rem;
}

/* Controles de cantidad y eliminar */
.cart-item-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-quantity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quantity-btn {
  background: #f8f9fa;
  border: 1px solid #ddd;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
  transition: all 0.2s;
}

.quantity-btn:hover {
  background: #e9ecef;
  border-color: #ccc;
}

.quantity-input {
  background: #fff;
  border: 1px solid #ddd;
  width: 50px;
  height: 28px;
  border-radius: 4px;
  text-align: center;
  font-weight: 500;
  font-size: 0.95rem;
  color: #333;
  padding: 0 4px;
  transition: all 0.2s;
}

.quantity-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quantity-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.remove-item {
  background: #f8f9fa;
  border: 1px solid #ddd;
  color: #666;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8rem;
}

.remove-item:hover {
  background: #dc3545;
  border-color: #dc3545;
  color: white;
}

/* Mensaje de carrito vacío */
.empty-cart-message {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-size: 0.95rem;
}

/* Total del carrito */
.cart-total {
  background: #f8f9fa;
  padding: 1rem 1.5rem;
  border-top: 1px solid #ddd;
  flex-shrink: 0;
}

.cart-total-final {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
}

.cart-total-final .total-amount {
  color: #333;
}

/* Acciones del carrito */
.cart-actions {
  padding: 1rem 1.5rem;
  background: white;
  border-top: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
}

.whatsapp-order {
  background: #25d366;
  color: white;
  border: none;
  padding: 0.875rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.whatsapp-order:hover {
  background: #20b358;
}

/* Botón deshabilitado cuando no se alcanza el mínimo */
.whatsapp-order.disabled,
.whatsapp-order:disabled {
  background: #ccc;
  color: #666;
  cursor: not-allowed;
  opacity: 0.6;
}

.whatsapp-order.disabled:hover,
.whatsapp-order:disabled:hover {
  background: #ccc;
}

.clear-cart {
  background: #f8f9fa;
  color: #666;
  border: 1px solid #ddd;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.clear-cart:hover {
  background: #e9ecef;
  border-color: #ccc;
}

/* ================================================= */
/* ==   MEJORA VISUAL: IMAGEN EN EL CARRITO       == */
/* ================================================= */

.cart-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.cart-item-image {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-info {
  margin-bottom: 0;
}

.cart-item-controls {
  justify-content: space-between;
}

.item-subtotal {
  font-weight: 500;
  font-size: 0.95rem;
  color: #333;
  min-width: 60px;
  text-align: right;
}


/* ================================================= */
/* ==   RESPONSIVE Y CORRECCIONES PARA MÓVILES    == */
/* ================================================= */

/* Para tablets y móviles grandes */
@media (max-width: 768px) {
  .cart-modal {
    max-width: 75%;
    width: 75%;
  }

  .cart-header,
  .cart-item,
  .cart-total,
  .cart-actions {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Para celulares (pantallas más pequeñas) */
@media (max-width: 480px) {
  .cart-modal {
    /* Hacemos que el modal sea un poco más ancho en pantallas pequeñas */
    max-width: 80%;
    width: 80%;
  }

  .cart-item {
    /* Reducimos el padding para dar más espacio al contenido */
    padding: 1rem 0.75rem;
    gap: 0.75rem;
  }
  
  .cart-item-image {
    width: 60px;
    height: 60px;
  }

  .cart-item-details {
    gap: 0.5rem;
  }

  .cart-item-controls {
    /* Permitimos que los controles se envuelvan a la siguiente línea si no caben */
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .item-name {
    font-size: 0.9rem;
  }
  
  .item-price, .item-subtotal {
    font-size: 0.85rem;
  }

  .quantity-input {
    width: 40px;
  }
}

