/* Toggle button fijo */
#btn-open-carrito {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--color-terciario);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 1001;
}
#cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #fff;
  color: var(--color-terciario);
  width: 1.2rem;
  height: 1.2rem;
  font-size: .75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Backdrop */
#carrito-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s;
  z-index: 1000;
}
#carrito-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

/* Panel del carrito */
#carrito-panel {
  position: fixed;
  top: 0; right: 0;
  width: 320px;
  max-width: 90%;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 16px rgba(0,0,0,0.1);
  transform: translateX(100%);
  transition: transform .3s;
  display: flex;
  flex-direction: column;
  z-index: 1002;
}
#carrito-panel.abierto {
  transform: translateX(0);
}

/* Header panel */
#carrito-panel header {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #eee;
}
#carrito-panel header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-cuaternario);
}
#carrito-panel .cerrar-menu {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-cuaternario);
}

/* Items list */
#cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.cart-item {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  gap: .75rem;
}
.cart-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.cart-info {
  flex: 1;
}
.cart-title {
  margin: 0 0 .25rem;
  font-size: .95rem;
  color: #333;
}
.cart-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .25rem;
}
.qty-btn,
.remove-btn {
  background: var(--color-primario);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.qty-btn:hover,
.remove-btn:hover {
  background: var(--color-secundario);
}
.qty {
  min-width: 24px;
  text-align: center;
}

/* Subtotal */
.cart-sub {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--color-cuaternario);
}

/* Footer panel */
.cart-footer {
  padding: 1rem;
  border-top: 1px solid #eee;
}
.cart-footer strong {
  display: block;
  margin-bottom: .75rem;
  color: #333;
}
#cart-submit {
  width: 100%;
  background: var(--color-terciario);
  color: #fff;
  border: none;
  padding: .75rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background .2s;
}
#cart-submit:hover {
  background: var(--color-cuaternario);
}

/* Responsive */
@media (max-width: 480px) {
  #carrito-panel { width: 100%; }
  .cart-thumb { display: none; }
}

/* ——— Quantity selector ——— */
.quantity-wrap {
  margin: 1.5rem 0;
}
.quantity-wrap label {
  font-weight: 600;
  margin-right: 0.5rem;
}
.quantity-wrap select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 0.6rem 1rem;
  border: 1px solid var(--color-terciario);
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.quantity-wrap select:focus {
  outline: none;
  border-color: var(--color-primario);
  box-shadow: 0 0 0 3px rgba(var(--color-primario-rgb), .2);
}
.quantity-wrap .pack-info {
  display: block;
  font-size: 0.85rem;
  color: var(--color-cuaternario);
  margin-top: 0.25rem;
}

/* ——— Inputs nombre/email en carrito ——— */
#carrito-panel input[type="text"],
#carrito-panel input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
}
#carrito-panel input[type="text"]:focus,
#carrito-panel input[type="email"]:focus {
  border-color: var(--color-primario);
  box-shadow: 0 0 0 3px rgba(var(--color-primario-rgb), .2);
  outline: none;
}


