/* ==========================================
   CX3C STORE - CARRITO PANEL (FINAL)
   Requiere HTML:
   #carrito-panel.carrito-panel
   .carrito-header .cerrar-carrito
   #carrito-contenido.carrito-contenido
   .carrito-footer
   (botón checkout: #btn-checkout)
========================================== */

/* Panel */
.carrito-panel{
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 92vw;
  height: 100vh;
  z-index: 9999;
  transform: translateX(110%);
  transition: transform .22s ease;
  display: flex;
  flex-direction: column;

  background: radial-gradient(1200px 900px at 20% 10%, rgba(90,120,255,.18), transparent 60%),
              linear-gradient(180deg, rgba(10,16,40,.92), rgba(8,12,28,.96));
  border-left: 1px solid rgba(255,255,255,.08);
  box-shadow: -18px 0 40px rgba(0,0,0,.55);

  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.carrito-panel.open{
  transform: translateX(0);
}

/* Header */
.carrito-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.carrito-header h2{
  margin: 0;
  font-size: 22px;
  letter-spacing: .2px;
  font-weight: 800;
  color: rgba(255,255,255,.92);
}

.cerrar-carrito{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  user-select: none;

  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}

.cerrar-carrito:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.16);
}

/* Contenido (items) */
.carrito-contenido{
  flex: 1;
  overflow: auto;
  padding: 14px;
}

.carrito-contenido::-webkit-scrollbar{ width: 10px; }
.carrito-contenido::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.12);
  border-radius: 10px;
  border: 2px solid rgba(0,0,0,0);
  background-clip: padding-box;
}

.cart-item{
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;

  border-radius: 18px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 10px 22px rgba(0,0,0,.22);
}

.cart-item-img{
  width: 58px;
  height: 58px;
  border-radius: 14px;
  overflow: hidden;
  flex: 0 0 auto;

  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-img img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info{
  flex: 1;
  min-width: 0;
}

.cart-item-title{
  font-weight: 800;
  font-size: 14px;
  line-height: 1.25;
  color: rgba(255,255,255,.92);

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-price{
  margin-top: 6px;
  font-weight: 800;
  font-size: 14px;
  color: rgba(255,255,255,.86);
}

.cart-item-actions{
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .15s ease;
}

.qty-btn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.10);
}

.qty-num{
  min-width: 22px;
  text-align: center;
  font-weight: 900;
  color: rgba(255,255,255,.92);
}

/* Botón eliminar (chip) */
.remove-btn{
  margin-left: auto;
  height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,100,140,.35);
  background: rgba(255,60,110,.12);
  color: rgba(255,210,225,.95);
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}

.remove-btn:hover{
  transform: translateY(-1px);
  background: rgba(255,60,110,.18);
  border-color: rgba(255,100,140,.55);
}

/* Footer (totales + CTA) */
.carrito-footer{
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.08);

  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.03));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);

  display: grid;
  gap: 10px;
}

/* Caja resumen */
.resumen-costos{
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
}

.resumen-item{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  color: rgba(255,255,255,.85);
  font-weight: 700;
}

.resumen-item + .resumen-item{
  border-top: 1px dashed rgba(255,255,255,.14);
}

.resumen-item.total{
  font-size: 18px;
  font-weight: 900;
  color: rgba(255,255,255,.95);
}

/* --------- CTA: Ir a pagar --------- */
#btn-checkout{
  width: 100% !important;
  height: 54px;
  border-radius: 16px;
  padding: 0 16px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  font-weight: 900;
  font-size: 16px;
  letter-spacing: .2px;

  border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.96);
  background: linear-gradient(180deg, rgba(120,140,255,.96), rgba(70,86,255,.92));

  box-shadow: 0 14px 30px rgba(0,0,0,.35),
              inset 0 1px 0 rgba(255,255,255,.16);
  cursor: pointer;

  transition: transform .12s ease, filter .12s ease;
}

#btn-checkout:hover{
  transform: translateY(-1px);
  filter: brightness(1.04);
}

#btn-checkout:active{
  transform: translateY(0);
  filter: brightness(.98);
}

#btn-checkout:disabled{
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* Nota bajo el botón (si la tienes) */
.carrito-footer .checkout-note{
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255,255,255,.62);
}

/* --------- BLOQUEO TOTAL: "Seguir comprando" en carrito ---------
   Si se te cuela un botón extra en el footer, lo escondemos.
   Dejamos visible SOLO #btn-checkout.
*/
#carrito-panel .carrito-footer button{ display: none !important; }
#carrito-panel .carrito-footer #btn-checkout{ display: inline-flex !important; }

/* Responsive (móvil): evita que Safari tape el CTA */
@media (max-width: 560px){
  .carrito-panel{
    width: 100%;
    max-width: 100%;
  }

  .carrito-footer{
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  #btn-checkout{
    height: 56px;
    border-radius: 16px;
    font-size: 16px;
  }
}

/* =========================
   ELIMINAR BOTÓN VIEJO "IR A PAGAR"
========================= */

/* Oculta cualquier botón NO sticky dentro del footer */
#carrito-panel .carrito-footer > button {
  display: none !important;
}

/* Deja SOLO el botón final (el bueno) */
#carrito-panel .carrito-footer .checkout-sticky,
#carrito-panel .carrito-footer #btn-checkout {
  display: flex !important;
}
