.cart-container {
  width: 90%;
  gap: 3rem;
  margin: 4rem auto;
}
/* === Items list (mobile-first) === */
.cart-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Card base: 2 columnas (thumb + info) y las acciones en una fila completa abajo */
.cart-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-areas:
    "thumb info"
    "actions actions";
  align-items: start;
  gap: 12px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 12px;
}

.cart-item .thumb {
  grid-area: thumb;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: #f3f3f3;
}

.cart-item .info {
  grid-area: info;
  min-width: 0;
}
.cart-item .title {
  font: 600 14px/1.3 system-ui;
  color: #111;
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cart-item .sku {
  font: 12px/1.2 system-ui;
  color: #777;
}
.cart-item .unit {
  font: 12px/1.2 system-ui;
  color: #444;
  margin-top: 4px;
}

/* Acciones en mobile: grid propia con 2 filas (qty + total) y quitar abajo */
.cart-item .actions {
  grid-area: actions;
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 8px 10px;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "qty  .    line"
    "remove remove remove";
}
.cart-item .line {
  grid-area: line;
  font: 600 14px/1 system-ui;
  text-align: right;
}
.btn-remove-line {
  grid-area: remove;
  justify-self: center;
  background: transparent;
  border: 0;
  color: #dc2626;
  font: 600 12px/1 system-ui;
  cursor: pointer;
}

.qty {
  grid-area: qty;
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 999px;
  overflow: hidden;
}
.qty button {
  width: 28px;
  height: 28px;
  border: 0;
  background: #f8f8f8;
  cursor: pointer;
}
.qty input {
  width: 44px;
  text-align: center;
  border: 0;
  background: #fff;
  font: 600 13px/1 system-ui;
  padding: 0 6px;
}
.qty button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Summary */
.summary {
  position: sticky;
  top: 16px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
.summary h3 {
  font: 700 16px/1.2 system-ui;
  margin: 0 0 4px;
}
.summary .row {
  display: flex;
  justify-content: space-between;
  font: 14px/1.3 system-ui;
  color: #333;
}
.summary .row.total {
  font-weight: 700;
  border-top: 1px dashed #e5e5e5;
  padding-top: 10px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font: 600 12px/1 system-ui;
}
.badge.success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.badge.warn {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

/* Info cards */
.info-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.info-card {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 12px;
}
.info-card strong {
  display: block;
  margin-bottom: 4px;
}

/* Form */
.order-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.order-form label {
  font: 600 12px/1 system-ui;
  color: #333;
}
.order-form input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  font: 14px/1.2 system-ui;
}
.order-form .help {
  font: 12px/1.2 system-ui;
  color: #666;
}
.order-form .error {
  color: #b91c1c;
  font: 12px/1.2 system-ui;
  display: none;
}
.order-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.btn-primary {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: #111;
  color: #fff;
  padding: 12px 14px;
  font: 700 14px/1 system-ui;
  cursor: pointer;
}
.btn-primary.disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.btn-secondary {
  appearance: none;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #f8f8f8;
  color: #111;
  padding: 12px 14px;
  font: 600 14px/1 system-ui;
  cursor: pointer;
}

/* Loader state para botón */
.btn-primary.loading .btn-text {
  visibility: hidden;
}
.btn-primary.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn-primary {
  position: relative;
}

/* Empty state */
.cart-empty {
  background: #fff;
  border: 1px dashed #e5e5e5;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cart-empty h2 {
  margin: 0 0 6px;
  font: 700 18px/1.2 system-ui;
}
.cart-empty p {
  color: #555;
  margin: 0 0 12px;
}

/* --- Desktop / pantallas grandes --- */
@media (min-width: 992px) {
  .cart-container {
    display: grid;
    width: 80%;
    max-width: 1400px;
    grid-template-columns: 2fr 1fr;
  }
  .cart-item {
    grid-template-columns: 84px 1fr auto; /* 3 columnas */
    grid-template-areas: "thumb info actions"; /* todo en una fila */
    align-items: center;
  }
  .cart-item .thumb {
    width: 84px;
    height: 84px;
  }
  .cart-item .actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: end;
    width: auto;
  }
  .cart-item .line {
    order: 0;
    width: auto;
    text-align: right;
    margin: 0;
  }
  .btn-remove-line {
    order: 0;
    justify-self: auto;
  }
  .qty button {
    width: 30px;
    height: 30px;
  }
  .qty input {
    width: 56px;
  }
}

/* Intermedio: que el summary no sea sticky para tablets chicas */
@media (max-width: 992px) {
  .summary {
    position: static;
  }
}

/* Safety generales */
/* html,
body {
  max-width: 100%;
  overflow-x: hidden;
}
*,
*::before,
*::after {
  box-sizing: border-box;
} */
