/* THE SHOPPING CART (owner, Oct 9 2026): the cart button, the mini-cart, the
   cart page and "Add to cart" on the order page. Same tokens as app.css. */

/* ---------- the cart button (page bars and the designer's toolbar) ---------- */
.cartbtn {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 38px; padding: 0 12px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-small); font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.cartbtn:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.cartbtn[hidden] { display: none; }
.cartbtn__n {
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
/* inside the designer's toolbar group it is a quiet part of the pill */
.hud__group--cart { padding: 3px; }
.hud__group--cart .cartbtn { border: 0; min-height: 34px; }
.hud__group--cart[hidden] { display: none; }

/* ---------- the mini-cart ---------- */
.minicart {
  position: fixed; top: 64px; right: 18px; z-index: 60;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100dvh - 90px);
  display: flex; flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.minicart[hidden] { display: none; }
.minicart__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 18px; }
.minicart__title { margin: 0; font-size: var(--fs-lead); font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.minicart__close {
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 22px; line-height: 1; color: var(--ink-70);
}
.minicart__close:hover { background: var(--accent-soft); color: var(--ink); }
.minicart__note {
  margin: 4px 18px 6px; padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  font-size: var(--fs-small); font-weight: 600; color: var(--accent);
}
.minicart__list { list-style: none; margin: 0; padding: 4px 18px; overflow-y: auto; flex: 1 1 auto; }
.minicart__item {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}
.minicart__item:first-child { border-top: 0; }
.minicart__thumb {
  width: 56px; height: 56px; object-fit: contain;
  border-radius: 6px; border: 1px solid var(--line-soft); background: var(--workspace);
}
.minicart__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.minicart__name { font-size: var(--fs-small); font-weight: 600; color: var(--ink); }
.minicart__line { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.minicart__price { font-size: var(--fs-small); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.minicart__acts { display: flex; gap: 14px; margin-top: 4px; }
.minicart__empty { padding: 18px 0; font-size: var(--fs-small); color: var(--muted); }
.minicart__foot {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line-soft);
}
.minicart__sub { grid-column: 1 / -1; margin: 0 0 2px; font-size: var(--fs-small); font-weight: 600; color: var(--ink); }
.minicart__checkout { min-height: 44px; }
.minicart__checkout[hidden] { display: none; }

/* a text button: Edit, Remove */
.linkbtn {
  padding: 0; min-height: 24px;
  font-size: 12.5px; font-weight: 600; color: var(--accent);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.linkbtn:hover { color: var(--ink); }
.linkbtn--danger { color: var(--warn-ink); }

/* ---------- "Add to cart" on the order page ---------- */
.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  background: var(--paper); color: var(--accent);
  font-size: var(--fs-body); font-weight: 600;
  transition: background var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn-outline:hover:not(:disabled) { background: var(--accent-soft); }
.btn-outline:disabled { opacity: .5; cursor: default; }
.btn-outline.is-working::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite;
}
.sum__cart { width: 100%; position: relative; }
.sum__cartbag { flex: 0 0 auto; }
.sum__cart[hidden] { display: none; }

/* ---------- the cart page ---------- */
.cartpage {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) var(--order-w);
}
.cartpage__main {
  min-width: 0; min-height: 0; overflow-y: auto;
  padding: 26px clamp(24px, 4vw, 64px) 40px;
  background: var(--surface);
}
.cartpage__title { margin: 16px 0 0; font-size: var(--fs-page); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; color: var(--ink); }
.cartpage__title:focus { outline: none; }
.cartpage__side {
  min-width: 0; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 6px 32px 0;
  background: var(--paper);
  border-left: 1px solid var(--line-soft);
}
.cartpage__side .order__summary { position: sticky; bottom: 0; margin: 26px -32px 0; }
.cartpage__side .order__summary[hidden] { display: none; }

.cartlist { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.cartlist[hidden] { display: none; }
.cartitem {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 18px; align-items: start;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}
.cartitem.is-bad { border-color: var(--warn); }
.cartitem__thumb {
  width: 112px; height: 112px; object-fit: contain;
  border-radius: 8px; background: var(--workspace);
  border: 1px solid var(--line-soft);
}
.cartitem__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cartitem__n {
  align-self: flex-start;
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--accent-soft);
  font-size: 12px; font-weight: 700; color: var(--accent);
}
.cartitem__name { margin-top: 4px; font-size: var(--fs-body); font-weight: 600; color: var(--ink); }
.cartitem__line { font-size: var(--fs-small); color: var(--ink-70); line-height: 1.45; }
.cartitem__meta { font-size: 12.5px; color: var(--muted); }
.cartitem__warn { margin-top: 4px; font-size: var(--fs-small); color: var(--warn-ink); }
.cartitem__acts { display: flex; gap: 16px; margin-top: 8px; }
.cartitem__price { font-size: var(--fs-body); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.cartlist--done { max-width: none; margin: 22px 0 0; }

.cartempty { margin-top: 28px; max-width: 520px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.cartempty[hidden] { display: none; }
.cartempty__text { margin: 0; font-size: var(--fs-body); color: var(--ink-70); line-height: 1.55; }

@media (max-width: 899px) {
  .cartpage { display: block; overflow-y: auto; }
  .cartpage__main { overflow: visible; padding: 18px 16px 8px; }
  .cartpage__side { overflow: visible; border-left: 0; border-top: 1px solid var(--line-soft); padding: 0 16px; }
  .cartpage__side .order__summary { margin: 22px -16px 0; }
  .cartitem { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .cartitem__thumb { width: 76px; height: 76px; }
  .cartitem__price { grid-column: 2; }
  .minicart { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; max-height: calc(100dvh - 40px); }
  /* the order page's bottom bar stays ONE row on a phone: price, the bag, "Place order" */
  .sum__cart { width: 52px; min-height: 52px; padding: 0; flex: 0 0 auto; }
  .sum__cartlabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cartbtn__label { display: none; }
}
