/**
 * Elite Diesel Dynamics v4.1.4
 * Checkout/cart layout polish while leaving PayPal hosted card fields native.
 * Do not target #ppcp-card-name, #ppcp-card-number, #ppcp-card-exp, #ppcp-card-cvv,
 * or their iframes here. Those secure fields must be owned by the PayPal plugin.
 */

/* ---------- Page container ---------- */
body.woocommerce-cart .edd-woo-main > .edd-container,
body.woocommerce-checkout .edd-woo-main > .edd-container,
body.woocommerce-cart .edd-container,
body.woocommerce-checkout .edd-container {
  max-width: 1320px !important;
  width: min(1320px, calc(100% - 40px)) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  overflow: visible !important;
}

body.woocommerce-checkout .woocommerce,
body.woocommerce-cart .woocommerce {
  width: 100% !important;
  overflow: visible !important;
}

/* ---------- Cart actions ---------- */
body.woocommerce-cart .woocommerce-cart-form .actions,
body.woocommerce-cart table.shop_table td.actions {
  display: grid !important;
  grid-template-columns: minmax(260px, 1fr) auto !important;
  align-items: center !important;
  gap: 12px !important;
}

body.woocommerce-cart .woocommerce-cart-form .actions .coupon {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  float: none !important;
  margin: 0 !important;
}

body.woocommerce-cart .woocommerce-cart-form .actions .coupon input.input-text,
body.woocommerce-cart .woocommerce-cart-form .actions .coupon input[name="coupon_code"] {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 180px !important;
  height: 46px !important;
  padding: 0 14px !important;
  border: 1px solid #d9e0ea !important;
  border-radius: 10px !important;
  font-size: 15px !important;
  box-sizing: border-box !important;
}

body.woocommerce-cart .woocommerce-cart-form .actions .button,
body.woocommerce-cart .woocommerce-cart-form .actions button,
body.woocommerce-cart .woocommerce-cart-form .actions input[type="submit"] {
  width: auto !important;
  min-width: 136px !important;
  height: 46px !important;
  min-height: 46px !important;
  padding: 0 18px !important;
  margin: 0 !important;
  border-radius: 12px !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

/* ---------- Checkout layout ---------- */
body.woocommerce-checkout .woocommerce form.checkout {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 500px) !important;
  gap: clamp(28px, 3.2vw, 46px) !important;
  align-items: start !important;
  max-width: 1320px !important;
  margin: 0 auto !important;
  overflow: visible !important;
}

body.woocommerce-checkout #customer_details {
  grid-column: 1 !important;
  grid-row: 1 / span 3 !important;
  display: block !important;
  min-width: 0 !important;
  width: 100% !important;
}

body.woocommerce-checkout #order_review_heading,
body.woocommerce-checkout #order_review {
  grid-column: 2 !important;
  min-width: 0 !important;
  width: 100% !important;
}

body.woocommerce-checkout #order_review_heading {
  grid-row: 1 !important;
  align-self: end !important;
  margin: 0 0 14px !important;
  padding: 0 !important;
  font-size: 24px !important;
  line-height: 1.15 !important;
}

body.woocommerce-checkout #order_review {
  grid-row: 2 !important;
}

/* Force billing/shipping to stack in the left column instead of creating three skinny columns. */
body.woocommerce-checkout #customer_details .col-1,
body.woocommerce-checkout #customer_details .col-2,
body.woocommerce-checkout .woocommerce-billing-fields,
body.woocommerce-checkout .woocommerce-shipping-fields,
body.woocommerce-checkout .woocommerce-additional-fields {
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
  clear: both !important;
  box-sizing: border-box !important;
}

body.woocommerce-checkout #customer_details .col-2,
body.woocommerce-checkout .woocommerce-additional-fields {
  margin-top: 20px !important;
}

body.woocommerce-checkout .woocommerce-billing-fields,
body.woocommerce-checkout .woocommerce-shipping-fields,
body.woocommerce-checkout .woocommerce-additional-fields,
body.woocommerce-checkout #order_review {
  background: #fff !important;
  border: 1px solid #e4eaf2 !important;
  border-radius: 18px !important;
  padding: clamp(20px, 2.2vw, 28px) !important;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .06) !important;
  overflow: visible !important;
}

body.woocommerce-checkout .woocommerce-billing-fields > h3,
body.woocommerce-checkout .woocommerce-shipping-fields > h3,
body.woocommerce-checkout .woocommerce-additional-fields > h3 {
  margin: 0 0 18px !important;
  font-size: 22px !important;
  line-height: 1.15 !important;
  color: #111820 !important;
}

/* Field rows */
body.woocommerce-checkout form .form-row,
body.woocommerce-checkout .woocommerce form .form-row {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
  clear: both !important;
  margin: 0 0 14px !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

body.woocommerce-checkout form .form-row-first,
body.woocommerce-checkout form .form-row-last {
  width: 100% !important;
  float: none !important;
}

body.woocommerce-checkout .woocommerce form .form-row label,
body.woocommerce-cart .woocommerce form .form-row label {
  display: block !important;
  margin: 0 0 7px !important;
  color: #111820 !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
  letter-spacing: .02em !important;
  text-transform: uppercase !important;
}

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

body.woocommerce-checkout .woocommerce input.input-text,
body.woocommerce-checkout .woocommerce textarea,
body.woocommerce-checkout .woocommerce select,
body.woocommerce-checkout .select2-container .select2-selection--single {
  min-height: 48px !important;
  padding: 12px 14px !important;
  border: 1px solid #d8e0ea !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #111820 !important;
  font-size: 16px !important;
  line-height: 1.35 !important;
  box-shadow: none !important;
}

body.woocommerce-checkout .select2-container .select2-selection--single {
  display: flex !important;
  align-items: center !important;
}

body.woocommerce-checkout .woocommerce textarea {
  min-height: 94px !important;
  resize: vertical !important;
}

/* ---------- Order review/card ---------- */
body.woocommerce-checkout #order_review table.shop_table {
  width: 100% !important;
  border: 0 !important;
  margin: 0 0 20px !important;
  border-collapse: collapse !important;
  background: transparent !important;
}

body.woocommerce-checkout #order_review table.shop_table th,
body.woocommerce-checkout #order_review table.shop_table td {
  border: 0 !important;
  border-bottom: 1px solid #e8edf4 !important;
  padding: 14px 0 !important;
  vertical-align: top !important;
  font-size: 15px !important;
  line-height: 1.35 !important;
}

body.woocommerce-checkout #order_review table.shop_table th:last-child,
body.woocommerce-checkout #order_review table.shop_table td:last-child {
  text-align: right !important;
  padding-left: 16px !important;
}

body.woocommerce-checkout #order_review table.shop_table tfoot tr:last-child th,
body.woocommerce-checkout #order_review table.shop_table tfoot tr:last-child td {
  border-bottom: 0 !important;
  font-size: 20px !important;
  font-weight: 900 !important;
}

/* Shipping methods: no bullets, clean radio list. */
body.woocommerce-checkout #shipping_method,
body.woocommerce-cart #shipping_method {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
}

body.woocommerce-checkout #shipping_method li,
body.woocommerce-cart #shipping_method li {
  display: grid !important;
  grid-template-columns: 18px 1fr !important;
  gap: 8px !important;
  align-items: start !important;
  margin: 0 0 9px !important;
  padding: 0 !important;
  list-style: none !important;
}

body.woocommerce-checkout #shipping_method input,
body.woocommerce-cart #shipping_method input {
  margin: 3px 0 0 !important;
}

body.woocommerce-checkout #shipping_method label,
body.woocommerce-cart #shipping_method label {
  margin: 0 !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
  font-weight: 700 !important;
  color: #111820 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

/* ---------- Payment shell only; PayPal hosted fields remain native ---------- */
body.woocommerce-checkout #payment,
body.woocommerce-checkout .woocommerce-checkout-payment {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
}

body.woocommerce-checkout ul.wc_payment_methods,
body.woocommerce-checkout .wc_payment_methods {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  list-style: none !important;
  overflow: visible !important;
}

body.woocommerce-checkout .wc_payment_method {
  list-style: none !important;
  margin: 0 0 14px !important;
  padding: 0 !important;
  overflow: visible !important;
  position: relative !important;
}

body.woocommerce-checkout .wc_payment_method > input[type="radio"] {
  position: relative !important;
  z-index: 5 !important;
  margin-right: 8px !important;
}

body.woocommerce-checkout .wc_payment_method > label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  flex-wrap: wrap !important;
  margin: 0 0 10px !important;
  color: #111820 !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  line-height: 1.25 !important;
}

body.woocommerce-checkout .wc_payment_method > label img,
body.woocommerce-checkout .payment_method_ppcp-credit-card img,
body.woocommerce-checkout .payment_method_ppcp_credit_card img {
  width: auto !important;
  max-width: 72px !important;
  max-height: 22px !important;
  object-fit: contain !important;
  vertical-align: middle !important;
}

body.woocommerce-checkout .payment_box {
  margin: 8px 0 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: visible !important;
  position: relative !important;
  pointer-events: auto !important;
}

body.woocommerce-checkout .payment_box::before,
body.woocommerce-checkout .payment_box::after {
  display: none !important;
  content: none !important;
}

/* Absolutely no #ppcp-card-* host/iframe sizing here. Keep clicks native. */
body.woocommerce-checkout .wc-ppcp_card-payment-method__container {
  position: relative !important;
  z-index: 20 !important;
  overflow: visible !important;
  pointer-events: auto !important;
}

/* Terms and place order */
body.woocommerce-checkout .woocommerce-privacy-policy-text {
  margin: 18px 0 12px !important;
  font-size: 14px !important;
  line-height: 1.45 !important;
  color: #2c3440 !important;
}

body.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper {
  margin-top: 16px !important;
}

body.woocommerce-checkout #place_order {
  width: 100% !important;
  min-height: 56px !important;
  border-radius: 14px !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  letter-spacing: .04em !important;
  margin-top: 14px !important;
}

/* Product card brand marker: text pill only, never a giant logo/image. */
.woocommerce ul.products li.product .edd-product-brand-patch,
.edd-product-brand-patch {
  display: inline-flex !important;
  align-items: center !important;
  width: max-content !important;
  max-width: 100% !important;
  margin: 0 0 10px !important;
  padding: 5px 9px !important;
  border-radius: 999px !important;
  background: #fff5f5 !important;
  border: 1px solid rgba(223,20,20,.22) !important;
  color: #c41212 !important;
  font-size: 10px !important;
  line-height: 1 !important;
  font-weight: 1000 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
}

/* ---------- Responsive ---------- */
@media (min-width: 1101px) {
  body.woocommerce-checkout #order_review {
    position: sticky !important;
    top: 110px !important;
  }
}

@media (max-width: 1100px) {
  body.woocommerce-checkout .woocommerce form.checkout {
    grid-template-columns: 1fr !important;
  }
  body.woocommerce-checkout #customer_details,
  body.woocommerce-checkout #order_review_heading,
  body.woocommerce-checkout #order_review {
    grid-column: 1 !important;
    grid-row: auto !important;
  }
  body.woocommerce-checkout #order_review_heading {
    margin-top: 26px !important;
  }
}

@media (max-width: 700px) {
  body.woocommerce-cart .edd-woo-main > .edd-container,
  body.woocommerce-checkout .edd-woo-main > .edd-container,
  body.woocommerce-cart .edd-container,
  body.woocommerce-checkout .edd-container {
    width: min(100% - 24px, 1320px) !important;
  }

  body.woocommerce-cart .woocommerce-cart-form .actions,
  body.woocommerce-cart table.shop_table td.actions,
  body.woocommerce-cart .woocommerce-cart-form .actions .coupon {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }

  body.woocommerce-cart .woocommerce-cart-form .actions .coupon input.input-text,
  body.woocommerce-cart .woocommerce-cart-form .actions .coupon input[name="coupon_code"],
  body.woocommerce-cart .woocommerce-cart-form .actions .button,
  body.woocommerce-cart .woocommerce-cart-form .actions button,
  body.woocommerce-cart .woocommerce-cart-form .actions input[type="submit"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.woocommerce-checkout .woocommerce-billing-fields,
  body.woocommerce-checkout .woocommerce-shipping-fields,
  body.woocommerce-checkout .woocommerce-additional-fields,
  body.woocommerce-checkout #order_review {
    padding: 18px !important;
    border-radius: 16px !important;
  }

  body.woocommerce-checkout #order_review table.shop_table th,
  body.woocommerce-checkout #order_review table.shop_table td {
    font-size: 14px !important;
  }
}


/* v4.1.5 checkout total sync visual state */
body.woocommerce-checkout #place_order.edd-checkout-syncing {
  opacity: .72 !important;
  cursor: wait !important;
}


/* v4.2.9: PayPal/card hosted fields click fix.
   Do not force iframe dimensions or absolute positioning. The payment plugin owns
   the secure fields; the theme only keeps wrappers visible/clickable. */
body.woocommerce-checkout #payment,
body.woocommerce-checkout .woocommerce-checkout-payment,
body.woocommerce-checkout .wc_payment_methods,
body.woocommerce-checkout .wc_payment_method,
body.woocommerce-checkout .payment_box,
body.woocommerce-checkout .payment_method_ppcp-credit-card,
body.woocommerce-checkout .payment_method_ppcp_credit_card,
body.woocommerce-checkout .wc-ppcp_card-payment-method__container,
body.woocommerce-checkout .ppcp-card-fields--container,
body.woocommerce-checkout .ppcp-card-field--container,
body.woocommerce-checkout #ppcp-card-name,
body.woocommerce-checkout #ppcp-card-number,
body.woocommerce-checkout #ppcp-card-exp,
body.woocommerce-checkout #ppcp-card-cvv {
  pointer-events: auto !important;
  overflow: visible !important;
}

body.woocommerce-checkout #payment iframe,
body.woocommerce-checkout .woocommerce-checkout-payment iframe,
body.woocommerce-checkout .payment_box iframe {
  pointer-events: auto !important;
}

body.woocommerce-checkout #payment *::before,
body.woocommerce-checkout #payment *::after {
  pointer-events: none !important;
}

body.woocommerce-checkout .woocommerce-privacy-policy-text,
body.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper,
body.woocommerce-checkout #place_order {
  position: relative !important;
  z-index: 1 !important;
}

body.woocommerce-checkout .wc-ppcp_card-payment-method__container,
body.woocommerce-checkout .payment_method_ppcp-credit-card .payment_box,
body.woocommerce-checkout .payment_method_ppcp_credit_card .payment_box {
  position: relative !important;
  z-index: 5 !important;
}
