/* TRMIIZ Arabizma Emergency Checkout Fix v1.0.1 */
:root{
  --trmiiz-purple:#442b57;
  --trmiiz-gold:#e4b60f;
  --trmiiz-text:#1f2937;
  --trmiiz-border:#e5e7eb;
}

/* Do not let legacy theme wrappers clip WooCommerce actions. */
.woocommerce,
.woocommerce-page,
.woocommerce .woocommerce-notices-wrapper,
.woocommerce form,
.woocommerce table,
.woocommerce #payment,
.woocommerce .cart_totals,
.woocommerce .woocommerce-checkout-review-order,
.wc-block-cart,
.wc-block-checkout{
  max-width:100%;
  box-sizing:border-box;
}

.woocommerce .cart-collaterals,
.woocommerce .cart_totals,
.woocommerce-checkout #order_review,
.woocommerce-checkout #payment,
.woocommerce-checkout .woocommerce-checkout-payment,
.wc-block-cart__submit,
.wc-block-checkout__actions{
  overflow:visible!important;
  visibility:visible!important;
  opacity:1!important;
}

/* Critical cart/checkout actions: theme CSS must not hide them. */
.woocommerce .wc-proceed-to-checkout,
.woocommerce .wc-proceed-to-checkout a.checkout-button,
.woocommerce a.checkout-button,
.woocommerce #payment .place-order,
.woocommerce #payment #place_order,
.woocommerce .woocommerce-mini-cart__buttons,
.woocommerce .woocommerce-mini-cart__buttons .button,
.wc-block-cart__submit,
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button,
.trmiiz-emergency-checkout-button,
.trmiiz-emergency-place-order{
  visibility:visible!important;
  opacity:1!important;
  pointer-events:auto!important;
}

.woocommerce .wc-proceed-to-checkout,
.woocommerce #payment .place-order,
.wc-block-cart__submit,
.wc-block-checkout__actions{
  display:block!important;
  width:100%!important;
  float:none!important;
  clear:both!important;
  position:relative!important;
  z-index:8!important;
}

.woocommerce .wc-proceed-to-checkout a.checkout-button,
.woocommerce a.checkout-button,
.woocommerce #payment #place_order,
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button,
.trmiiz-emergency-checkout-button,
.trmiiz-emergency-place-order{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  width:100%!important;
  max-width:none!important;
  min-height:52px!important;
  margin:12px 0 0!important;
  padding:13px 18px!important;
  border:0!important;
  border-radius:10px!important;
  background:var(--trmiiz-purple)!important;
  color:#fff!important;
  font-size:16px!important;
  font-weight:700!important;
  line-height:1.35!important;
  text-align:center!important;
  text-decoration:none!important;
  white-space:normal!important;
  box-shadow:none!important;
  position:relative!important;
  z-index:9!important;
}

.woocommerce .wc-proceed-to-checkout a.checkout-button:hover,
.woocommerce a.checkout-button:hover,
.woocommerce #payment #place_order:hover,
.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover,
.trmiiz-emergency-checkout-button:hover,
.trmiiz-emergency-place-order:hover{
  filter:brightness(.96);
  color:#fff!important;
}

/* Never defeat WooCommerce's actual disabled state. */
.woocommerce #place_order:disabled,
.woocommerce #place_order.disabled,
.wc-block-components-checkout-place-order-button:disabled,
.wc-block-cart__submit-button:disabled{
  opacity:.55!important;
  cursor:not-allowed!important;
  pointer-events:none!important;
}

/* Mini cart buttons remain usable on mobile. */
.woocommerce .woocommerce-mini-cart__buttons{
  display:grid!important;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.woocommerce .woocommerce-mini-cart__buttons .button{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-height:44px!important;
  margin:0!important;
  padding:10px 12px!important;
  border-radius:8px!important;
  line-height:1.3!important;
  white-space:normal!important;
}

/* Classic cart table: contain the table instead of letting it break the viewport. */
.woocommerce-cart form.woocommerce-cart-form{
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  -webkit-overflow-scrolling:touch;
}
.woocommerce-cart table.shop_table{
  width:100%!important;
  max-width:100%!important;
  table-layout:auto;
}
.woocommerce-cart .cart-collaterals,
.woocommerce-cart .cart_totals{
  width:100%!important;
  max-width:100%!important;
  float:none!important;
  clear:both!important;
}
.woocommerce-cart .cart_totals table{
  width:100%!important;
}

/* Checkout columns and review must not collapse off-screen. */
.woocommerce-checkout form.checkout,
.woocommerce-checkout .col2-set,
.woocommerce-checkout .col2-set .col-1,
.woocommerce-checkout .col2-set .col-2,
.woocommerce-checkout #order_review_heading,
.woocommerce-checkout #order_review,
.woocommerce-checkout #payment{
  max-width:100%!important;
  box-sizing:border-box!important;
}
.woocommerce-checkout .form-row,
.woocommerce-checkout .form-row-first,
.woocommerce-checkout .form-row-last{
  max-width:100%!important;
  box-sizing:border-box!important;
}
.woocommerce-checkout input.input-text,
.woocommerce-checkout textarea,
.woocommerce-checkout select,
.woocommerce-checkout .select2-container{
  max-width:100%!important;
  width:100%!important;
  box-sizing:border-box!important;
}
.woocommerce-checkout #payment ul.payment_methods{
  max-width:100%!important;
  overflow:visible!important;
}
.woocommerce-checkout #payment .payment_box{
  max-width:100%!important;
  box-sizing:border-box!important;
}

/* WooCommerce Blocks fallbacks. */
.wc-block-cart,
.wc-block-checkout{
  width:100%!important;
  overflow:visible!important;
}
.wc-block-components-sidebar-layout{
  align-items:start;
}
.wc-block-components-sidebar-layout .wc-block-components-main,
.wc-block-components-sidebar-layout .wc-block-components-sidebar{
  min-width:0!important;
}

/* Tablet — stack the critical purchase path earlier than many legacy themes do. */
@media (max-width:1024px){
  .woocommerce-cart .woocommerce,
  .woocommerce-checkout .woocommerce{
    width:100%!important;
    max-width:100%!important;
  }
  .woocommerce-checkout .col2-set .col-1,
  .woocommerce-checkout .col2-set .col-2,
  .woocommerce-checkout #order_review_heading,
  .woocommerce-checkout #order_review{
    width:100%!important;
    max-width:100%!important;
    float:none!important;
    clear:both!important;
    margin-left:0!important;
    margin-right:0!important;
  }
  .wc-block-components-sidebar-layout{
    display:block!important;
  }
  .wc-block-components-sidebar-layout .wc-block-components-main,
  .wc-block-components-sidebar-layout .wc-block-components-sidebar{
    width:100%!important;
    max-width:100%!important;
    margin:0!important;
  }
}

/* Phone — make all checkout actions thumb-friendly and keep mobile footer from covering them. */
@media (max-width:767px){
  body.woocommerce-cart,
  body.woocommerce-checkout{
    overflow-x:hidden!important;
    padding-bottom:max(96px, env(safe-area-inset-bottom))!important;
  }
  .woocommerce-cart .site-content,
  .woocommerce-checkout .site-content,
  .woocommerce-cart #main,
  .woocommerce-checkout #main,
  .woocommerce-cart .content-area,
  .woocommerce-checkout .content-area{
    max-width:100%!important;
    overflow:visible!important;
  }
  .woocommerce-cart table.shop_table{
    min-width:0!important;
  }
  .woocommerce-cart table.shop_table td,
  .woocommerce-cart table.shop_table th{
    max-width:100%;
  }
  .woocommerce-cart .coupon,
  .woocommerce-cart .actions,
  .woocommerce-cart .actions .button{
    width:100%!important;
    max-width:100%!important;
    box-sizing:border-box!important;
  }
  .woocommerce-cart .coupon{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
  }
  .woocommerce-cart .coupon input.input-text{
    width:100%!important;
    max-width:100%!important;
    margin:0!important;
  }
  .woocommerce .woocommerce-mini-cart__buttons{
    grid-template-columns:1fr;
  }
  .woocommerce-checkout #payment,
  .woocommerce-checkout .woocommerce-checkout-review-order-table,
  .woocommerce-checkout .woocommerce-billing-fields,
  .woocommerce-checkout .woocommerce-shipping-fields{
    width:100%!important;
    max-width:100%!important;
  }
  .woocommerce-checkout #payment #place_order,
  .woocommerce .wc-proceed-to-checkout a.checkout-button,
  .wc-block-cart__submit-button,
  .wc-block-components-checkout-place-order-button,
  .trmiiz-emergency-checkout-button,
  .trmiiz-emergency-place-order{
    min-height:54px!important;
    font-size:16px!important;
  }
}
