/* Overlay oculto por defecto */
#cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 998;
}

/* Mostrar overlay cuando el carrito está abierto */
#fixed-cart.abierto ~ #cart-overlay,
#cart-overlay.visible {
  opacity: 1;
  pointer-events: all;
}


.fixed-cart {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  padding: 24px;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  box-sizing: border-box;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

/* Clase para mostrar el carrito */
#fixed-cart.abierto {
  transform: translateX(0);
}

.fixed-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 24px;
}

.fixed-cart-header button {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
}

.fixed-cart-product {
  display: flex;
  gap: 16px;
  margin-bottom: 30px;
  background: white;
}

.fixed-cart-product img {
  width: 120px;
  height: auto;
  object-fit: cover;
  background: radial-gradient(circle, #f8f8f8 0%, #f0f0f0 100%);
}

.fixed-cart-product-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  color: #000;
}

.fixed-cart-product-details p {
  margin: 4px 0;
  color: black;
}

.fixed-cart-product-details a {
  color: #000;
  font-size: 14px;
  text-decoration: underline;
  margin-top: 10px;
  cursor: pointer;
  color: black;
}

.fixed-cart-shipping,
.fixed-cart-discount{
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
}

.fixed-cart-total {
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  margin-bottom: 24px;
}

.fixed-cart-summary {
  margin-top: auto;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  margin-bottom: 24px;
  border-top: 1px solid #ddd;
  padding-top: 20px;
}

.fixed-cart-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fixed-cart-actions button {
  padding: 12px;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  border-radius: 0;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.fixed-cart-actions .btn-view-cart {
  background: none;
  color: #000;
  border: 1px solid #000;
}

.fixed-cart-actions .btn-view-cart:hover {
  background: #f7f7f7;
}

.fixed-cart-actions .btn-checkout {
  background: #000;
  color: #fff;
  border: none;
}

.fixed-cart-actions .btn-checkout:hover {
  background: #222;
}

.cantidad-control {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}

.cantidad-control button {
  background: none;
  border: none;
  font-size: 12px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}

.cantidad-control input.cantidad-input {
  width: 40px;
  text-align: center;
  border: none;
  outline: none;
  font-size: 12px;
  background: none;
  padding: 2px 0;
  pointer-events: none;  /* evita edición manual */
}

/* Ocultar flechas en Chrome, Safari, Edge */
.cantidad-control input[type=number]::-webkit-outer-spin-button,
.cantidad-control input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Ocultar flechas en Firefox */
.cantidad-control input[type=number] {
  -moz-appearance: textfield;
}

.fixed-cart-coupon {
  display: flex;
  width: 100%;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 0;
  font-size: 14px;
  flex-direction: column;
}

.fixed-cart-coupon-superior{
    display: flex;
    width: 100%;
}

.fixed-cart-coupon input {
  flex: 1;
  padding: 6px 4px;
  font-size: 14px;
  border: none;
  border-bottom: 1px solid #ccc;
  background: none;
  outline: none;
}

.fixed-cart-coupon button {
  font-size: 14px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 1px solid black;
}

#remove-coupon,
#coupon-message {
  margin-top: 4px;
  font-size: 14px;
  color: #c00; /* puedes cambiar según estado */
}

.fixed-cart-product {
  position: relative;
}

.loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0); /* fondo oscuro semitransparente */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;

  opacity: 0;
  pointer-events: none; /* evita clics mientras esté invisible */
  transition: background 0.35s ease, opacity 0.35s ease;
}

.loader.visible {
  opacity: 1;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.05); /* fondo oscuro semitransparente */
}

.loader::after {
  content: '';
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #333;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.cart-loading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 15px;
  height: 120px; /* espacio visible mientras carga */
}

.cart-loading::after {
  content: '';
  width: 30px;
  height: 30px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #333;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}


