/**
 * Eco Core — Cart page (Temu-style two-column layout).
 *
 * Scoped to `body.eco-cart-page`. Left column: item cards. Right column:
 * sticky Order Summary. Full-width recommendations below. Minimal header
 * (logo + topbar only). Mobile-first, switches to one column at <= 1266px.
 */

/* ---------------------------------------------------------------------------
 * Minimal header: keep logo + topbar, hide search / menu / action icons.
 * ------------------------------------------------------------------------- */
body.eco-cart-page .eco-header-search,
body.eco-cart-page .eco-menu-toggle,
body.eco-cart-page .eco-header-actions {
  display: none !important;
}

/* Disable the sticky header on the cart page (header.css makes it position:
 * sticky via --sticky / --sticky-main-only, plus a mobile variant). Force it
 * back into normal flow so it scrolls away with the page. */
body.eco-cart-page .eco-reference-header--sticky,
body.eco-cart-page .eco-reference-header--sticky .eco-main-header,
body.eco-cart-page .eco-reference-header--sticky-main-only .eco-main-header {
  position: static !important;
  top: auto !important;
}

body.eco-cart-page .eco-main-header__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

body.eco-cart-page .eco-logo {
  margin: 0;
}

/* Trust badge injected beside the logo on the cart page (cart.js). */
.eco-cart-safebadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #16a34a;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.eco-cart-safebadge svg {
  flex: 0 0 auto;
  color: #16a34a;
}

/* Hide Blocksy's page-title hero ("Cart") on the cart page. */
body.eco-cart-page .page-hero-section,
body.eco-cart-page .ct-page-title,
body.eco-cart-page .entry-header,
body.eco-cart-page .woocommerce-products-header,
body.eco-cart-page [data-prefix="page"] .ct-container > .entry-header,
body.eco-cart-page > .site .page-title {
  display: none !important;
}

/* ---------------------------------------------------------------------------
 * Page shell — Blocksy-native width handling.
 * Only the content container that actually wraps the cart is widened (scoped
 * via :has()), so Blocksy's header and footer containers keep their own width.
 * WooCommerce/Blocksy layout classes we retain for compatibility are
 * neutralized so they don't fight the two-column grid.
 * ------------------------------------------------------------------------- */
body.eco-cart-page {
  --eco-cart-shell: min(100% - 96px, 1536px);
  /* Blocksy reserves vertical spacing around the content area for the
   * page-title hero we hide; zero it so the breadcrumb hugs the header. */
  --content-vertical-spacing: 0px;
  --content-edge-spacing: 0px;
  --theme-content-vertical-spacing: 0px;
}

.eco-cart-page [class*="ct-container"]:has(.woocommerce) {
  max-width: none;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-left: 0;
  padding-right: 0;
  overflow: visible;
}

/* Full-bleed the cart wrapper out to the viewport (margin technique, no
 * transform, so the sticky Order Summary keeps working). The inner blocks
 * then use --eco-cart-shell where 100% == 100vw, matching the header. */
.eco-cart-page .entry-content,
.eco-cart-page .woocommerce {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: 0;
  padding-right: 0;
}

.eco-cart-page .cart_totals {
  float: none;
  width: auto;
}

/* Collapse the top spacing Blocksy reserves for the (now hidden) page-title
 * hero, so the breadcrumb sits close under the header. */
body.eco-cart-page #main,
body.eco-cart-page .site-main,
body.eco-cart-page main,
body.eco-cart-page .entry-content,
body.eco-cart-page article,
body.eco-cart-page [class*="content-area"] {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.eco-cart-breadcrumb-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: var(--eco-cart-shell);
  margin: 0 auto;
  padding: 8px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.eco-cart {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px;
  align-items: start;
  width: var(--eco-cart-shell);
  margin: 0 auto;
  padding: 14px 0 8px;
  color: #1f2937;
  font-family: inherit;
}

/* ---------------------------------------------------------------------------
 * Left column — items
 * ------------------------------------------------------------------------- */
.eco-cart__main {
  min-width: 0;
}

.eco-cart-form__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.eco-cart-form__title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #111827;
}

.eco-cart-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
}

.eco-cart-breadcrumb__link {
  color: #6b7280;
  text-decoration: none;
  transition: color 160ms ease;
}

.eco-cart-breadcrumb__link:hover {
  color: #1a86b0;
}

.eco-cart-breadcrumb__sep {
  color: #cbd5e1;
}

.eco-cart-breadcrumb__current {
  color: #111827;
  font-weight: 800;
}

.eco-cart-form__count {
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
}

.eco-cart-items {
  display: grid;
  gap: 12px;
}

.eco-cart-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid #ececec;
  border-radius: 10px;
  background: #fff;
  transition: border-color 160ms ease;
}

.eco-cart-item:hover {
  border-color: #d1d5db;
}

.eco-cart-item__thumb {
  width: 96px;
  height: 96px;
  overflow: hidden;
  border-radius: 8px;
  background: #f3f4f6;
}

.eco-cart-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eco-cart-item__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.eco-cart-item__name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.eco-cart-item__name a {
  color: #1f2937;
  text-decoration: none;
}

.eco-cart-item__name a:hover {
  color: #0f766e;
}

.eco-cart-item__deal {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 4px;
  background: #fff1f0;
  color: #d4380d;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.eco-cart-item__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.eco-cart-item__price {
  color: #16833a;
  font-size: 17px;
  font-weight: 900;
}

.eco-cart-item__price del {
  margin-right: 6px;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 600;
}

.eco-cart-item__price ins {
  text-decoration: none;
}

/* Quantity stepper — fully custom markup (.eco-qty) rendered in PHP, so the
 * theme never hooks into it and can't inject duplicate buttons. Pill shape. */
.eco-cart-item__qty .eco-qty {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border: 1px solid #16a34a;
  border-radius: 999px;
  background: #fff;
  padding: 2px;
}

.eco-cart-item__qty .eco-qty-input {
  flex: 0 0 34px;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #111827;
  -moz-appearance: textfield;
  appearance: textfield;
  box-sizing: border-box;
}

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

.eco-cart-item__qty .eco-qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #111827;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 140ms ease, color 140ms ease;
}

.eco-cart-item__qty .eco-qty-btn:hover {
  background: #dcfce7;
  color: #15803d;
}

.eco-cart-item__remove {
  align-self: start;
}

.eco-cart-item__remove-link {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280 !important;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}

.eco-cart-item__remove-link:hover {
  background: #fee2e2;
  color: #dc2626 !important;
}

/* Actions row (coupon + update) */
/* Auto-update handles cart updates, so the manual actions row (Update cart
 * button + nonce) is hidden. It stays in the DOM because cart.js submits the
 * form through that button and WooCommerce needs the nonce field. */
.eco-cart-actions {
  display: none;
}

.eco-cart-coupon {
  display: flex;
  flex: 1 1 260px;
  gap: 8px;
}

.eco-cart-coupon .input-text {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
}

.eco-cart-coupon__apply {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease;
}

.eco-cart-coupon__apply:hover {
  background: #0f766e;
}

.eco-cart-update {
  height: 40px;
  margin-left: auto;
  padding: 0 18px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

.eco-cart-update:hover {
  border-color: #0f766e;
  color: #0f766e;
}

/* ---------------------------------------------------------------------------
 * Right column — Order Summary (sticky)
 * ------------------------------------------------------------------------- */
.eco-cart__aside {
  position: sticky;
  top: 96px;
  min-width: 0;
}

.eco-order-summary {
  padding: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.eco-order-summary__title {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #111827;
}

.eco-order-summary__rows {
  display: grid;
  gap: 11px;
}

.eco-order-summary__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
}

.eco-order-summary__row span:last-child {
  font-weight: 800;
  color: #1f2937;
  text-align: right;
}

.eco-order-summary__row--discount span:last-child {
  color: #dc2626;
}

.eco-order-summary__freeship-badge {
  display: flex;
  justify-content: center;
  margin: 2px 0;
}

.eco-order-summary__freeship-badge span {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #059669;
  text-align: center;
}

.eco-order-summary__row--total {
  margin-top: 4px;
  padding-top: 13px;
  border-top: 1px solid #e5e7eb;
  font-size: 15px;
}

.eco-order-summary__row--total span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eco-order-summary__row--total strong {
  font-size: 20px;
  font-weight: 950;
  color: #111827;
}

.eco-order-summary__saved {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  background: #dff3e8;
  color: #16833a;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.eco-order-summary__note {
  margin: 12px 0 0;
  color: #9ca3af;
  font-size: 11px;
  line-height: 1.5;
}

/* Live "people checking out now" FOMO line */
.eco-order-summary__live {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 0;
  color: #f24e1e;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.eco-order-summary__live-dot {
  position: relative;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #f24e1e;
}

.eco-order-summary__live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #f24e1e;
  animation: eco-cart-pulse 1.6s ease-out infinite;
}

@keyframes eco-cart-pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .eco-order-summary__live-dot::after {
    animation: none;
  }
}

/* Checkout buttons (woocommerce_proceed_to_checkout hook output) */
.eco-order-summary__actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.eco-order-summary__actions .checkout-button,
.eco-order-summary__actions a.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: #1a86b0;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease;
}

.eco-order-summary__actions .checkout-button:hover,
.eco-order-summary__actions a.button:hover {
  background: #15749a;
}

.eco-checkout-button__icon {
  display: inline-flex;
  align-items: center;
  margin-top: -1px;
}

.eco-checkout-button__label {
  line-height: 1;
}

/* Express checkout (PayPal etc.) renders below proceed button */
.eco-order-summary__actions .woocommerce-button--express,
.eco-order-summary__actions .wc-proceed-to-checkout + * {
  margin-top: 2px;
}

.eco-order-summary__trust {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
}

.eco-order-summary__trust-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.eco-order-summary__trust-item span {
  font-size: 13px;
  line-height: 1;
}

.eco-order-summary__reassure {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 14px 0 0;
  color: #16833a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.eco-order-summary__lock {
  flex: 0 0 auto;
  font-size: 13px;
}

.eco-order-summary__help {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
}

.eco-order-summary__help-text {
  color: #6b7280;
  font-size: 12.5px;
  font-weight: 600;
}

.eco-order-summary__help-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1a86b0;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: color 160ms ease;
}

.eco-order-summary__help-link:hover {
  color: #15749a;
  text-decoration: underline;
}

.eco-order-summary__help-icon {
  display: inline-flex;
  align-items: center;
}

.eco-order-summary__secure {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
}

.eco-order-summary__secure-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #374151;
  font-size: 12.5px;
  font-weight: 800;
}

.eco-order-summary__secure-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.eco-order-summary__secure-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 24px;
  line-height: 0;
}

.eco-order-summary__secure-badge svg {
  width: 100%;
  height: 100%;
  display: block;
}

.eco-order-summary__secure-badge img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* ---------------------------------------------------------------------------
 * Full-width recommendations
 * ------------------------------------------------------------------------- */
.eco-cart-recommendations {
  width: var(--eco-cart-shell);
  margin: 8px auto 32px;
  padding: 0;
}

.eco-cart-recommendations__heading {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #111827;
}

.eco-cart-recommendations__foot {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.eco-cart-recommendations__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  height: 38px;
  padding: 0 16px;
  border: 1px solid #1a86b0;
  border-radius: 999px;
  background: #fff;
  color: #1a86b0;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease;
}

.eco-cart-recommendations__more:hover {
  background: #1a86b0;
  color: #fff;
}

.eco-cart-recommendations__more svg {
  flex: 0 0 auto;
}

.eco-cart-recommendations__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.eco-cart-rec-card {
  overflow: hidden;
  border: 1px solid #ececec;
  border-radius: 10px;
  background: #fff;
  transition: border-color 160ms ease;
}

.eco-cart-rec-card:hover {
  border-color: #d1d5db;
}

.eco-cart-rec-card__link {
  display: grid;
  gap: 8px;
  padding: 10px;
  color: inherit;
  text-decoration: none;
}

.eco-cart-rec-card__image {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: #f3f4f6;
  aspect-ratio: 1 / 1;
}

.eco-cart-rec-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eco-cart-rec-card__title {
  display: -webkit-box;
  overflow: hidden;
  color: #1f2937;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.eco-cart-rec-card__price {
  color: #16833a;
  font-size: 15px;
  font-weight: 900;
}

.eco-cart-rec-card__price del {
  margin-right: 5px;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 600;
}

.eco-cart-rec-card__price ins {
  text-decoration: none;
}

/* ---------------------------------------------------------------------------
 * Empty cart
 * ------------------------------------------------------------------------- */
.eco-cart-page .cart-empty,
.eco-cart-page .wc-empty-cart-message {
  max-width: 1536px;
  margin: 40px auto;
  padding: 0 16px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #4b5563;
}

.eco-cart-page .return-to-shop {
  max-width: 1536px;
  margin: 0 auto 40px;
  padding: 0 16px;
  text-align: center;
}

.eco-cart-page .return-to-shop .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff7a18, #f24e1e);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

/* ---------------------------------------------------------------------------
 * Responsive — single column at <= 1266px (matches site mobile breakpoint)
 * ------------------------------------------------------------------------- */
@media (max-width: 1266px) {
  body.eco-cart-page {
    --eco-cart-shell: min(100% - 40px, 1536px);
  }

  .eco-cart {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .eco-cart__aside {
    position: static;
  }

  .eco-cart-recommendations__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body.eco-cart-page {
    --eco-cart-shell: min(100% - 24px, 1536px);
  }

  .eco-cart {
    padding: 14px 0 8px;
  }

  .eco-cart-form__title {
    font-size: 19px;
  }

  /* Allow the trust badge beside the logo to wrap instead of overflowing. */
  .eco-cart-safebadge {
    white-space: normal;
    font-size: 12.5px;
  }

  .eco-cart-item {
    grid-template-columns: 76px minmax(0, 1fr) auto;
    gap: 11px;
    padding: 11px;
  }

  .eco-cart-item__thumb {
    width: 76px;
    height: 76px;
  }

  .eco-cart-item__body {
    min-width: 0;
  }

  .eco-cart-item__name {
    font-size: 13px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .eco-cart-recommendations {
    margin-bottom: 24px;
  }

  .eco-cart-recommendations__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
