/* Cart-only styles.
 *
 * Scope all overrides to `body[data-cart-id]` so other pages are unaffected.
 */

body[data-cart-id] {
  --ct-bg: #f6f6f7;
  --ct-surface: #ffffff;
  --ct-border: rgba(15, 23, 42, 0.12);
  --ct-text: #0f172a;
  --ct-muted: rgba(15, 23, 42, 0.62);
  --minimal-bg: var(--ct-bg);
  --minimal-surface: var(--ct-surface);
  --minimal-border: var(--ct-border);
  --minimal-text: var(--ct-text);
  --minimal-muted: var(--ct-muted);

  --ct-radius: 12px;
  --minimal-radius: var(--ct-radius);

  background: var(--ct-bg);
  color: var(--ct-text);
}

body[data-cart-id] .ck-topbar-inner a i {
  font-size: 18px;
}

/* Page spacing */
body[data-cart-id] .flat-spacing-11 {
  padding-top: 24px;
  padding-bottom: 56px;
}

body[data-cart-id] .container {
  max-width: 1120px;
}

/* Layout: split on desktop, summary above items on mobile */
body[data-cart-id] .tf-page-cart-wrap {
  display: grid;
  grid-template-areas: "items summary";
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 40px;
  align-items: start;
}

body[data-cart-id] .tf-page-cart-item {
  grid-area: items;
  min-width: 0;
  background: var(--ct-surface);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius);
  padding: 16px;
}

body[data-cart-id] .tf-page-cart-footer {
  grid-area: summary;
}

body[data-cart-id] .tf-cart-footer-inner {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  top: calc(env(safe-area-inset-top) + 76px);
}

.tf-table-page-cart tr:last-child {
  border-bottom: 0 !important;
}

@media (max-width: 1023px) {
  body[data-cart-id] .flat-spacing-11 {
    padding-top: 6px;
  }

  body[data-cart-id] .tf-page-cart-wrap {
    grid-template-areas: "summary" "items";
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 0 !important;
  }

  body[data-cart-id] .tf-page-cart-item {
    padding: 12px;
  }

  body[data-cart-id] .tf-cart-footer-inner {
    position: static;
    top: auto;
  }
}

/* Table */
body[data-cart-id] .tf-table-page-cart {
  margin-bottom: 0;
}

body[data-cart-id] .tf-table-page-cart th {
  color: var(--ct-text);
  border-bottom-color: var(--ct-border);
}

body[data-cart-id] .tf-table-page-cart tr {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

/* Secondary actions */
body[data-cart-id] .tf-product-extra-icon {
  margin-top: 12px;
  color: var(--ct-muted);
}

body[data-cart-id] .tf-product-extra-icon:hover {
  color: var(--ct-text);
}

body[data-cart-id] #goTop {
  display: none;
}

/* Summary card */
body[data-cart-id] .tf-page-cart-checkout {
  background: var(--ct-surface);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius);
  padding: 16px;
}

body[data-cart-id] .tf-page-cart-checkout .tf-cart-totals-discounts {
  margin-top: 0;
}

body[data-cart-id] .tf-page-cart-checkout .tf-cart-totals-discounts h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--ct-muted);
}

body[data-cart-id] .tf-page-cart-checkout .tf-cart-totals-discounts .total-value {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

body[data-cart-id] .tf-page-cart-checkout .tf-cart-tax {
  margin-top: 8px;
  color: var(--ct-muted);
}

body[data-cart-id] .tf-page-cart-checkout .cart-checkout-btn .tf-btn {
  min-height: 56px;
  border-radius: 12px !important;
  font-weight: 750;
  letter-spacing: -0.01em;
}

/* Mobile sticky checkout bar (primary CTA on small screens) */
body[data-cart-id] .ct-sticky-checkout {
  display: none;
}

@media (max-width: 1023px) {
  body[data-cart-id] {
    padding-bottom: calc(env(safe-area-inset-bottom) + 92px);
  }

  body[data-cart-id] .ct-sticky-checkout {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1600;
    background: rgba(246, 246, 247, 0.92);
    border-top: 1px solid var(--ct-border);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
  }

  body[data-cart-id] .ct-sticky-checkout-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0 calc(env(safe-area-inset-bottom) + 12px);
  }

  body[data-cart-id] .ct-sticky-subtotal {
    display: grid;
    line-height: 1.15;
  }

  body[data-cart-id] .ct-sticky-subtotal .label {
    font-size: 12px;
    font-weight: 650;
    color: var(--ct-muted);
  }

  body[data-cart-id] .ct-sticky-subtotal .value {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.01em;
  }

  body[data-cart-id] .ct-sticky-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
  }

  body[data-cart-id] .ct-sticky-cta:hover {
    color: #ffffff;
    text-decoration: none;
  }

  /* Avoid two CTAs on mobile: use the sticky bar. */
  body[data-cart-id] .tf-page-cart-checkout .cart-checkout-btn {
    display: none;
  }
}
