/* ==========================================================================
   GCF Modern Checkout - cart page restyle
   Shares the checkout's tokens and design language. Brand colors arrive as
   CSS variables via wp_add_inline_style.
   Scoped to body.gcf-cart-restyle so nothing leaks to other pages, and written
   against standard WooCommerce cart classes so it works inside Divi's Woo Cart
   modules as well as the [woocommerce_cart] shortcode.
   ========================================================================== */

:root {
  --gcf-co-primary: #1a8a4b;
  --gcf-co-primary-dark: #136a37;
  --gcf-co-accent: #e8932a;
  --gcf-co-ink: #1f2933;
  --gcf-co-muted: #647084;
  --gcf-co-line: #dde3ea;
  --gcf-co-line-strong: #c7d0db;
  --gcf-co-surface: #ffffff;
  --gcf-co-tint: #f4f7f9;
  --gcf-co-radius: 12px;
  --gcf-co-radius-sm: 9px;
  --gcf-co-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .04);
}

body.gcf-cart input[type="checkbox"],
body.gcf-cart input[type="radio"] {
  accent-color: var(--gcf-co-primary);
}

/* ---- Cart table as a card ------------------------------------------------ */
body.gcf-cart-restyle .woocommerce table.shop_table.cart,
body.gcf-cart-restyle .woocommerce-cart-form table.shop_table {
  border: 1px solid var(--gcf-co-line) !important;
  border-radius: var(--gcf-co-radius) !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: var(--gcf-co-surface);
  box-shadow: var(--gcf-co-shadow);
  overflow: hidden;
  margin-bottom: 26px;
  width: 100%;
}

body.gcf-cart-restyle table.shop_table.cart thead th {
  background: var(--gcf-co-tint);
  color: var(--gcf-co-muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--gcf-co-line);
}

body.gcf-cart-restyle table.shop_table.cart td {
  padding: 18px;
  border: 0;
  border-bottom: 1px solid var(--gcf-co-line);
  vertical-align: middle;
  background: transparent;
}
body.gcf-cart-restyle table.shop_table.cart tr.cart_item:last-of-type td {
  border-bottom: 1px solid var(--gcf-co-line);
}

/* Product thumbnail */
body.gcf-cart-restyle table.shop_table.cart td.product-thumbnail {
  width: 92px;
  padding-right: 4px;
}
body.gcf-cart-restyle table.shop_table.cart td.product-thumbnail img {
  width: 72px;
  height: 72px;
  max-width: none;
  object-fit: cover;
  border: 1px solid var(--gcf-co-line);
  border-radius: var(--gcf-co-radius-sm);
  background: #fff;
  display: block;
}

/* Product name + the option meta underneath it */
body.gcf-cart-restyle td.product-name a {
  color: var(--gcf-co-ink) !important;
  font-weight: 700;
  font-size: 1.04rem;
  text-decoration: none;
  line-height: 1.35;
}
body.gcf-cart-restyle td.product-name a:hover {
  color: var(--gcf-co-primary-dark) !important;
}
body.gcf-cart-restyle td.product-name dl.variation,
body.gcf-cart-restyle td.product-name .wapf-cart-meta,
body.gcf-cart-restyle td.product-name ul.wapf-item-meta {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: var(--gcf-co-tint);
  border-radius: var(--gcf-co-radius-sm);
  font-size: .86rem;
  line-height: 1.5;
  color: var(--gcf-co-muted);
  list-style: none;
}
body.gcf-cart-restyle td.product-name dl.variation dt,
body.gcf-cart-restyle td.product-name dl.variation dd {
  display: inline;
  margin: 0;
  padding: 0;
  font-size: .86rem;
}
body.gcf-cart-restyle td.product-name dl.variation dt {
  font-weight: 700;
  color: var(--gcf-co-ink);
}
body.gcf-cart-restyle td.product-name dl.variation dd {
  margin-right: 0;
}
body.gcf-cart-restyle td.product-name dl.variation dd::after {
  content: "";
  display: block;
  height: 3px;
}
body.gcf-cart-restyle td.product-name dl.variation p,
body.gcf-cart-restyle td.product-name dl.variation dd p {
  margin: 0;
  display: inline;
}

/* Price + subtotal cells */
body.gcf-cart-restyle td.product-price,
body.gcf-cart-restyle td.product-subtotal {
  font-size: 1rem;
  color: var(--gcf-co-ink);
  white-space: nowrap;
}
body.gcf-cart-restyle td.product-subtotal {
  font-weight: 700;
}

/* Quantity field, matched to the checkout inputs */
body.gcf-cart-restyle td.product-quantity .quantity input.qty,
body.gcf-cart-restyle .quantity input.qty {
  width: 76px;
  min-height: 44px;
  padding: 10px 8px !important;
  text-align: center;
  background: #fff !important;
  color: var(--gcf-co-ink) !important;
  border: 1px solid var(--gcf-co-line-strong) !important;
  border-radius: var(--gcf-co-radius-sm) !important;
  font-size: 1rem;
  box-shadow: none !important;
  transition: border-color .15s ease, box-shadow .15s ease;
}
body.gcf-cart-restyle .quantity input.qty:focus {
  border-color: var(--gcf-co-primary) !important;
  box-shadow: 0 0 0 3px rgba(26, 138, 75, .18) !important;
  outline: none;
}

/* Remove link as a quiet circular button */
body.gcf-cart-restyle td.product-remove {
  width: 54px;
}
body.gcf-cart-restyle td.product-remove a.remove {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gcf-co-tint) !important;
  color: var(--gcf-co-muted) !important;
  font-size: 18px !important;
  line-height: 1 !important;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
body.gcf-cart-restyle td.product-remove a.remove:hover {
  background: #fde8e8 !important;
  color: #b32d2e !important;
}

/* ---- Coupon + update row ------------------------------------------------- */
body.gcf-cart-restyle table.shop_table.cart td.actions {
  padding: 18px;
  background: var(--gcf-co-tint);
  border-bottom: 0;
}
body.gcf-cart-restyle td.actions .coupon {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
body.gcf-cart-restyle td.actions .coupon label {
  display: none;
}
body.gcf-cart-restyle td.actions .coupon input#coupon_code,
body.gcf-cart-restyle td.actions input.input-text {
  width: auto;
  min-width: 190px;
  min-height: 46px;
  padding: 12px 14px !important;
  background: #fff !important;
  color: var(--gcf-co-ink) !important;
  border: 1px solid var(--gcf-co-line-strong) !important;
  border-radius: var(--gcf-co-radius-sm) !important;
  font-size: .98rem;
  box-shadow: none !important;
}
body.gcf-cart-restyle td.actions .coupon input#coupon_code:focus {
  border-color: var(--gcf-co-primary) !important;
  box-shadow: 0 0 0 3px rgba(26, 138, 75, .18) !important;
  outline: none;
}

/* Secondary buttons: apply coupon, update cart, share cart, shipping calc */
body.gcf-cart-restyle .woocommerce-cart-form .button,
body.gcf-cart-restyle td.actions .button,
body.gcf-cart-restyle .cart-collaterals .button:not(.checkout-button) {
  background: #fff !important;
  color: var(--gcf-co-primary-dark) !important;
  border: 1.5px solid var(--gcf-co-line-strong) !important;
  border-radius: var(--gcf-co-radius-sm) !important;
  padding: 13px 20px !important;
  font-size: .96rem !important;
  font-weight: 700 !important;
  text-transform: none !important;
  min-height: 46px;
  line-height: 1.2 !important;
  cursor: pointer;
  box-shadow: none !important;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
body.gcf-cart-restyle .woocommerce-cart-form .button:hover,
body.gcf-cart-restyle td.actions .button:hover,
body.gcf-cart-restyle .cart-collaterals .button:not(.checkout-button):hover {
  border-color: var(--gcf-co-primary) !important;
  background: #f6fbf7 !important;
  color: var(--gcf-co-primary-dark) !important;
}
body.gcf-cart-restyle td.actions .button[disabled],
body.gcf-cart-restyle td.actions .button:disabled {
  opacity: .5;
  cursor: not-allowed;
}
/* Apply coupon reads as the accent action in that row */
body.gcf-cart-restyle td.actions .coupon .button {
  border-color: var(--gcf-co-accent) !important;
  color: #8a5406 !important;
}
body.gcf-cart-restyle td.actions .coupon .button:hover {
  background: #fff8ee !important;
  border-color: var(--gcf-co-accent) !important;
}

/* ---- Cart totals card ---------------------------------------------------- */
body.gcf-cart-restyle .cart_totals {
  background: var(--gcf-co-surface);
  border: 1px solid var(--gcf-co-line);
  border-radius: var(--gcf-co-radius);
  box-shadow: var(--gcf-co-shadow);
  padding: 22px;
}
body.gcf-cart-restyle .cart_totals > h2,
body.gcf-cart-restyle .cart-collaterals h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--gcf-co-ink);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gcf-co-line);
}
body.gcf-cart-restyle .cart_totals table.shop_table {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent;
  margin: 0;
  width: 100%;
}
body.gcf-cart-restyle .cart_totals table.shop_table th,
body.gcf-cart-restyle .cart_totals table.shop_table td {
  padding: 13px 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--gcf-co-line) !important;
  background: transparent !important;
  font-size: 1rem;
  vertical-align: top;
}
body.gcf-cart-restyle .cart_totals table.shop_table th {
  color: var(--gcf-co-muted);
  font-weight: 600;
  width: 45%;
}
body.gcf-cart-restyle .cart_totals table.shop_table td {
  text-align: right;
  color: var(--gcf-co-ink);
}
body.gcf-cart-restyle .cart_totals tr.order-total th,
body.gcf-cart-restyle .cart_totals tr.order-total td {
  border-bottom: 0 !important;
  padding-top: 16px !important;
  font-size: 1.2rem;
}
body.gcf-cart-restyle .cart_totals tr.order-total th {
  color: var(--gcf-co-ink);
  font-weight: 800;
}
body.gcf-cart-restyle .cart_totals tr.order-total .amount {
  color: var(--gcf-co-primary-dark);
  font-weight: 800;
}
body.gcf-cart-restyle .cart_totals .woocommerce-shipping-destination,
body.gcf-cart-restyle .cart_totals .wc-proceed-to-checkout + p,
body.gcf-cart-restyle .cart_totals small {
  font-size: .86rem;
  color: var(--gcf-co-muted);
}

/* Shipping calculator */
body.gcf-cart-restyle .shipping-calculator-button {
  color: var(--gcf-co-primary-dark) !important;
  font-weight: 600;
  text-decoration: underline;
}
body.gcf-cart-restyle .shipping-calculator-form {
  margin-top: 12px;
}
body.gcf-cart-restyle .shipping-calculator-form .input-text,
body.gcf-cart-restyle .shipping-calculator-form select,
body.gcf-cart-restyle .shipping-calculator-form .select2-container .select2-selection {
  width: 100%;
  min-height: 44px;
  padding: 11px 13px !important;
  background: #fff !important;
  border: 1px solid var(--gcf-co-line-strong) !important;
  border-radius: var(--gcf-co-radius-sm) !important;
  box-shadow: none !important;
  font-size: .96rem;
}
body.gcf-cart-restyle ul#shipping_method li {
  padding: 8px 0;
  font-size: .96rem;
}

/* Proceed to checkout: the one primary action, matched to Place order */
body.gcf-cart-restyle .wc-proceed-to-checkout {
  padding: 4px 0 0;
}
body.gcf-cart-restyle .wc-proceed-to-checkout a.checkout-button,
body.gcf-cart-restyle a.checkout-button.button {
  display: block;
  width: 100%;
  background: var(--gcf-co-primary) !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: var(--gcf-co-radius-sm) !important;
  padding: 16px 24px !important;
  font-size: 1.08rem !important;
  font-weight: 800 !important;
  text-transform: none !important;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(26, 138, 75, .25);
  transition: background .15s ease, transform .05s ease, box-shadow .15s ease;
  margin: 10px 0 0;
}
body.gcf-cart-restyle .wc-proceed-to-checkout a.checkout-button:hover {
  background: var(--gcf-co-primary-dark) !important;
  color: #fff !important;
  box-shadow: 0 8px 22px rgba(26, 138, 75, .32);
}
body.gcf-cart-restyle .wc-proceed-to-checkout a.checkout-button:active {
  transform: translateY(1px);
}

/* ---- Notices ------------------------------------------------------------- */
body.gcf-cart-restyle .woocommerce-message,
body.gcf-cart-restyle .woocommerce-info,
body.gcf-cart-restyle .woocommerce-error {
  background: var(--gcf-co-tint) !important;
  color: var(--gcf-co-ink) !important;
  border: 1px solid var(--gcf-co-line) !important;
  border-left: 4px solid var(--gcf-co-primary) !important;
  border-radius: var(--gcf-co-radius-sm) !important;
  padding: 13px 18px !important;
  font-size: .95rem;
  box-shadow: none !important;
}
body.gcf-cart-restyle .woocommerce-error {
  border-left-color: #b32d2e !important;
}
body.gcf-cart-restyle .woocommerce-message::before,
body.gcf-cart-restyle .woocommerce-info::before,
body.gcf-cart-restyle .woocommerce-error::before {
  display: none !important;
}
body.gcf-cart-restyle .woocommerce-message .button {
  margin-right: 10px;
}

/* ---- Cross sells --------------------------------------------------------- */
body.gcf-cart-restyle .cross-sells h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gcf-co-ink);
  margin-bottom: 14px;
}

/* ---- Responsive: stack each row into a card ------------------------------ */
@media (max-width: 768px) {
  body.gcf-cart-restyle table.shop_table.cart thead {
    display: none;
  }
  body.gcf-cart-restyle table.shop_table.cart,
  body.gcf-cart-restyle table.shop_table.cart tbody,
  body.gcf-cart-restyle table.shop_table.cart tr,
  body.gcf-cart-restyle table.shop_table.cart td {
    display: block;
    width: 100%;
  }
  body.gcf-cart-restyle table.shop_table.cart tr.cart_item {
    position: relative;
    border-bottom: 1px solid var(--gcf-co-line);
    padding: 8px 0 12px;
  }
  body.gcf-cart-restyle table.shop_table.cart tr.cart_item td {
    border-bottom: 0;
    padding: 6px 18px;
  }
  /* Label each stacked cell using WooCommerce's data-title attribute. */
  body.gcf-cart-restyle table.shop_table.cart td.product-price::before,
  body.gcf-cart-restyle table.shop_table.cart td.product-quantity::before,
  body.gcf-cart-restyle table.shop_table.cart td.product-subtotal::before {
    content: attr(data-title);
    display: inline-block;
    min-width: 92px;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gcf-co-muted);
  }
  body.gcf-cart-restyle table.shop_table.cart td.product-thumbnail {
    width: auto;
    padding-bottom: 0;
  }
  body.gcf-cart-restyle table.shop_table.cart td.product-thumbnail img {
    width: 84px;
    height: 84px;
  }
  body.gcf-cart-restyle table.shop_table.cart td.product-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto;
    padding: 0;
  }
  body.gcf-cart-restyle table.shop_table.cart td.actions {
    padding: 16px 18px;
  }
  body.gcf-cart-restyle td.actions .coupon input#coupon_code,
  body.gcf-cart-restyle td.actions .coupon .button,
  body.gcf-cart-restyle .woocommerce-cart-form .button {
    width: 100%;
    min-width: 0;
  }
  body.gcf-cart-restyle .cart_totals {
    padding: 16px;
  }
}

/* ---- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  body.gcf-cart-restyle * {
    transition: none !important;
  }
}
