/* =========================================================
   Modulo VENDER (lista de productos + carrito)
   ========================================================= */

/* ---------- Tarjeta de producto ---------- */
.tarjeta {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  background: var(--crema);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  transition: background 0.15s ease, transform 0.1s ease;
}

.tarjeta:active {
  transform: scale(0.98);
}

.tarjeta.seleccionada {
  background: var(--cafe);
  border-color: var(--cafe);
  color: var(--textoclaro);
}

.tarjeta.agotada {
  opacity: 0.75;
}

.tarjetafoto {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--blanco);
}

.tarjetaizquierda {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.tarjetanombre {
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tarjetaderecha {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.globotarjeta {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.22);
  font-weight: 700;
  font-size: 14px;
}

.globotarjeta .icono {
  width: 16px;
  height: 16px;
}

.tarjetaprecio {
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.tarjetaprecio small {
  font-size: 13px;
  font-weight: 600;
}

.precioanterior {
  font-size: 13px;
  text-decoration: line-through;
  opacity: 0.7;
}

.tarjetastock {
  font-size: 13px;
  color: var(--cafemedio);
}

.tarjetastock.alerta {
  color: var(--rojo);
  font-weight: 700;
}

.tarjeta.seleccionada .tarjetastock {
  color: rgba(255, 255, 255, 0.8);
}

/* ---------- Boton flotante "Ver carrito" ---------- */
.barracarrito {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(94px + env(safe-area-inset-bottom));
  padding: 0 14px;
  z-index: 15;
  max-width: 560px;
  margin: 0 auto;
}

[data-vista="vender"]:has(.barracarrito:not(.oculto)) {
  padding-bottom: calc(190px + env(safe-area-inset-bottom));
}

/* ---------- Vista CARRITO ---------- */
.vistacarrito:not(.oculto) {
  display: flex;
  flex-direction: column;
}

.vistacarrito .botonregresar {
  margin-bottom: 8px;
}

.hojacarrito {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--blanco);
  border-radius: 30px;
  padding: 24px 18px 18px;
  box-shadow: 0 2px 10px rgba(74, 47, 24, 0.06);
}

.titulocarrito {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 6px;
}

.lineas {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hojacarrito .lineas {
  flex: 1;
  margin: 18px 0 16px;
}

.linea {
  padding: 16px;
  background: var(--crema);
  border-radius: var(--radio);
}

.lineaarriba {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.lineanombre {
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.lineaunitario {
  margin-top: 4px;
  font-size: 14px;
  color: var(--cafemedio);
}

.lineatotal {
  font-size: 19px;
  font-weight: 800;
  white-space: nowrap;
}

.controles {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.botoncontrol {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 24px;
  color: var(--cafeoscuro);
}

.botoncontrol:active {
  background: var(--cafeclaro);
}

.campocantidad {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  background: var(--blanco);
  border-radius: 22px;
  font-weight: 800;
  font-size: 17px;
}

.campocantidad input {
  width: 70px;
  border: none;
  outline: none;
  background: transparent;
  text-align: right;
  font-weight: 800;
  font-size: 17px;
}

.botoneditargranel {
  flex: 1;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--blanco);
  border-radius: 22px;
  font-weight: 800;
}

.botoneditargranel .icono {
  width: 18px;
  height: 18px;
  color: var(--cafemedio);
}

.hojacarrito .resumen .botonprincipal {
  margin-top: 14px;
}

@media (max-width: 380px) {
  .encabezado .botonpastilla span {
    display: none;
  }
  .encabezado .botonpastilla {
    padding: 0 13px;
  }
}

/* En tema oscuro la tarjeta elegida usa texto oscuro */
:root[data-tema="oscuro"] .tarjeta.seleccionada .tarjetastock {
  color: var(--textoclaro);
  opacity: 0.75;
}
