/**
 * ============================================================================
 *  PRODUCT PAGE — STICKY MOBILE "ADD TO BASKET" BAR   (editable, no build step)
 * ============================================================================
 *  A bottom-pinned bar (price + quantity + add-to-basket) that follows the
 *  user down single-product pages. MOBILE / TABLET ONLY (below the lg
 *  breakpoint, 992px) — hidden entirely on desktop. Built + driven by
 *  js/product-sticky-bar.js; enqueued on is_product() in functions.php.
 * ============================================================================
 */

/* Hidden by default (and always hidden on desktop — the rule below only
   turns it on within the mobile media query). */
.mobile-buy-bar { display: none; }

@media (max-width: 991.98px) {
  .mobile-buy-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;                 /* under the side-cart drawer (1050/1040) */
    padding: 10px 14px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));  /* iOS home bar */
    background: #fff;
    border-top: 1px solid #e9e9e9;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.10);
    transform: translateY(120%);   /* parked off-screen until scrolled */
    transition: transform .28s ease;
  }
  .mobile-buy-bar.is-visible { transform: translateY(0); }

  /* Give the page a little breathing room at the very bottom while the bar is
     up, so it never sits on top of the last line of the footer. */
  body.mbb-active { padding-bottom: 66px; }

  /* --- Price ------------------------------------------------------------- */
  .mobile-buy-bar__price { flex: 0 0 auto; line-height: 1.05; }
  .mobile-buy-bar__price .mbb-from {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: #5f6368;
    text-transform: uppercase;
    letter-spacing: .02em;
  }
  .mobile-buy-bar__price .woocommerce-Price-amount,
  .mobile-buy-bar__price .amount {
    font-size: 16px;
    font-weight: 700;
    color: #202124;
    white-space: nowrap;
  }

  /* --- Quantity stepper -------------------------------------------------- */
  .mobile-buy-bar__qty {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    height: 42px;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    overflow: hidden;
  }
  .mobile-buy-bar__qty button {
    width: 30px;
    height: 100%;
    border: 0;
    background: #f5f5f5;
    font-size: 18px;
    line-height: 1;
    color: #333;
    cursor: pointer;
  }
  .mobile-buy-bar__qty button:active { background: #e6e6e6; }
  .mobile-buy-bar__qty input {
    width: 36px;
    height: 100%;
    border: 0;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #202124;
    -moz-appearance: textfield;
  }
  .mobile-buy-bar__qty input::-webkit-outer-spin-button,
  .mobile-buy-bar__qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

  /* --- Add to basket ----------------------------------------------------- */
  .mobile-buy-bar__add {
    flex: 1 1 auto;
    height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: #60c974;           /* matches the site's real "Add to Basket" green */
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease;
  }
  .mobile-buy-bar__add:active { background: #52bb66; }

  /* Flash the variation options when the user taps Add before choosing them. */
  .mbb-flash { animation: mbbFlash .8s ease 2; border-radius: 6px; }
  @keyframes mbbFlash {
    0%, 100% { box-shadow: 0 0 0 0 rgba(2, 160, 197, 0); }
    35%      { box-shadow: 0 0 0 3px rgba(2, 160, 197, .35); }
  }
}
