/* =========================
   Global small tweaks
   ========================= */

/* Sale badge */
.wc-block-grid__product-onsale { background: #E22120; }

/* =========================
   Checkout payment icons layout
   ========================= */

.woocommerce .wc_payment_methods li label{
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.woocommerce .wc_payment_methods li .enderg-gateway-icons{
  margin-left: auto !important;
  display: inline-flex !important;
  gap: 10px !important;
  align-items: center !important;
  white-space: nowrap !important;
}

.woocommerce .wc_payment_methods li .enderg-gateway-icons img,
.woocommerce .wc_payment_methods li label > img{
  height: 28px !important;
  max-height: 28px !important;
  width: auto !important;
  object-fit: contain !important;
}

/* FIX: theme makes the 5th gateway images huge (e.g. width:40%) */
.woocommerce #order_review #payment .wc_payment_methods .wc_payment_method:nth-child(5) label img{
  width: auto !important;
  max-width: none !important;
  height: 28px !important;
  max-height: 28px !important;
  object-fit: contain !important;
}

/* Nuclear: also reset any wrapper sizing for the 5th method */
.woocommerce-checkout #payment .wc_payment_methods .wc_payment_method:nth-child(5) label{
  align-items: center !important;
}

.woocommerce-checkout #payment .wc_payment_methods .wc_payment_method:nth-child(5) img{
  width: auto !important;
  max-width: none !important;
  height: 28px !important;
  max-height: 28px !important;
  min-height: 0 !important;
  object-fit: contain !important;
}



/* =========================
   Product page: non-sticky Buy Now button next to Add to cart
   ========================= */

.enderg-buy-now-btn{
  background: #3498db !important;
  border-color: #3498db !important;
  color: #fff !important;
  margin-left: 10px;
}

  /* Optional: reorder checkout sections (payment first) */
  #order_review{
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  #order_review #payment{
    order: 1;
  }
  #order_review .woocommerce-checkout-review-order-table,
  #order_review table.shop_table{
    order: 2;
  }

/* =====================================================
   MOBILE STICKY BARS – Checkout, Product, Cart
   ===================================================== */

/* Desktop: hide all sticky bars */
#wc-mobile-placeorder-bar,
#wc-mobile-product-bar,
#wc-mobile-cart-bar{
  display: none;
}

/* ---------------- Mobile only ---------------- */
@media (max-width: 768px){

  /* Never let the body itself add extra bottom padding */
  body.woocommerce-checkout,
  body.single-product,
  body.woocommerce-cart{
    padding-bottom: 0 !important;
  }

  /* =====================================================
     CHECKOUT – Sticky "Pay Now" bar (#wc-mobile-placeorder-bar)
     ===================================================== */

  #wc-mobile-placeorder-bar{
    display: block !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;

    background: #0a1831;
    padding: 14px 0;

    z-index: 2147483647 !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;

    transition: background-color .2s ease;
  }

  /* When footer is visible */
  #wc-mobile-placeorder-bar.over-footer{
    background: #000;
  }

  /* Layout inside the sticky bar */
  #wc-mobile-placeorder-bar #wc-mpo-wrap{
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;

    width: calc(100% - 32px) !important;
    max-width: 520px !important;
    margin: 0 auto !important;
  }

  /* Pay Now button (LEFT) */
  #wc-mobile-placeorder-bar #wc-mobile-placeorder-btn{
    order: 1 !important;
    flex: 1 1 auto !important;
    width: auto !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    padding: 16px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    min-height: 54px !important;
  }

  /* Total chip (RIGHT) */
  #wc-mobile-placeorder-bar #wc-mpo-total{
    order: 2 !important;
    flex: 0 0 auto !important;

    min-width: 92px !important;
    max-width: 40% !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    border-radius: 10px !important;
    min-height: 54px !important;

    font-weight: 800 !important;
    color: #fff !important;

    border: 1px solid rgba(255,255,255,.22) !important;
    background: rgba(255,255,255,.08) !important;
    padding: 0 12px !important;

    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  /* Hide chip until total exists */
  #wc-mobile-placeorder-bar #wc-mpo-total:not(.has-total){
    display: none !important;
  }

  /* Give room for sticky bar without creating a footer gap */
  form.woocommerce-checkout{
    padding-bottom: 120px !important;
  }

  /* Optional: reorder checkout sections (payment first) */
  #order_review{
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  #order_review #payment{
    order: 1;
  }
  #order_review .woocommerce-checkout-review-order-table,
  #order_review table.shop_table{
    order: 2;
  }


  /* =====================================================
     PRODUCT – Sticky Add to cart + Buy Now (#wc-mobile-product-bar)
     ===================================================== */

  #wc-mobile-product-bar{
    display: flex !important;
    gap: 10px;

    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;

    padding: 12px 16px !important;
    background-color: #0a1831 !important;

    z-index: 2147483647 !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;

    transition: background-color .35s ease;
  }

  /* Footer overlay fade */
  #wc-mobile-product-bar::before{
    content: "";
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
  }
  #wc-mobile-product-bar.over-footer::before{
    opacity: 1;
  }

  /* Buttons in product sticky bar */
  #wc-mobile-product-bar > button{
    position: relative;
    z-index: 1;

    flex: 1 1 0;
    width: auto;

    padding: 14px 12px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Sticky Add to cart */
  #wc-mobile-atc-btn{
    background: #0a1831;
    border: 1px solid rgba(255,255,255,.15);
    color: #fff;
  }

  /* Sticky Buy Now (mobile) */
  #wc-mobile-buynow-btn{
    background: #00917a;
    border-color: #00917a;
    color: #fff;
  }

  /* Give room for product sticky bar */
  body.single-product main,
  body.single-product #primary,
  body.single-product .site-content,
  body.single-product #content{
    padding-bottom: 96px !important;
  }


  /* =====================================================
     CART – Sticky "Proceed to checkout" bar (#wc-mobile-cart-bar)
     ===================================================== */

  body.woocommerce-cart #wc-mobile-cart-bar{
    display: block !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;

    background: #0a1831;
    padding: 14px 0;

    z-index: 2147483647 !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;

    transition: background-color .2s ease;
  }

  body.woocommerce-cart #wc-mobile-cart-bar.over-footer{
    background: #000;
  }

  /* Cloned checkout button inside sticky cart bar */
  body.woocommerce-cart #wc-mobile-cart-bar #wc-mobile-cart-checkout{
    display: block;
    width: calc(100% - 32px);
    max-width: 720px;

    margin: 0 auto;
    padding: 16px;

    border-radius: 10px;
    text-align: center;
    text-decoration: none;
  }

  /* Give room for cart sticky bar */
  body.woocommerce-cart main,
  body.woocommerce-cart #primary,
  body.woocommerce-cart .site-content,
  body.woocommerce-cart #content{
    padding-bottom: 110px;
  }
}

@media (max-width: 768px){

  /* ---- 1) Your sticky bars: keep fixed and visible ---- */
  body.single-product #wc-mobile-product-bar,
  body.woocommerce-cart #wc-mobile-cart-bar,
  body.woocommerce-checkout #wc-mobile-placeorder-bar{
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    z-index: 999998 !important;
    transform: translateZ(0) !important;
  }

  /* ---- 2) Make room so page content doesn't hide behind bar ---- */
  body.single-product,
  body.woocommerce-cart,
  body.woocommerce-checkout{
    padding-bottom: 90px !important;
  }

  /* ---- 3) TranslatePress floating switcher: MOVE ONLY (no size changes) ---- */
  body.single-product nav.trp-language-switcher.trp-floating-switcher,
  body.woocommerce-cart nav.trp-language-switcher.trp-floating-switcher,
  body.woocommerce-checkout nav.trp-language-switcher.trp-floating-switcher{
    bottom: 78px !important;   /* was 88px — now nearly flush */
    z-index: 1000000 !important;
  }
}
