/* ============================================================
   WaterGo · el panel de la cesta

   Entra por la derecha en el ordenador y desde abajo en el móvil,
   que es de donde se espera que salgan las cosas en cada sitio.
   ============================================================ */

.cesta-panel { position: fixed; inset: 0; z-index: 90; }
.cesta-panel[hidden] { display: none; }

.cesta-panel__velo {
  position: absolute;
  inset: 0;
  background: rgba(29, 29, 27, .38);
  backdrop-filter: blur(2px);
  animation: cesta-velo .2s ease;
}
@keyframes cesta-velo { from { opacity: 0 } to { opacity: 1 } }

.cesta-panel__caja {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(440px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--blanco);
  box-shadow: -20px 0 60px rgba(29, 29, 27, .16);
  animation: cesta-entra .26s cubic-bezier(.22, 1, .36, 1);
}
@keyframes cesta-entra { from { transform: translateX(100%) } to { transform: none } }

.cesta-panel__cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--e-5) var(--e-5) var(--e-4);
  border-bottom: 1px solid var(--color-border);
}
.cesta-panel__cab h2 { margin: 0; font-size: 1.1rem; }

.cesta-panel__x {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 999px;
  background: transparent;
  font-size: 1.6rem; line-height: 1;
  color: var(--tinta);
  cursor: pointer;
}
.cesta-panel__x:hover { background: color-mix(in srgb, var(--tinta) 7%, transparent); }

.cesta-panel__cuerpo {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--e-4) var(--e-5);
}

.cesta-panel__vacia {
  margin: var(--e-8) 0;
  text-align: center;
  color: var(--color-muted);
}

/* ---------- una línea ---------- */

.cesta-linea {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: var(--e-4);
  align-items: start;
  padding: var(--e-4) 0;
  border-bottom: 1px solid var(--color-border);
}
.cesta-linea img,
.cesta-linea__hueco {
  width: 64px; height: 64px;
  border-radius: var(--r-m);
  object-fit: cover;
  background: var(--tinte-nude);
}
.cesta-linea__nombre { margin: 0; font-weight: 600; font-size: .95rem; line-height: 1.3; }
.cesta-linea__sku {
  margin: 2px 0 var(--e-2);
  font-family: var(--f-mono);
  font-size: .72rem;
  color: var(--color-muted);
}

.cesta-linea__cantidad {
  display: inline-flex;
  align-items: center;
  gap: var(--e-3);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px 4px;
}
.cesta-linea__cantidad button {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; border-radius: 999px;
  background: transparent;
  font-size: 1.05rem; line-height: 1;
  color: var(--tinta);
  cursor: pointer;
}
.cesta-linea__cantidad button:hover { background: color-mix(in srgb, var(--tinta) 8%, transparent); }
.cesta-linea__cantidad span { min-width: 1.5ch; text-align: center; font-variant-numeric: tabular-nums; }

.cesta-linea__precio { text-align: right; }
.cesta-linea__precio b { display: block; font-variant-numeric: tabular-nums; }
.cesta-linea__precio button {
  margin-top: var(--e-2);
  border: 0; background: none; padding: 0;
  font-size: .78rem;
  color: var(--color-muted);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- pie ---------- */

.cesta-panel__pie {
  padding: var(--e-4) var(--e-5) max(var(--e-5), env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
  background: var(--blanco);
}
.cesta-panel__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.05rem;
}
.cesta-panel__total b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.cesta-panel__nota {
  margin: var(--e-2) 0 var(--e-4);
  font-size: .8rem;
  color: var(--color-muted);
}
.cesta-panel__pagar { width: 100%; justify-content: center; }
.cesta-panel__error {
  margin: var(--e-3) 0 0;
  font-size: .85rem;
  color: #97331F;
}

/* El globito del icono: sin nada dentro, no se enseña un cero. */
.cesta__n[data-vacia="si"] { opacity: 0; }

/* ---------- móvil: entra desde abajo ---------- */

@media (max-width: 640px) {
  .cesta-panel__caja {
    top: auto;
    left: 0;
    width: 100%;
    max-height: 88vh;
    border-radius: var(--r-g) var(--r-g) 0 0;
    animation: cesta-sube .26s cubic-bezier(.22, 1, .36, 1);
  }
  @keyframes cesta-sube { from { transform: translateY(100%) } to { transform: none } }
}

@media (prefers-reduced-motion: reduce) {
  .cesta-panel__caja, .cesta-panel__velo { animation: none; }
}
