/* =====================================================================
   CART PAGE (cart.html)  —  prefix: cart- / ct-
   Dark luxury theme. Reuses tokens from styles.css:
   --bg --surface --surface-2 --text --text-muted --border
   --gold --gold-bright --ink --radius --hdr-line
   Mobile-first; semantic <table> on desktop, stacked cards on mobile.
   ===================================================================== */

/* ---- Page shell ---------------------------------------------------- */
.cart-page {
  padding: 24px 0 56px;
}

@media (min-width: 768px) {
  .cart-page {
    padding-top: 34px;
  }
}

/* ---- Breadcrumb (Home / Cart) — matches .pdp-breadcrumb pattern ---- */
.cart-breadcrumb {
  margin-bottom: 16px;
}

.cart-breadcrumb ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.cart-breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Chevron separator between crumbs */
.cart-breadcrumb li + li::before {
  content: "\f105"; /* fa chevron-right */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 10px;
  color: var(--text-muted);
}

.cart-breadcrumb a {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.cart-breadcrumb a:hover {
  color: var(--gold);
}

.cart-breadcrumb [aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.cart-breadcrumb a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Page heading -------------------------------------------------- */
.cart-head {
  margin-bottom: 22px;
}

.cart-title {
  margin: 0;
  font-size: clamp(26px, 3.5vw, 34px);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text);
  text-transform: capitalize;
}

.cart-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.cart-subtitle [data-cart-count] {
  color: var(--gold);
  font-weight: 700;
}

/* ---- 2-column layout: items + summary ------------------------------ */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

@media (min-width: 992px) {
  .cart-layout {
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 30px;
  }
}

/* =====================================================================
   ITEMS TABLE (desktop)
   ===================================================================== */
.cart-items {
  min-width: 0;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.cart-table thead th {
  padding: 14px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
}

.ct-col-price,
.ct-col-qty,
.ct-col-total {
  text-align: center;
}

.ct-col-remove {
  width: 52px;
}

.cart-item {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}

.cart-item:last-child {
  border-bottom: 0;
}

.cart-item:hover {
  background: rgba(200, 162, 74, 0.04);
}

.cart-table td,
.cart-table tbody th {
  padding: 16px;
  vertical-align: middle;
  font-weight: 400;
}

/* Product cell (thumbnail + name/variant) */
.ct-product {
  text-align: left;
}

.ct-product {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ct-thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 96px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.ct-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ct-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ct-name {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  text-transform: capitalize;
  transition: color 0.2s ease;
}

.ct-name:hover {
  color: var(--gold);
}

.ct-variant {
  color: var(--text-muted);
  font-size: 12.5px;
}

.ct-sku {
  color: var(--text-muted);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

/* Money cells */
.ct-price,
.ct-total {
  text-align: center;
  white-space: nowrap;
}

.ct-money {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

/* Gold-accented line total */
.ct-line-total {
  color: var(--gold);
  font-size: 15px;
  font-weight: 800;
  padding-left: 9px;
  border-left: 3px solid var(--gold);
}

/* Quantity stepper */
.ct-qty {
  text-align: center;
}

.ct-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}

.ct-step {
  width: 40px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  transition: background 0.18s ease, color 0.18s ease;
}

.ct-step:hover {
  background: var(--gold);
  color: var(--ink);
}

.ct-qty-input {
  width: 46px;
  height: 44px;
  border: 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  -moz-appearance: textfield;
  appearance: textfield;
}

.ct-qty-input::-webkit-outer-spin-button,
.ct-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Remove button (44px round icon button) */
.ct-remove {
  text-align: center;
}

.ct-remove-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.ct-remove-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(200, 162, 74, 0.08);
}

/* ---- Footer actions row under the table ---------------------------- */
.cart-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

.cart-continue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-transform: capitalize;
  transition: color 0.2s ease, gap 0.2s ease;
}

.cart-continue:hover {
  color: var(--gold);
  gap: 12px;
}

.cart-secure-note {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.cart-secure-note i {
  color: var(--gold);
}

/* =====================================================================
   ORDER SUMMARY (sticky card)
   ===================================================================== */
.cart-summary {
  min-width: 0;
}

@media (min-width: 992px) {
  .cart-summary {
    position: sticky;
    top: 96px;
  }
}

.cart-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  padding: 22px 22px 24px;
}

.cart-summary-title {
  margin: 0 0 18px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text);
  text-transform: capitalize;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ---- Coupon / promo --------------------------------------------- */
.cart-coupon {
  margin-bottom: 20px;
}

.cart-coupon-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: capitalize;
}

.cart-coupon-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.cart-coupon-input {
  height: 52px;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid rgba(200, 162, 74, 0.22);
  border-radius: var(--radius);
  background: #1d1d1d;
  color: #f2f2f2;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cart-coupon-input::placeholder {
  color: #a3a3a3;
  text-transform: none;
  letter-spacing: normal;
}

.cart-coupon-input:focus {
  outline: 0;
}

.cart-coupon-row:focus-within .cart-coupon-input {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(227, 195, 90, 0.22);
}

/* Apply = secondary button (surface-2, gold on hover) */
.cart-coupon-apply {
  height: 52px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-transform: capitalize;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.cart-coupon-apply:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.cart-coupon-feedback {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
}

/* Hide the wrapper entirely when no coupon is applied (no stray gap). */
.cart-coupon-feedback:empty {
  display: none;
  margin: 0;
}

.cart-coupon-feedback.is-ok {
  color: var(--gold-bright);
}

.cart-coupon-feedback.is-error {
  color: #e89090; /* readable warm red on dark, decorative only */
}

/* While an AJAX cart action is in flight, dim + lock the cart so rapid
   clicks don't stack. */
[data-cart].is-cart-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.cart-ajax-notices:empty {
  display: none;
}

.cart-ajax-notices {
  margin: 0 0 16px;
}

/* ---- Applied-coupon chip (e.g. "🏷 TEST  ✕") ---------------------- */
.cart-coupon-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 7px 7px 13px;
  border-radius: 999px;
  background: rgba(200, 162, 74, 0.1);
  border: 1px solid rgba(200, 162, 74, 0.34);
  color: var(--gold-bright);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
}

.cart-coupon-chip-tag {
  font-size: 11px;
  color: var(--gold);
}

.cart-coupon-chip-code {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cart-coupon-chip-x {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(200, 162, 74, 0.16);
  color: var(--gold-bright);
  font-size: 9px;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.cart-coupon-chip-x:hover,
.cart-coupon-chip-x:focus-visible {
  background: #e06666;
  color: #fff;
  outline: none;
}

/* ---- Totals list ------------------------------------------------- */
.cart-totals {
  margin: 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--border);
}

.cart-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.cart-total-row dt {
  color: var(--text-muted);
  font-size: 14px;
}

.cart-total-row dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

/* Shipping helper note under the label */
.cart-ship-note {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.cart-ship-value.is-free {
  color: var(--gold-bright);
  font-weight: 700;
}

.cart-discount-value {
  color: var(--gold-bright);
  font-weight: 700;
}

/* Grand total — emphasised + gold */
.cart-total-grand {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-bottom: 18px;
}

.cart-total-grand dt {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  text-transform: capitalize;
}

.cart-total-grand dd {
  color: var(--gold);
  font-size: 22px;
  font-weight: 800;
}

/* ---- Checkout CTA (primary gold) --------------------------------- */
.cart-checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 54px;
  border-radius: var(--radius);
  background: var(--gold);
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  transition: background 0.2s ease, transform 0.18s ease;
}

.cart-checkout i {
  transition: transform 0.2s ease;
}

.cart-checkout:hover {
  background: var(--gold-bright);
  color: var(--ink);
}

.cart-checkout:hover i {
  transform: translateX(4px);
}

/* Summary's own continue link (shown on mobile only, see media query) */
.cart-continue--summary {
  display: none;
  justify-content: center;
  margin-top: 14px;
}

/* ---- Trust mini-list --------------------------------------------- */
.cart-trust {
  margin: 20px 0 0;
  padding: 18px 0 0;
  list-style: none;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 11px;
}

.cart-trust li {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text-muted);
  font-size: 13px;
}

.cart-trust i {
  width: 18px;
  color: var(--gold);
  font-size: 14px;
  text-align: center;
}

/* =====================================================================
   EMPTY STATE (hidden by default via [hidden])
   ===================================================================== */
.cart-empty {
  max-width: 480px;
  margin: 10px auto;
  padding: 48px 24px 54px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.cart-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: rgba(200, 162, 74, 0.1);
  border: 1px solid var(--hdr-line);
  color: var(--gold);
  font-size: 34px;
}

.cart-empty-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  text-transform: capitalize;
}

.cart-empty-text {
  margin: 0 auto 24px;
  max-width: 360px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.cart-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 26px;
  border-radius: var(--radius);
  background: var(--gold);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  transition: background 0.2s ease;
}

.cart-empty-cta:hover {
  background: var(--gold-bright);
  color: var(--ink);
}

/* =====================================================================
   FOCUS RINGS (AA, consistent with theme)
   ===================================================================== */
.ct-step:focus-visible,
.ct-qty-input:focus-visible,
.ct-remove-btn:focus-visible,
.ct-name:focus-visible,
.cart-coupon-apply:focus-visible,
.cart-checkout:focus-visible,
.cart-continue:focus-visible,
.cart-empty-cta:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

/* The stepper pill is overflow:hidden, which would clip a 2px OUTER focus
   ring on its edge-to-edge children. Draw their ring inset so it is never
   clipped. Layout is unchanged, so desktop does not regress. */
.ct-step:focus-visible,
.ct-qty-input:focus-visible {
  outline-offset: -2px;
  position: relative;
  z-index: 1;
}

/* =====================================================================
   MOBILE  —  table becomes stacked cards (each item = a labelled card)
   ===================================================================== */
@media (max-width: 767px) {
  /* Hide the table header; the cards carry their own labels */
  .cart-table {
    border: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }

  .cart-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  /* Each row = a card */
  .cart-item {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "product remove"
      "rows    rows";
    gap: 0 14px;
    margin-bottom: 14px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }

  .cart-item:hover {
    background: var(--surface);
  }

  .cart-table td,
  .cart-table tbody th {
    padding: 0;
  }

  /* Product (thumb + info) spans the card top */
  .ct-product {
    grid-area: product;
    align-items: flex-start;
  }

  .ct-thumb {
    width: 84px;
    height: 112px;
  }

  /* Remove button pinned top-right */
  .ct-remove {
    grid-area: remove;
    justify-self: end;
  }

  /* Honor the "44px round icon button" intent on touch */
  .ct-remove-btn {
    width: 44px;
    height: 44px;
  }

  /* Price / Quantity / Total are grouped into a single inset "summary"
     panel below the product — a cleaner, more premium read than three
     loose rows. Each cell is a flex row: label (::before) left, value
     right. Shared side borders + rounded first/last cell make the three
     cells read as one cohesive bordered card. */
  .cart-table .ct-price,
  .cart-table .ct-qty,
  .cart-table .ct-total {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 60px;
    padding: 8px 14px;
    /* Recessed panel: darker than the card (--surface) so it reads as a
       true inset on the dark theme. Scoped under .cart-table so it beats
       the (0,1,1) `.cart-table td { padding:0 }` mobile reset. */
    background: var(--bg);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: left;
  }

  /* Top of the panel */
  .ct-price {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    border-radius: 10px 10px 0 0;
  }

  /* Middle row — hairline divider above */
  .ct-qty {
    border-top: 1px solid var(--border);
  }

  /* Bottom of the panel — highlighted Total footer: gold tint layered over
     the same dark base as the other rows, so it stays part of the panel
     while clearly standing out. */
  .ct-total {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: 0 0 10px 10px;
    background: linear-gradient(
        rgba(200, 162, 74, 0.13),
        rgba(200, 162, 74, 0.13)
      ),
      var(--bg);
  }

  /* Inject the column label on the left of each row, styled as a small
     uppercase eyebrow that matches the desktop table header. */
  .ct-price::before,
  .ct-qty::before,
  .ct-total::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  /* Price value is secondary context — the line Total is the hero number. */
  .ct-price .ct-money {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
  }

  /* Total footer: the label brightens to --text to mark the footer, but
     stays at normal size/weight so the big gold amount unmistakably wins;
     drop the desktop left-border accent (the tinted row already carries it). */
  .ct-total::before {
    color: var(--text);
    font-weight: 700;
  }

  .ct-total .ct-line-total {
    border-left: 0;
    padding-left: 0;
    font-size: 19px;
    line-height: 1.1;
  }

  /* Quantity: a compact pill pinned to the right of the row. It sits on the
     lightest surface (lighter than the recessed panel) and carries a soft
     shadow so it reads as a RAISED, tappable control; the tonal step defines
     its edge, so the outer hairline is dropped to reduce clutter. */
  .ct-stepper {
    flex: 0 0 auto;
    background: var(--surface-2);
    border: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }

  .ct-step {
    width: 46px;
    height: 44px;
    font-size: 13px;
  }

  .ct-qty-input {
    width: 54px;
    height: 44px;
    font-size: 15px;
  }

  /* Stack the actions row */
  .cart-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  /* Hide the standalone continue link on mobile (summary carries one),
     and the secure-note stays centered */
  .cart-items > .cart-actions > .cart-continue {
    display: none;
  }

  .cart-secure-note {
    justify-content: center;
  }

  /* Show the summary's continue link on mobile */
  .cart-continue--summary {
    display: flex;
  }
}

@media (max-width: 380px) {
  .ct-thumb {
    width: 70px;
    height: 94px;
  }

  /* On the smallest phones, keep the stepper compact but trim the segments
     a touch so the "Quantity" label + control never crowd or wrap. */
  .ct-step {
    width: 44px;
    height: 44px;
  }

  .ct-qty-input {
    width: 48px;
    height: 44px;
  }
}

/* =====================================================================
   REDUCED MOTION
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  .cart-continue,
  .cart-checkout,
  .cart-checkout i,
  .ct-step,
  .ct-remove-btn,
  .cart-coupon-apply {
    transition: none !important;
  }

  .cart-checkout:hover i {
    transform: none;
  }
}