/* ======================================================
   carrito_style.css — UNIFICADO COMPLETO FINAL
   CARRITO FLOTANTE + MINI CARRITO + STICKY BAR MOBILE
====================================================== */

/* =========================
   VARIABLES GLOBALES
========================= */
:root{
  --cart-blue:#0d6efd;
  --cart-blue-dark:#0b5ed7;
  --cart-white:#ffffff;
  --cart-text:#1f2937;
  --cart-muted:#6b7280;
  --cart-border:#e5e7eb;
  --cart-orange:#ff7a00;
  --cart-danger:#ff3b30;
  --cart-shadow:0 12px 28px rgba(0,0,0,.22);

  /* Altura sticky bar para cálculos */
  --sticky-bar-height:72px;

  /* Height helpers */
  --mini-cart-width:360px;
}

/* ======================================================
   RESET / UTIL
====================================================== */
#mini-cart,
#cart-overlay,
.floating-cart-btn,
.mp-sticky-bar{
  -webkit-tap-highlight-color: transparent;
}

.mini-cart *,
.mp-sticky-bar *{
  box-sizing:border-box;
}

@supports (height: 100dvh){
  :root{ --vh: 100dvh; }
}
@supports not (height: 100dvh){
  :root{ --vh: 100vh; }
}

/* ======================================================
   BOTÓN FLOTANTE (DESKTOP)
====================================================== */
.floating-cart-btn{
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 5000;

  width: 75px;
  height: 75px;
  border-radius: 50%;
  border: none;

  background: var(--cart-blue);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  box-shadow: var(--cart-shadow);
  transition: transform .15s ease, background .15s ease;
}

.floating-cart-btn:hover{
  transform: translateY(-2px);
  background: var(--cart-blue-dark);
}

/* Evita iconos legacy */
.floating-cart-btn i,
.floating-cart-btn svg,
.floating-cart-btn img{
  display:none!important;
}

/* Logo */
.cart-logo-mask{
  width: 50px;
  height: 50px;
  background:#fff;
  -webkit-mask:url("/images/logo.png") center/contain no-repeat;
          mask:url("/images/logo.png") center/contain no-repeat;
}

/* Badge contador */
.floating-cart-count{
  position:absolute;
  top:-6px;
  right:-6px;

  min-width:22px;
  height:22px;
  padding:0 6px;

  background:var(--cart-danger);
  color:#fff;

  font-size:12px;
  font-weight:800;
  line-height:22px;
  text-align:center;

  border-radius:999px;
  box-shadow:0 4px 10px rgba(0,0,0,.35);
}

/* ======================================================
   OVERLAY
====================================================== */
.cart-overlay{
  position: fixed;
  inset: 0;

  background: rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;

  transition: .25s;

  /* ✅ Debe estar por encima del contenido,
     pero debajo del mini cart */
  z-index: 6998;
}

/* Estados posibles: .active (tu CSS viejo) o .open (tu JS) */
.cart-overlay.active,
.cart-overlay.open{
  opacity: 1;
  pointer-events: auto;
}

/* ======================================================
   MINI CARRITO LATERAL
====================================================== */
.mini-cart{
  position: fixed;
  top: 0;
  right: 0;

  width: var(--mini-cart-width);
  max-width: 100%;

  /* 🔥 CLAVE ANDROID: vh dinámico */
  height: var(--vh);
  max-height: var(--vh);

  background: #fff;
  border-left: 1px solid var(--cart-border);

  /* ✅ encima del overlay y de la sticky bar */
  z-index: 6999;

  transform: translateX(100%);
  transition: transform .28s ease;

  display: flex;
  flex-direction: column;
  
  justify-content: space-between;
  overscroll-behavior: contain;

}

/* Estado abierto: tu JS usa .open */
.mini-cart.open{
  transform: translateX(0);
}

/* HEADER */
.mini-cart-header{
  padding: 16px;
  border-bottom: 1px solid var(--cart-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background:#fff;
}

.mini-cart-header strong{
  font-size: 16px;
  font-weight: 900;
  color: var(--cart-text);
}

.mini-cart-close{
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--cart-border);
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 34px;
  text-align:center;
}

.mini-cart-items{
  flex: 1 1 auto;
  overflow-y: auto;

  padding: 14px;
  -webkit-overflow-scrolling: touch;
}

/* ITEM */
.cart-item{
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f1f1f1;
}

.cart-item img{
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  background: #f7f7f7;
  border: 1px solid #eee;
}

/* Info */
.cart-info .title{
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--cart-text);
  margin-bottom: 2px;
}

.cart-info .variant{
  font-size: 12px;
  line-height: 1.2;
  color: var(--cart-muted);
}

/* ======================================================
   PRECIOS — HOMOGÉNEOS (mismos tamaños/ritmo)
====================================================== */
.cart-info .price{
  margin-top: 6px;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.2px;
  color: var(--cart-orange);
}

/* CONTROLES +/- */
.cart-controls{
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-controls .qty{
  min-width: 20px;
  text-align:center;
  font-weight: 800;
  color: #111827;
}

.cart-controls button{
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--cart-border);
  background: #fff;
  cursor: pointer;
  font-weight: 900;
  font-size: 18px;
  line-height: 28px;
}

/* ======================================================
   TOTALES (SIEMPRE VISIBLES, SIN TAPARSE)
====================================================== */

.mini-cart-totals .row{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;

  font-size: 14px;
  color: var(--cart-muted);
}

.mini-cart-totals .row span:first-child{
  font-weight: 700;
}

.mini-cart-totals .row span:last-child{
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.2px;
  color: #111827;
}

/* Total final */
.mini-cart-totals .row.total{
  padding-top: 10px;
}

.mini-cart-totals .row.total span:first-child{
  color: var(--cart-blue);
  font-weight: 900;
}

.mini-cart-totals .row.total span:last-child{
  font-size: 20px;
  font-weight: 950;
  line-height: 1.15;
  letter-spacing: -0.3px;
  color: var(--cart-blue);
}

.btn-checkout{
  flex-shrink: 0;
  margin: 12px 16px 16px;
  padding: 14px;
  border-radius: 14px;

  background: var(--cart-blue);
  color: #fff;
  font-weight: 900;
  text-align: center;
}


.btn-checkout:hover{
  background: var(--cart-blue-dark);
}

/* ======================================================
   STICKY BAR MOBILE — PREMIUM
====================================================== */
.mp-sticky-bar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  height: var(--sticky-bar-height);
  background: #ffffff;

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 10px 14px 12px;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -8px 24px rgba(0,0,0,.08);

  border-radius: 18px 18px 0 0;

  /* ✅ debajo del overlay/mini-cart, arriba del sitio */
  z-index: 6500;
}

/* Acciones */
.mp-action{
  position: relative;
  height: 48px;
  border-radius: 14px;
  border: none;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;

  user-select:none;
}

/* Iconos */
.mp-icon{
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Ayuda */
.mp-help{
  flex: 1;
  background: #f5f6f8;
  color: #374151;
}

/* Carrito */
.mp-cart{
  flex: 1.3;
  background: linear-gradient(135deg,#0d6efd,#0b5ed7);
  color: #ffffff;
}

/* Badge */
.mp-badge{
  position: absolute;
  top: -6px;
  right: -6px;

  min-width: 22px;
  height: 22px;
  padding: 0 6px;

  background: var(--cart-danger);
  color: #fff;

  font-size: 11px;
  font-weight: 900;
  line-height: 22px;
  text-align: center;

  border-radius: 999px;
  border: 2px solid #fff;
}

/* ======================================================
   RESPONSIVE
====================================================== */

/* Desktop */
@media (min-width:1025px){
  .mp-sticky-bar{ display:none; }
}

/* Mobile */
@media (max-width:1024px){

  .floating-cart-btn{
    display:none!important;
  }

  /* Evita que el sitio quede tapado por la sticky bar */
  body,
  footer{
    padding-bottom: calc(var(--sticky-bar-height) + 10px);
  }

  /* 🔥 MINI CART MOBILE — FULL SCREEN REAL */
  .mini-cart{
    position: fixed;
    inset: 0;

    width: 100%;
    max-width: 100%;

    height: 100dvh;
    max-height: 100dvh;

    display: flex;
    flex-direction: column;

    padding-bottom: 0; /* NO reservas falsas */
  }
}


/* ======================================================
   (Opcional) mejora accesibilidad/visual
====================================================== */
.cart-controls button:active,
.mp-action:active,
.floating-cart-btn:active{
  transform: translateY(1px);
}

.mini-cart-items::-webkit-scrollbar{
  width: 10px;
}
.mini-cart-items::-webkit-scrollbar-thumb{
  background: #e5e7eb;
  border-radius: 999px;
  border: 2px solid #fff;
}

.mini-cart-totals{
  flex-shrink: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--cart-border);
  background: #fff;
}



