/* Cart fixes: mobile UI */
@media only screen and (max-width: 767px) {
  /* Fix scroll container */
  .woocommerce-cart .woocommerce-cart-form {
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
    position: relative;
  }

  .woocommerce-cart .cart-collaterals {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    padding-bottom: 120px;
  }

  .woocommerce-cart .show-mob{
    display: none;
  }

  .woocommerce-cart table.shop_table_responsive {
    border: 0;
    width: 100%;
    overflow-x: visible;
  }

  .woocommerce-cart table.shop_table_responsive tr.cart_item {
    display: block;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 10px;
    margin: 0 0 12px;
  }

  .woocommerce-cart table.shop_table_responsive tr.cart_item td {
    display: block;
    border: 0;
    padding: 6px 0;
  }

  .woocommerce-cart table.shop_table_responsive td.product-thumbnail {
    display: block;
    text-align: left;
    float: left;
    width: 80px;
    padding-right: 10px;
  }

  .woocommerce-cart table.shop_table_responsive td.product-thumbnail img {
    width: 70px;
    height: auto;
  }

  .woocommerce-cart table.shop_table_responsive td.product-name {
    position: relative;
    padding-right: 28px;
    padding-left: 0;
    min-height: 70px;
    overflow: hidden;
  }

  .woocommerce-cart .cart-item-remove {
    position: absolute;
    right: -4px;
    top: -6px;
    left: auto;
  }

  .woocommerce-cart .cart-item-remove-below {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    text-transform: uppercase;
  }

  .woocommerce-cart .cart-item-remove-below .remove-text {
    color: #c00;
    text-decoration: none;
    font-weight: 600;
  }

  .woocommerce-cart .cart-item-price-mobile {
    display: block;
    margin-top: 4px;
    font-size: 16px;
    font-weight: 600;
  }

  .woocommerce-cart table.shop_table_responsive td.product-price {
    display: none;
  }

  .woocommerce-cart table.shop_table_responsive td.product-name::before,
  .woocommerce-cart table.shop_table_responsive td.product-thumbnail::before {
    content: "";
  }

  .woocommerce-cart table.shop_table_responsive td.product-quantity {
    clear: both;
    border-top: 1px solid #eee;
    margin-top: 6px;
    padding-top: 10px;
  }

  .woocommerce-cart table.shop_table_responsive td.product-quantity .quantity {
    display: inline-block;
  }

  .woocommerce-cart table.shop_table_responsive td.product-name dl.variation,
  .woocommerce-cart table.shop_table_responsive td.product-name .wc-item-meta {
    font-size: 13px;
    color: #666;
    margin-top: 6px;
  }
  
}

.woocommerce-cart th.product-subtotal,
.woocommerce-cart td.product-subtotal {
  display: none;
}

/* Mobile: ensure cart can scroll fully above the fixed checkout bar */
@media only screen and (max-width: 767px) {
  /* Fix mobile scroll issues - ensure html and body can scroll */
  /* html.woocommerce-cart,
  body.woocommerce-cart {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    position: relative;
    width: 100%;
    height: auto;
    min-height: 100%;
  }

  body.woocommerce-cart {
    padding-bottom: calc(170px + env(safe-area-inset-bottom));
  } */

  .wc-proceed-to-checkout{
    position: fixed;
    bottom: -20px;
    left: 0;
    right: 0;
    background-color: #fff;
    z-index: 999;
}

  /* Ensure main container can scroll */
  body.woocommerce-cart main.main,
  body.woocommerce-cart .main-content,
  body.woocommerce-cart .woocommerce,
  body.woocommerce-cart .content-area,
  body.woocommerce-cart .site-content {
    overflow-x: hidden !important;
    overflow-y: visible !important;
    position: relative;
    width: 100%;
    max-width: 100%;
  }

  /* Ensure page wrapper doesn't block scroll */
  body.woocommerce-cart .page-wrapper,
  body.woocommerce-cart .wrapper,
  body.woocommerce-cart #page {
    overflow-x: hidden !important;
    overflow-y: visible !important;
    width: 100%;
    position: relative;
  }

  /* Extra breathing room for totals table above the fixed proceed-to-checkout bar */
  /* .woocommerce-cart .cart_totals {
    padding-bottom: 50px;
  } */

  /* Keep the sticky checkout bar visible but don't block taps/scroll above it */
  /* .woocommerce-cart .cart_totals .wc-proceed-to-checkout,
  .woocommerce-cart .wc-proceed-to-checkout.sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 99999999;
    pointer-events: auto;
    touch-action: manipulation;
  } */

  /* Ensure sticky checkout button doesn't block scroll */
  /* .woocommerce-cart .wc-proceed-to-checkout.sticky {
    pointer-events: auto;
  }

  .woocommerce-cart .wc-proceed-to-checkout.sticky * {
    pointer-events: auto;
  } */

  /* Allow scrolling above the fixed checkout button */
  .woocommerce-cart .wc-proceed-to-checkout.sticky::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    height: 50px;
    pointer-events: none;
  }
}

/* Cart quantity: ensure input is always clickable/tappable */
.woocommerce-cart td.product-quantity,
.woocommerce-cart .quantity,
.woocommerce-cart .quantity .qty {
  pointer-events: auto !important;
}

.woocommerce-cart td.product-quantity,
.woocommerce-cart .quantity {
  position: relative;
  z-index: 5;
}

/* Coupon drawer (right sidebar, no animation) */
body.coupon-modal-open {
  overflow: hidden;
  touch-action: none;
  padding-right: 0 !important;
}

/* Modal container + overlay */
#coupons-open {
  /* Use !important because cart.php injects a large inline <style> after our stylesheet */
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100vh !important;
  height: 100svh !important;
  height: 100dvh !important;
  z-index: 100000000 !important; /* above fixed checkout bar (99999999) */
  overflow: hidden !important;
  transform: none !important;
  transition: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  display: none !important; /* hard disable to avoid any layout/transition nudge */
}

#coupons-open:before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 0;
  pointer-events: none;
}

#coupons-open.coupons-out {
  transform: none !important;
  visibility: visible !important;
  pointer-events: auto !important;
  display: block !important;
}

/* Panel */
#coupons-open .outer-card-panel {
  position: relative;
  height: 100%;
  width: 100%;
  z-index: 1;
}

#coupons-open .inner-cart-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: auto;
  margin: 0;
  width: 480px;
  max-width: 480px;
  background: #f2f2f2;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 2;
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
  overflow: hidden;
}

/* Header */
#coupons-open .inner-cart-panel > h2 {
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Scroll body */
#coupons-open .coupons-open-height {
  height: auto;
  flex: 1 1 auto;
  overflow-y: scroll;
  scrollbar-gutter: stable both-edges;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

/* Footer actions: always visible */
#coupons-open .open-cart-buttons {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
  z-index: 6;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) !important;
}

/* Coupon footer: add breathing room on the left for the Cancel button */
#coupons-open .open-cart-buttons ul.close-apply-btn {
  padding-left: 6px !important;
}

/* Close (X) button: pin to top-right inside panel */
#coupons-open #sidebar_coup_frm > div.close-coupons {
  position: absolute !important;
  right: 12px !important;
  left: auto !important;
  top: 12px !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
  padding: 0 !important;
  border-radius: 4px !important;
  z-index: 7 !important;
}

/* Coupon list clickability */
#coupons-open .checkbox.coupon-checkbox-wrap {
  position: relative;
  z-index: 1;
}

#coupons-open .custom-check {
  display: block;
  position: relative;
}

#coupons-open .custom-check input {
  z-index: 2;
}

#coupons-open .custom-check .checkmark {
  z-index: 1;
}

@media only screen and (max-width: 767px) {
  #coupons-open .inner-cart-panel {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
  }

  #coupons-open .open-cart-buttons {
    width: 100%;
    max-width: 100%;
  }
}
