/* NORR · la bolsa: panel que entra desde la derecha sobre un fondo oscurecido. */

html.sin-desplazar { overflow: hidden; } /* con la bolsa abierta, la página de atrás no se mueve */

.bolsa-fondo {
  position: fixed; inset: 0; z-index: 70; background: rgba(21, 20, 18, .42);
  opacity: 0; pointer-events: none; transition: opacity .55s var(--suave);
}
.bolsa-fondo.visible { opacity: 1; pointer-events: auto; }

.bolsa {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 80; width: min(440px, 100%);
  display: flex; flex-direction: column; background: var(--papel);
  box-shadow: -30px 0 80px -40px rgba(21, 20, 18, .5);
  transform: translateX(105%); visibility: hidden;
  transition: transform .55s var(--suave), visibility 0s .55s;
}
.bolsa.abierta { transform: none; visibility: visible; transition: transform .55s var(--suave), visibility 0s; }

.bolsa-cabeza { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: calc(22px + env(safe-area-inset-top, 0px)) 24px 16px; }
.bolsa-cabeza h2 { font: 400 32px/1 var(--serif); }
.bolsa-cabeza h2 span { margin-left: 10px; font: 600 14px/1 var(--sans); color: var(--gris-texto); font-variant-numeric: tabular-nums; }
.bolsa-cabeza .redondo { width: 42px; height: 42px; }

/* Avance hacia el envío gratis (solo si la tienda lo ofrece). */
.bolsa-envio-caja { margin: 0 24px; padding: 14px 0 16px; border-top: 1px solid var(--linea); font: 600 13px/1.3 var(--sans); }
.bolsa-avance { height: 2px; margin-top: 10px; border-radius: 2px; overflow: hidden; background: var(--linea); }
.bolsa-avance i { display: block; height: 100%; background: var(--tinta); transition: width .7s var(--suave); }

.bolsa-lineas { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 24px; }
.linea {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 10px 14px; align-items: start;
  padding: 16px 0; border-top: 1px solid var(--linea);
}
.linea-imagen { grid-row: 1 / span 2; width: 72px; height: 72px; border-radius: 16px; overflow: hidden; background: var(--loseta); }
.linea-imagen :is(img, .recorte-svg) { width: 100%; height: 100%; object-fit: cover; }
.linea-imagen.es-recorte :is(img, .recorte-svg) { object-fit: contain; padding: 10%; }
.linea-nombre { display: inline-block; font: 600 14px/1.25 var(--sans); text-decoration: none; overflow-wrap: anywhere; }
.linea-nombre:hover { text-decoration: underline; text-underline-offset: 3px; }
.linea-detalle { margin-top: 4px; font: 500 12.5px/1.3 var(--sans); color: var(--gris-texto); }
.linea-precio { font: 700 14px/1.25 var(--sans); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cantidad {
  grid-column: 2; justify-self: start; display: inline-flex; align-items: center;
  height: 36px; border-radius: 999px; border: 1px solid var(--linea); background: #fff;
}
.cantidad button { width: 36px; height: 34px; border-radius: 999px; display: grid; place-items: center; }
.cantidad button .ico { width: 14px; height: 14px; }
.cantidad button:disabled { opacity: .3; cursor: default; }
.linea-cantidad { min-width: 22px; text-align: center; font: 700 13px/1 var(--sans); font-variant-numeric: tabular-nums; }

.bolsa-vacia { flex: 1; display: grid; place-content: center; justify-items: center; gap: 20px; padding: 24px; text-align: center; }
.bolsa-vacia p { font: 400 30px/1.1 var(--serif); }

.bolsa-pie { padding: 18px 24px calc(22px + env(safe-area-inset-bottom)); border-top: 1px solid var(--linea); }
.bolsa-total { display: flex; align-items: baseline; justify-content: space-between; font: 600 14px/1 var(--sans); }
.bolsa-total strong { font: 700 20px/1 var(--sans); font-variant-numeric: tabular-nums; }
.bolsa-pie .primario { width: 100%; height: 56px; margin-top: 16px; }
.bolsa-ayuda { margin-top: 12px; text-align: center; font: 500 12.5px/1.5 var(--sans); color: var(--gris-texto); }
.enlace-menor {
  display: block; margin: 12px auto 0; padding: 4px;
  font: 600 12.5px/1 var(--sans); color: var(--gris-texto); text-decoration: underline; text-underline-offset: 3px;
}
.enlace-menor:hover { color: var(--tinta); }

/* ---------- Ciudad de entrega ---------- */
.bolsa-ciudad { margin-bottom: 18px; }
.bolsa-ciudad label { display: block; font: 600 13px/1 var(--sans); }
.bolsa-ciudad input {
  display: block; width: 100%; height: 48px; margin-top: 9px; padding: 0 16px;
  border: 1px solid var(--linea); border-radius: 14px; background: #fff; color: var(--tinta);
  font: 500 16px/1 var(--sans); /* 16 px: con menos, el iPhone acerca la pantalla al escribir */
  transition: border-color .3s;
}
.bolsa-ciudad input::placeholder { color: #a9a59e; }
.bolsa-ciudad input:hover { border-color: var(--gris); }
.bolsa-ciudad input:focus-visible { border-color: var(--tinta); outline: 2px solid var(--tinta); outline-offset: 2px; }
.bolsa-ciudad-nota { margin-top: 8px; font: 500 12.5px/1.45 var(--sans); color: var(--gris-texto); }
.bolsa-ciudad-error { margin-top: 6px; font: 600 12.5px/1.45 var(--sans); color: var(--rojo); }
.bolsa-ciudad-error:empty { display: none; }
