/** Shopify CDN: Minification failed

Line 106:0 Unexpected "{"
Line 106:1 Expected identifier but found "%"
Line 107:0 Unexpected "<"
Line 140:30 Comments in CSS use "/* ... */" instead of "//"
Line 176:6 Comments in CSS use "/* ... */" instead of "//"
Line 236:1 Expected identifier but found "%"

**/
.main-cart .checkmark:before {
  --grey-color: var(--color-white);
}
.main-cart textarea {
  min-height: 12rem;
}
cart-remove-button .underline {
  text-underline-offset: 2px;
}
.cart_page-countdown {
  border: 1px dashed var(--color-primary);
  background-color: rgba(var(--color-primary-rgb), 0.08);
}
.cart_page-recommend.cart-recommend.inside .product-item__wrapper {
  border-color: var(--color-border);
}
.js-contents .caption-large a {
  text-decoration: none;
}
.js-contents .caption-large a:not(:hover) {
  color: var(--color-heading);
}
@media screen and (min-width: 1025px) {
  .cart-item__details {
    width: 35%;
  }
  .cart__page-price {
    width: 20%;
  }
}
@media (min-width: 1025px) and (max-width: 1200px) {
  .page-cart {
    --col-width: 38rem !important;
  }
}
@media screen and (max-width: 767.98px) {
  .page__cart-item {
    display: grid;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
    --custom-width: 10rem !important;
    position: relative;
    grid-template-columns: 10rem 1fr;
    column-gap: 1.5rem;
  }
  .page__cart-item:last-child {
    margin-bottom: 0;
  }
  .page__cart-item td {
    padding: 0;
    border: 0 !important;
  }
  .cart-item__media {
    grid-row: 1 / 3;
  }
  .cart__page-price {
    display: none;
  }
  thead.hidden-on-small {
    display: none;
  }
  .page__cart-item
    td:not(.cart-item__media, .cart__page-price, .cart-item__totals) {
    display: block;
  }
  .cart-item__quantity {
    position: absolute;
    bottom: 2rem;
    right: 0;
  }
  .cart-item__quantity .ps-20 {
    padding-inline-start: 1rem;
  }
  .cart-item__quantity .pe-20 {
    padding-inline-end: 1rem;
  }
  .cart-item__quantity input {
    --input-height: 30px !important;
    width: 3rem;
  }
  .rounded-style .cart-item__quantity {
    --btn-radius: 3px;
  }
  .cart-item__totals {
    display: flex;
    align-items: end;
  }
}
body:has(cart-items.is-empty) .page-title {
  display: none;
}



{%- if template contains 'cart' -%}
<script>
(function () {
  const THRESHOLD = 3;
  let debounceTimer = null;
  let selfUpdating = false;

  function getMsg(totalQty) {
    const remaining = THRESHOLD - totalQty;
    if (totalQty <= 0) return '';
    if (remaining === 2) {
      return '🛍️ <b>Add 2 More Items</b> To Get <b class="highlight-red">EXTRA 15% OFF</b> 🎁';
    }
    if (remaining === 1) {
      return '🔥 <b>Add 1 More Item</b> To Get <b class="highlight-red">EXTRA 15% OFF</b> 🎉';
    }
    return '🎉 <b>Congrats!</b> You Got <b class="highlight-red">EXTRA 15% OFF</b> ✅';
  }

  function findAnchor() {
    return (
      document.querySelector('.cart__items') ||
      document.querySelector('table.cart') ||
      document.querySelector('cart-items') ||
      document.querySelector('.cart-items') ||
      document.querySelector('[class*="cart-table"]')
    );
  }

  function ensureMessageDiv() {
    var el = document.getElementById('bundle-discount-message-cart');
    if (el) return el;

    var anchor = findAnchor();
    if (!anchor) return null; // cart table na mile to div hi mat banao

    el = document.createElement('div');
    el.id = 'bundle-discount-message-cart';
    el.className = 'cart__discount-message';
    anchor.parentNode.insertBefore(el, anchor);
    return el;
  }

  async function updateMessage() {
    selfUpdating = true;

    var elCart = ensureMessageDiv();
    var elDrawer = document.getElementById('bundle-discount-message-drawer');

    if (!elCart && !elDrawer) {
      selfUpdating = false;
      return;
    }

    try {
      var res = await fetch('/cart.js', { credentials: 'same-origin', cache: 'no-store' });
      var cart = await res.json();

      var totalQty = 0;
      var items = cart.items || [];
      for (var i = 0; i < items.length; i++) {
        totalQty += items[i].quantity || 0;
      }

      var html = getMsg(totalQty);

      if (elCart && elCart.innerHTML !== html) elCart.innerHTML = html;
      if (elDrawer && elDrawer.innerHTML !== html) elDrawer.innerHTML = html;

    } catch (e) {
      // silent fail
    } finally {
      setTimeout(function () { selfUpdating = false; }, 100);
    }
  }

  function scheduleUpdate() {
    if (debounceTimer) return;
    debounceTimer = setTimeout(function () {
      updateMessage();
      debounceTimer = null;
    }, 300);
  }

  document.addEventListener('DOMContentLoaded', updateMessage);
  if (document.readyState === 'interactive' || document.readyState === 'complete') {
    updateMessage();
  }

  function attachScopedObserver() {
    var container =
      document.querySelector('.cart-section') ||
      document.querySelector('.cart-form') ||
      document.querySelector('main#MainContent') ||
      document.querySelector('main#main') ||
      document.body;

    var observer = new MutationObserver(function () {
      if (selfUpdating) return;
      scheduleUpdate();
    });

    observer.observe(container, { childList: true, subtree: true });
  }

  document.addEventListener('DOMContentLoaded', attachScopedObserver);
  if (document.readyState === 'interactive' || document.readyState === 'complete') {
    attachScopedObserver();
  }

  document.addEventListener('click', function (e) {
    if (
      e.target.closest(
        'button[name="add"], cart-remove-button, cart-drawer-remove-button, .quantity__button, .qty-button, quantity-input button'
      )
    ) {
      scheduleUpdate();
    }
  });

  document.addEventListener('change', function (e) {
    if (e.target.closest('cart-items, cart-drawer-items, input[name="updates[]"], quantity-input')) {
      scheduleUpdate();
    }
  });

  document.addEventListener('cart:update', scheduleUpdate);
  document.addEventListener('cart:refresh', scheduleUpdate);
})();
</script>
{%- endif -%}