/* Commerce: cart, checkout, account */

/* ── Page shell ─────────────────────────────────────────────────────────── */
.page {
  background: var(--bg-soft);
  padding: 22px 0 32px;
  min-height: calc(100vh - 280px);
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-crumbs { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-crumbs a:hover { color: var(--brand); }
.page-crumbs .sep { opacity: .5; }
.page-crumbs .here { color: var(--ink); font-weight: 600; }
.page-title {
  font-family: "Poppins", "Inter", sans-serif;
  font-size: clamp(28px, 3.2vw, 38px);
  color: var(--brand);
  margin: 8px 0 6px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.page-sub { color: var(--muted); margin: 0; font-size: 14.5px; max-width: 70ch; text-wrap: pretty; }

.panel {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 24px 28px;
}
.panel-title {
  font-family: "Poppins", "Inter", sans-serif;
  font-size: 18px; font-weight: 600; color: var(--ink);
  margin: 0 0 18px; letter-spacing: -.005em;
}

/* ── Cart layout ───────────────────────────────────────────────────────── */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 22px;
  align-items: start;
}
.cart-items { display: grid; gap: 12px; }
.cart-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: grid;
  grid-template-columns: 96px 1fr auto auto auto;
  align-items: center;
  gap: 16px;
  transition: box-shadow .2s;
}
.cart-item:hover { box-shadow: var(--shadow-card); }
.cart-thumb {
  width: 96px; height: 96px;
  border-radius: 12px;
  background: var(--bg-soft);
  display: grid; place-items: center;
  color: var(--brand); opacity: .55;
  position: relative;
  overflow: hidden;
}
.cart-thumb .slot-label {
  position: absolute; bottom: 4px; left: 6px;
  font: 8.5px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--brand); opacity: .6;
}
.cart-info { min-width: 0; }
.cart-info-tag {
  font-size: 10.5px;
  font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.cart-info-name {
  font-family: "Poppins", "Inter", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 6px;
  line-height: 1.3;
}
.cart-info-meta { color: var(--muted); font-size: 12.5px; }
.cart-info-meta span + span::before { content: "·"; padding: 0 6px; opacity: .5; }

.cart-qty {
  display: inline-flex; align-items: stretch;
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  overflow: hidden;
}
.cart-qty button {
  width: 32px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 16px;
  font-weight: 600;
}
.cart-qty button:hover { background: var(--bg-soft); }
.cart-qty input {
  width: 34px;
  border: 0;
  background: transparent;
  text-align: center;
  font: inherit; font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  outline: none;
  -moz-appearance: textfield;
}
.cart-qty input::-webkit-inner-spin-button,
.cart-qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.cart-price {
  font-family: "Poppins", "Inter", sans-serif;
  color: var(--brand);
  font-weight: 700;
  font-size: 17px;
  min-width: 110px;
  text-align: right;
}
.cart-price small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.cart-remove {
  width: 32px; height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid; place-items: center;
  border-radius: 999px;
  transition: background .15s, color .15s;
}
.cart-remove:hover { background: rgba(226,59,59,.1); color: var(--accent-red); }

.cart-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 8px 0;
  flex-wrap: wrap; gap: 12px;
}
.cart-foot .link-pill { background: transparent; }

/* Free shipping progress */
.free-ship {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.free-ship-text { font-size: 13px; color: var(--muted); }
.free-ship-text b { color: var(--brand); }
.free-ship-bar {
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.free-ship-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 999px;
  transition: width .3s ease;
}

/* Summary card */
.summary {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: sticky; top: 100px;
  display: grid; gap: 14px;
}
.summary-title {
  font-family: "Poppins", "Inter", sans-serif;
  font-size: 17px; font-weight: 600; color: var(--ink);
  margin: 0 0 4px;
}
.summary-row {
  display: flex; justify-content: space-between;
  font-size: 14px;
  color: var(--ink);
}
.summary-row.dim { color: var(--muted); }
.summary-row.discount { color: #2bb35a; font-weight: 600; }
.summary-row.shipping b { color: #2bb35a; }
.summary-divider { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.summary-total {
  display: flex; justify-content: space-between;
  align-items: baseline;
  font-family: "Poppins", "Inter", sans-serif;
  font-weight: 600;
  font-size: 15px;
}
.summary-total b {
  color: var(--brand);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.summary-total small { color: var(--muted); font-size: 11.5px; font-weight: 500; display: block; }

.promo-row {
  display: flex; gap: 8px;
  margin: 6px 0;
}
.promo-row input {
  flex: 1;
  height: 38px;
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  padding: 0 14px;
  font: inherit; font-size: 13px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.promo-row input:focus { border-color: var(--brand); }
.promo-row button {
  height: 38px;
  padding: 0 16px;
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.promo-row button:hover { background: var(--brand-ink); }
.promo-applied {
  background: rgba(43, 179, 90, .1);
  color: #2bb35a;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  font-size: 15px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer;
  transition: background .15s, transform .12s;
  width: 100%;
}
.btn-primary:hover { background: var(--brand-ink); transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  color: var(--brand);
  border: 1.5px solid var(--brand);
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--bg-soft); }

.secure-badge {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted);
  font-size: 12px;
  justify-content: center;
  margin-top: 4px;
}
.secure-badge svg { color: #2bb35a; }

/* ── Checkout ──────────────────────────────────────────────────────────── */
.steps {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 8px 0 24px;
  flex-wrap: wrap;
}
.step {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.step-n {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--bg-softer);
  color: var(--muted);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 12px;
}
.step.on { color: var(--brand); font-weight: 600; }
.step.on .step-n { background: var(--brand); color: #fff; }
.step.done .step-n { background: #2bb35a; color: #fff; }

.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 22px;
  align-items: start;
}
.checkout-main { display: grid; gap: 18px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Selectable radio cards (delivery/payment options) */
.opt-list { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  background: #fff;
  border: 1.5px solid var(--line-2);
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: var(--brand); }
.opt.on {
  border-color: var(--brand);
  background: var(--bg-soft);
}
.opt input { display: none; }
.opt-radio {
  width: 18px; height: 18px;
  border-radius: 999px;
  border: 2px solid var(--line-2);
  flex-shrink: 0;
  transition: border-color .15s;
  position: relative;
}
.opt.on .opt-radio { border-color: var(--brand); }
.opt.on .opt-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--brand);
  border-radius: 999px;
}
.opt-body { flex: 1; min-width: 0; }
.opt-title { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.opt-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.opt-price { color: var(--brand); font-weight: 700; font-size: 14px; white-space: nowrap; }
.opt-ic {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--brand);
  display: grid; place-items: center;
  flex-shrink: 0;
}

.check {
  display: flex; align-items: flex-start; gap: 12px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.45;
}
.check input { display: none; }
.check-box {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--line-2);
  flex-shrink: 0;
  display: grid; place-items: center;
  color: #fff;
  background: #fff;
  margin-top: 1px;
}
.check input:checked + .check-box {
  background: var(--brand);
  border-color: var(--brand);
}
.check input:checked + .check-box svg { opacity: 1; }
.check-box svg { opacity: 0; transition: opacity .12s; }
.check a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

/* Order summary lines */
.summary-line {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.summary-line:last-child { border-bottom: 0; }
.summary-line-thumb {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--brand);
  opacity: .6;
  display: grid; place-items: center;
}
.summary-line-name {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.summary-line-meta { color: var(--muted); font-size: 11.5px; }
.summary-line-price { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Empty state */
.empty-cart {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 64px 24px;
  text-align: center;
  display: grid; gap: 16px;
  justify-items: center;
}
.empty-cart-ic {
  width: 96px; height: 96px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--brand);
  display: grid; place-items: center;
}
.empty-cart h3 { font-family: "Poppins", sans-serif; font-size: 22px; color: var(--ink); margin: 0; font-weight: 600; }
.empty-cart p { color: var(--muted); margin: 0; max-width: 40ch; }

/* ── Account ───────────────────────────────────────────────────────────── */
.acc-hero {
  background: var(--brand);
  color: #fff;
  padding: 28px 0;
}
.acc-hero-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
}
.acc-avatar {
  width: 76px; height: 76px;
  border-radius: 999px;
  background: rgba(255,255,255,.15);
  color: #fff;
  display: grid; place-items: center;
  font-family: "Poppins", sans-serif;
  font-size: 28px;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,.3);
}
.acc-hello {
  font-family: "Poppins", sans-serif;
  font-size: 26px;
  font-weight: 600;
  margin: 0;
}
.acc-meta { opacity: .8; font-size: 13px; margin-top: 4px; }
.acc-logout {
  border: 1px solid rgba(255,255,255,.4);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.acc-logout:hover { background: rgba(255,255,255,.12); }

.acc-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  padding: 28px 0;
  align-items: start;
}
.acc-nav {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 8px;
  position: sticky; top: 100px;
  display: grid; gap: 2px;
}
.acc-nav button {
  background: transparent;
  border: 0;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.acc-nav button:hover { background: var(--bg-soft); color: var(--brand); }
.acc-nav button.on { background: var(--brand); color: #fff; font-weight: 600; }
.acc-nav button.on svg { color: #fff; }
.acc-nav button svg { color: var(--muted); }
.acc-nav .divider { height: 1px; background: var(--line); margin: 6px 4px; }

.acc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.acc-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.acc-stat-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.acc-stat-val {
  font-family: "Poppins", sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--brand);
  margin-top: 6px;
  letter-spacing: -.01em;
}
.acc-stat-val small { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Orders table */
.orders-table {
  width: 100%;
  border-collapse: collapse;
}
.orders-table th, .orders-table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.orders-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.orders-table tr:last-child td { border-bottom: 0; }
.order-no { color: var(--brand); font-weight: 700; font-family: "Poppins", sans-serif; }
.order-status {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.order-status.paid    { background: rgba(43,179,90,.12);  color: #2bb35a; }
.order-status.shipped { background: rgba(14,58,135,.12);  color: var(--brand); }
.order-status.delivered { background: rgba(43,179,90,.18); color: #1c8c44; }
.order-status.pending { background: rgba(246,194,68,.18); color: #b07e00; }
.order-status.cancelled { background: rgba(226,59,59,.12); color: var(--accent-red); }
.order-actions { display: flex; gap: 6px; justify-content: flex-end; }
.order-action {
  width: 30px; height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: #fff;
  display: grid; place-items: center;
  color: var(--muted);
  cursor: pointer;
}
.order-action:hover { color: var(--brand); border-color: var(--brand); }

/* Address cards */
.addr-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.addr-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  display: grid;
  gap: 8px;
  transition: border-color .15s;
}
.addr-card.default { border-color: var(--brand); }
.addr-card-default-tag {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 4px 10px;
  border-radius: 999px;
}
.addr-name { font-weight: 700; color: var(--ink); font-family: "Poppins", sans-serif; }
.addr-lines { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.addr-actions { display: flex; gap: 8px; margin-top: 6px; }
.addr-actions a { color: var(--brand); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.addr-actions a:hover { text-decoration: underline; }
.addr-actions .del { color: var(--accent-red); }

.addr-add {
  background: var(--bg-softer);
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius-lg);
  padding: 30px;
  color: var(--brand);
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  display: grid; place-items: center;
  min-height: 140px;
  transition: background .15s, border-color .15s;
}
.addr-add:hover { background: var(--bg-soft); border-color: var(--brand); }

/* Loyalty */
.loyalty-card {
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  border-radius: 18px;
  padding: 28px 32px;
  display: grid; gap: 20px;
  position: relative;
  overflow: hidden;
}
.loyalty-card::after {
  content: "";
  position: absolute;
  right: -10%; top: -30%;
  width: 60%; aspect-ratio: 1;
  background: radial-gradient(circle, rgba(255,255,255,.12), transparent 65%);
  pointer-events: none;
}
.loyalty-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 10px; position: relative; z-index: 1; }
.loyalty-points {
  font-family: "Poppins", sans-serif;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
}
.loyalty-points small { font-size: 14px; opacity: .85; font-weight: 500; margin-left: 6px; }
.loyalty-progress {
  height: 8px;
  background: rgba(255,255,255,.18);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.loyalty-progress > span { display: block; height: 100%; background: #fff; border-radius: 999px; }
.loyalty-next-text { font-size: 13px; opacity: .88; }

@media (max-width: 980px) {
  .cart-layout, .checkout-layout, .acc-layout { grid-template-columns: 1fr; }
  .acc-nav { position: static; }
  .summary { position: static; }
}
@media (max-width: 760px) {
  .cart-item { grid-template-columns: 72px 1fr; }
  .cart-item .cart-qty, .cart-item .cart-price, .cart-item .cart-remove {
    grid-column: 1 / -1;
  }
  .cart-item .cart-price { text-align: left; }
  .form-row { grid-template-columns: 1fr; }
  .acc-stats { grid-template-columns: 1fr 1fr; }
  .addr-grid { grid-template-columns: 1fr; }
  .acc-hero-inner { grid-template-columns: auto 1fr; }
  .acc-logout { grid-column: 1 / -1; justify-self: start; }
}
