/**
 * Cart + checkout layout — loads last on WC utility pages.
 * Forces full-width stack so coupon / totals / CTA match the cart table.
 */

/* ---- Shared full-width column ---- */
html body.woocommerce-cart #main .woocommerce,
html body.woocommerce-checkout #main .woocommerce,
html body.woocommerce-cart .block-content > .woocommerce,
html body.woocommerce-checkout .block-content > .woocommerce {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

html body.woocommerce-cart .woocommerce-cart-form,
html body.woocommerce-cart .woocommerce-cart-form .shop_table,
html body.woocommerce-cart .cart-collaterals,
html body.woocommerce-cart .cart_totals,
html body.woocommerce-cart .cart-collaterals .cart_totals,
html body.woocommerce-cart:not(.woocommerce-cart-layout-modern) .cart_totals,
html body.woocommerce-page.woocommerce-cart .cart_totals,
html body.woocommerce-cart .wc-proceed-to-checkout {
  width: 100% !important;
  max-width: 100% !important;
  flex-basis: 100% !important;
  float: none !important;
  clear: both !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}

html body.woocommerce-cart .cart_totals {
  margin-top: 20px !important;
}

html body.woocommerce-cart .cart_totals > h2 {
  text-align: right !important;
  margin: 0 0 14px !important;
}

html body.woocommerce-cart .cart_totals table,
html body.woocommerce-cart .cart_totals table.shop_table {
  width: 100% !important;
}

/* Cart totals — right-side labels (جمع جزء / ارسال / مالیات / مجموع) */
html body.woocommerce-cart .cart_totals > h2,
html body.woocommerce-cart .cart_totals .cart-totals-title {
  color: #0a0a0a !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  text-align: right !important;
  margin: 0 0 16px !important;
}

html body.woocommerce-cart .cart_totals table th,
html body.woocommerce-cart .cart_totals table.shop_table th,
html body.woocommerce-cart .cart_totals table tr.cart-subtotal th,
html body.woocommerce-cart .cart_totals table tr.shipping th,
html body.woocommerce-cart .cart_totals table tr.woocommerce-shipping-totals th,
html body.woocommerce-cart .cart_totals table tr.tax-total th,
html body.woocommerce-cart .cart_totals table tr.order-total th {
  color: #0a0a0a !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.55 !important;
  text-align: right !important;
  vertical-align: middle !important;
  padding: 14px 16px !important;
  white-space: nowrap !important;
  opacity: 1 !important;
  visibility: visible !important;
}

html body.woocommerce-cart .cart_totals table tr.shipping th,
html body.woocommerce-cart .cart_totals table tr.woocommerce-shipping-totals th {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #0a0a0a !important;
  vertical-align: top !important;
  padding-top: 16px !important;
}

html body.woocommerce-cart .cart_totals table tr.order-total th {
  font-size: 16px !important;
  font-weight: 700 !important;
}

html body.woocommerce-cart .cart_totals table td,
html body.woocommerce-cart .cart_totals table.shop_table td {
  color: #0a0a0a !important;
  font-size: 14px !important;
  line-height: 1.55 !important;
  text-align: left !important;
  vertical-align: middle !important;
  padding: 14px 16px !important;
}

html body.woocommerce-cart .cart_totals table tr.order-total td,
html body.woocommerce-cart .cart_totals table tr.order-total td strong,
html body.woocommerce-cart .cart_totals table tr.order-total .amount {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #0a0a0a !important;
}

html body.woocommerce-cart .cart_totals .woocommerce-shipping-destination {
  color: #667788 !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
}

/* ---- Coupon: one full-width row ---- */
html body.woocommerce-cart .woocommerce-cart-form td.actions,
html body.woocommerce-cart .woocommerce-cart-form .actions,
html body.woocommerce-cart:not(.woocommerce-cart-layout-modern) .woocommerce-cart-form .actions,
html body.woocommerce-cart:not(.woocommerce-cart-layout-modern) table.shop_table_responsive td.actions {
  display: block !important;
  width: 100% !important;
  float: none !important;
  padding: 16px 0 !important;
  background: transparent !important;
}

html body.woocommerce-cart .woocommerce-cart-form .actions .coupon,
html body.woocommerce-cart .woocommerce-cart-form td.actions .coupon,
html body.woocommerce-cart:not(.woocommerce-cart-layout-modern) .woocommerce-cart-form .actions .coupon {
  float: none !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

html body.woocommerce-cart .woocommerce-cart-form .actions .coupon input,
html body.woocommerce-cart .woocommerce-cart-form .actions .coupon input.input-text,
html body.woocommerce-cart input#coupon_code,
html body.woocommerce-cart input[name="coupon_code"],
html body.woocommerce-cart input[type="text"].coupon-code {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  height: 48px !important;
  line-height: 48px !important;
  box-sizing: border-box !important;
}

html body.woocommerce-cart .woocommerce-cart-form .actions .coupon button,
html body.woocommerce-cart .woocommerce-cart-form .actions .coupon .button,
html body.woocommerce-cart .woocommerce-cart-form .actions .coupon .gem-button,
html body.woocommerce-cart .woocommerce-cart-form .actions .coupon .gem-button-container {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  height: 48px !important;
  white-space: nowrap !important;
}

html body.woocommerce-cart .woocommerce-cart-form .actions .submit-buttons {
  display: none !important;
}

/* ---- Product row ---- */
html body.woocommerce-cart table.shop_table {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

html body.woocommerce-cart table.shop_table th,
html body.woocommerce-cart table.shop_table td {
  box-sizing: border-box !important;
  vertical-align: middle !important;
}

html body.woocommerce-cart table.shop_table thead th {
  padding: 12px 10px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

html body.woocommerce-cart table.shop_table thead th.product-name,
html body.woocommerce-cart table.shop_table thead th.product-remove,
html body.woocommerce-cart table.shop_table thead th.product-thumbnail {
  text-align: right !important;
}

html body.woocommerce-cart table.shop_table tr,
html body.woocommerce-cart table.shop_table tr.cart_item {
  position: static !important;
}

html body.woocommerce-cart table.shop_table td.product-remove,
html body.woocommerce-cart table.shop_table th.product-remove {
  position: static !important;
  right: auto !important;
  top: auto !important;
  transform: none !important;
  width: 52px !important;
  max-width: 52px !important;
  padding: 16px 8px !important;
  text-align: center !important;
}

html body.woocommerce-cart table.shop_table td.product-thumbnail,
html body.woocommerce-cart table.shop_table th.product-thumbnail {
  width: 88px !important;
  max-width: 88px !important;
  padding: 16px 8px !important;
  text-align: center !important;
}

html body.woocommerce-cart table.shop_table td.product-thumbnail img {
  display: block !important;
  width: 72px !important;
  height: 72px !important;
  max-width: 72px !important;
  object-fit: cover !important;
  margin: 0 auto !important;
  border-radius: 4px;
}

html body.woocommerce-cart table.shop_table td.product-name,
html body.woocommerce-cart table.shop_table th.product-name {
  width: auto !important;
  min-width: 0 !important;
  padding: 16px 12px !important;
  text-align: right !important;
}

html body.woocommerce-cart table.shop_table td.product-name a {
  display: block !important;
  text-align: right !important;
  line-height: 1.55 !important;
  color: #0a0a0a !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  text-decoration: none !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

html body.woocommerce-cart table.shop_table td.product-price,
html body.woocommerce-cart table.shop_table th.product-price {
  width: 140px !important;
  max-width: 140px !important;
  padding: 16px 10px !important;
  text-align: center !important;
  white-space: nowrap !important;
  font-size: 14px !important;
}

html body.woocommerce-cart table.shop_table td.product-quantity,
html body.woocommerce-cart table.shop_table th.product-quantity {
  width: 110px !important;
  max-width: 110px !important;
  padding: 16px 10px !important;
  text-align: center !important;
}

html body.woocommerce-cart table.shop_table td.product-quantity .quantity,
html body.woocommerce-cart table.shop_table td.product-quantity input.qty {
  margin: 0 auto !important;
  float: none !important;
  display: inline-block !important;
  text-align: center !important;
}

html body.woocommerce-cart table.shop_table td.product-subtotal,
html body.woocommerce-cart table.shop_table th.product-subtotal {
  width: 140px !important;
  max-width: 140px !important;
  padding: 16px 10px !important;
  text-align: center !important;
  white-space: nowrap !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}

/* Added-to-cart notice */
html body.woocommerce-cart .woocommerce-message,
html body.woocommerce-cart .woocommerce-info,
html body .woocommerce-message {
  display: flex !important;
  align-items: flex-start !important;
  gap: 10px !important;
  padding: 14px 16px !important;
  margin: 0 0 20px !important;
  line-height: 1.6 !important;
  font-size: 14px !important;
  box-sizing: border-box !important;
}

/* Coupon actions row */
html body.woocommerce-cart .woocommerce-cart-form td.actions,
html body.woocommerce-cart .woocommerce-cart-form .actions {
  padding: 20px 0 !important;
}

html body.woocommerce-cart .woocommerce-cart-form .actions .coupon {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 520px !important;
  margin: 0 !important;
  float: none !important;
}

html body.woocommerce-cart .woocommerce-cart-form .actions .coupon .input-text,
html body.woocommerce-cart .woocommerce-cart-form .actions .coupon input#coupon_code {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  height: 48px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  box-sizing: border-box !important;
}

html body.woocommerce-cart .woocommerce-cart-form .actions .coupon .button,
html body.woocommerce-cart .woocommerce-cart-form .actions .coupon button {
  flex: 0 0 auto !important;
  height: 48px !important;
  margin: 0 !important;
  padding: 0 18px !important;
  white-space: nowrap !important;
  line-height: 48px !important;
}

/* ---- Shipping destination: never overlap «ارسال» ---- */
html body.woocommerce-cart .woocommerce-shipping-destination,
html body.woocommerce-checkout .woocommerce-shipping-destination,
html body .cart_totals .woocommerce-shipping-destination,
html body .woocommerce-shipping-destination {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 8px 0 0 !important;
  padding: 0 !important;
  float: none !important;
  clear: both !important;
  position: static !important;
  inset: auto !important;
  transform: none !important;
  white-space: normal !important;
  line-height: 1.45 !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  color: #667788 !important;
}

html body.woocommerce-cart .cart_totals table tr.shipping th,
html body.woocommerce-cart .cart_totals table tr.woocommerce-shipping-totals th,
html body.woocommerce-checkout .shop_table tr.shipping th,
html body.woocommerce-checkout .shop_table tr.woocommerce-shipping-totals th {
  vertical-align: top !important;
  white-space: normal !important;
  line-height: 1.5 !important;
  font-size: 14px !important;
}

html body.woocommerce-cart .cart_totals table tr.shipping td,
html body.woocommerce-cart .cart_totals table tr.woocommerce-shipping-totals td {
  vertical-align: top !important;
  white-space: normal !important;
}

/* ---- Checkout CTA ---- */
html body.woocommerce-cart .wc-proceed-to-checkout,
html body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
  display: flex !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

html body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
  align-items: center !important;
  justify-content: center !important;
  min-height: 52px !important;
  background: #0a0a0a !important;
  color: #fff !important;
  border: 2px solid #0a0a0a !important;
  border-radius: 4px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
}

/* ---- Checkout page ---- */
html body.woocommerce-checkout .col2-set,
html body.woocommerce-checkout #customer_details,
html body.woocommerce-checkout #order_review,
html body.woocommerce-checkout #order_review_heading,
html body.woocommerce-checkout .woocommerce-checkout-review-order,
html body.woocommerce-checkout #payment {
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
  box-sizing: border-box !important;
}

html body.woocommerce-checkout .col2-set .col-1,
html body.woocommerce-checkout .col2-set .col-2 {
  width: 100% !important;
  float: none !important;
  margin: 0 0 24px !important;
  padding: 0 !important;
}

html body.woocommerce-checkout .form-row {
  width: 100% !important;
  float: none !important;
  margin: 0 0 14px !important;
  padding: 0 !important;
}

html body.woocommerce-checkout .form-row input.input-text,
html body.woocommerce-checkout .form-row textarea,
html body.woocommerce-checkout .form-row select,
html body.woocommerce-checkout .select2-container {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

html body.woocommerce-checkout #place_order {
  width: 100% !important;
  min-height: 52px !important;
}

@media (max-width: 767px) {
  html body.woocommerce-cart .woocommerce-cart-form .actions .coupon {
    flex-direction: column !important;
    max-width: 100% !important;
  }

  html body.woocommerce-cart .woocommerce-cart-form .actions .coupon input,
  html body.woocommerce-cart .woocommerce-cart-form .actions .coupon button,
  html body.woocommerce-cart .woocommerce-cart-form .actions .coupon .gem-button,
  html body.woocommerce-cart .woocommerce-cart-form .actions .coupon .gem-button-container,
  html body.woocommerce-cart .woocommerce-cart-form .actions .coupon .input-text,
  html body.woocommerce-cart .woocommerce-cart-form .actions .coupon input#coupon_code {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Mobile cart: stacked cards, no broken desktop column alignment */
  html body.woocommerce-cart table.shop_table,
  html body.woocommerce-cart table.shop_table.shop_table_responsive {
    table-layout: auto !important;
  }

  html body.woocommerce-cart table.shop_table thead {
    display: none !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item {
    display: grid !important;
    grid-template-columns: 52px 72px 1fr !important;
    grid-template-areas:
      "remove thumb name"
      "price price price"
      "qty qty subtotal" !important;
    gap: 10px 12px !important;
    align-items: center !important;
    padding: 16px 8px !important;
    margin: 0 0 14px !important;
    border: 1px solid #e8e8e8 !important;
    border-radius: 6px !important;
    background: #fff !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
    border: 0 !important;
    text-align: right !important;
    white-space: normal !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td.product-remove {
    grid-area: remove !important;
    text-align: center !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td.product-thumbnail {
    grid-area: thumb !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td.product-thumbnail img {
    width: 72px !important;
    height: 72px !important;
    margin: 0 !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td.product-name {
    grid-area: name !important;
    text-align: right !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td.product-name::before {
    display: none !important;
    content: none !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td.product-price::before,
  html body.woocommerce-cart table.shop_table tr.cart_item td.product-quantity::before,
  html body.woocommerce-cart table.shop_table tr.cart_item td.product-subtotal::before {
    content: attr(data-title) !important;
    display: inline-block !important;
    margin-left: 8px !important;
    font-weight: 600 !important;
    color: #667788 !important;
    font-size: 12px !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td.product-price {
    grid-area: price !important;
    padding-top: 4px !important;
    border-top: 1px solid #f0f0f0 !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td.product-quantity {
    grid-area: qty !important;
    text-align: right !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td.product-subtotal {
    grid-area: subtotal !important;
    text-align: left !important;
    font-weight: 700 !important;
  }

  html body.woocommerce-cart table.shop_table tr.cart_item td.product-quantity .quantity,
  html body.woocommerce-cart table.shop_table tr.cart_item td.product-quantity input.qty {
    display: inline-flex !important;
    margin: 0 !important;
  }

  html body.woocommerce-cart table.shop_table td.actions {
    display: block !important;
    padding: 8px 0 16px !important;
    border: 0 !important;
  }

  /* Collapse empty shipping column + kill checkout vertical gap after billing */
  html body.woocommerce-checkout #customer_details .col-2,
  html body.woocommerce-checkout .woocommerce-shipping-fields,
  html body.woocommerce-checkout .woocommerce-additional-fields,
  html body.woocommerce-checkout .shipping_address,
  html body.woocommerce-checkout #ship-to-different-address {
    display: none !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
  }

  html body.woocommerce-checkout #customer_details,
  html body.woocommerce-checkout #customer_details .col-1,
  html body.woocommerce-checkout .col2-set,
  html body.woocommerce-checkout .woocommerce-billing-fields,
  html body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper {
    width: 100% !important;
    margin: 0 !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
  }

  html body.woocommerce-checkout #order_review_heading {
    margin: 12px 0 10px !important;
  }

  html body.woocommerce-checkout #order_review {
    margin-top: 0 !important;
  }

  html body.woocommerce-checkout .digit_cs-list:not(.dig-cc-visible) {
    display: none !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
  }

  /* ---- Order totals + payment: readable spacing on mobile ---- */
  html body.woocommerce-checkout #order_review,
  html body.woocommerce-checkout .woocommerce-checkout-review-order {
    padding: 0 4px 8px !important;
  }

  html body.woocommerce-checkout #order_review .shop_table,
  html body.woocommerce-checkout .woocommerce-checkout-review-order-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 6px !important;
  }

  html body.woocommerce-checkout #order_review .shop_table th,
  html body.woocommerce-checkout #order_review .shop_table td,
  html body.woocommerce-checkout .woocommerce-checkout-review-order-table th,
  html body.woocommerce-checkout .woocommerce-checkout-review-order-table td {
    padding: 12px 10px !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
    vertical-align: middle !important;
  }

  html body.woocommerce-checkout #order_review .shop_table tfoot th,
  html body.woocommerce-checkout #order_review .shop_table tfoot td {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
  }

  html body.woocommerce-checkout #order_review .shop_table .order-total th,
  html body.woocommerce-checkout #order_review .shop_table .order-total td {
    font-size: 16px !important;
    font-weight: 700 !important;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
  }

  html body.woocommerce-checkout #payment {
    margin-top: 20px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
  }

  html body.woocommerce-checkout #payment ul.payment_methods {
    list-style: none !important;
    margin: 0 0 20px !important;
    padding: 0 !important;
    border: 0 !important;
  }

  html body.woocommerce-checkout #payment ul.payment_methods::before,
  html body.woocommerce-checkout #payment ul.payment_methods::after,
  html body.woocommerce-checkout #payment ul.payment_methods li::before,
  html body.woocommerce-checkout #payment ul.payment_methods li::after {
    content: none !important;
    display: none !important;
  }

  html body.woocommerce-checkout #payment ul.payment_methods > li {
    list-style: none !important;
    margin: 0 0 18px !important;
    padding: 14px 14px !important;
    border: 1px solid #e6e6e6 !important;
    border-radius: 6px !important;
    background: #fff !important;
  }

  html body.woocommerce-checkout #payment ul.payment_methods > li > label {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.5 !important;
    cursor: pointer !important;
  }

  html body.woocommerce-checkout #payment ul.payment_methods > li > input[type="radio"] {
    margin: 0 0 0 8px !important;
    flex: 0 0 auto !important;
  }

  html body.woocommerce-checkout #payment .payment_box {
    margin: 12px 0 0 !important;
    padding: 14px 14px !important;
    background: #f4f4f4 !important;
    border: 0 !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
  }

  html body.woocommerce-checkout #payment .payment_box::before {
    display: none !important;
  }

  html body.woocommerce-checkout #payment .payment_box p,
  html body.woocommerce-checkout #payment .payment_box {
    font-size: 13px !important;
    line-height: 1.75 !important;
    color: #333 !important;
  }

  html body.woocommerce-checkout #payment .payment_box p {
    margin: 0 0 10px !important;
  }

  html body.woocommerce-checkout #payment .payment_box p:last-child {
    margin-bottom: 0 !important;
  }

  html body.woocommerce-checkout .woocommerce-privacy-policy-text,
  html body.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper {
    margin: 8px 0 20px !important;
    padding: 0 2px !important;
  }

  html body.woocommerce-checkout .woocommerce-privacy-policy-text p,
  html body.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper p {
    margin: 0 !important;
    font-size: 13px !important;
    line-height: 1.8 !important;
    color: #444 !important;
  }

  html body.woocommerce-checkout #payment .form-row.place-order,
  html body.woocommerce-checkout #payment div.form-row {
    margin: 0 !important;
    padding: 8px 0 4px !important;
  }

  html body.woocommerce-checkout #place_order,
  html body.woocommerce-checkout button#place_order {
    width: 100% !important;
    min-height: 54px !important;
    margin: 8px 0 12px !important;
    padding: 14px 16px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
  }
}
