/*
 * Mobile sticky Add-to-Cart bar — applies to every WooCommerce single product page.
 * Mounted by sticky-atc.js. Visibility class is .is-visible.
 * Body class .cpw-sticky-atc-active reserves bottom space when bar is shown.
 */
@media (max-width: 849px) {

  body.single-product .cpw-sticky-atc {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
    background: #ffffff;
    border-top: 1px solid #e2e2e2;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(110%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  body.single-product .cpw-sticky-atc.is-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  body.single-product .cpw-sticky-atc__info {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.2;
  }

  body.single-product .cpw-sticky-atc__title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    font-size: 0.92rem;
    color: #1a1a1a;
  }

  body.single-product .cpw-sticky-atc__price {
    font-size: 0.85rem;
    color: #555;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.single-product .cpw-sticky-atc__price .amount,
  body.single-product .cpw-sticky-atc__price ins .amount,
  body.single-product .cpw-sticky-atc__price .woocommerce-Price-amount {
    font-weight: 700;
    color: #0d3b66;
    text-decoration: none;
  }

  body.single-product .cpw-sticky-atc__price del {
    opacity: 0.55;
    margin-right: 4px;
    font-size: 0.85em;
  }

  body.single-product .cpw-sticky-atc__price ins {
    text-decoration: none;
  }

  body.single-product .cpw-sticky-atc__cta {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 1.15rem;
    background: #0d3b66;
    color: #ffffff;
    border: 0;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease, transform 0.1s ease;
  }

  body.single-product .cpw-sticky-atc__cta:hover {
    background: #0a3258;
  }

  body.single-product .cpw-sticky-atc__cta:active {
    transform: scale(0.98);
  }

  /* When bar is showing, push page content up so the related-products area / footer
     aren't obscured by the bar. Approx 72px bar + safe area. */
  body.single-product.cpw-sticky-atc-active {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* Brief flash to draw the eye when sticky CTA scrolls user back to the form. */
  body.single-product .cpw-sticky-flash {
    animation: cpw-sticky-flash 0.9s ease;
  }
  @keyframes cpw-sticky-flash {
    0%   { box-shadow: 0 0 0 0 rgba(13, 59, 102, 0); }
    35%  { box-shadow: 0 0 0 6px rgba(13, 59, 102, 0.25); }
    100% { box-shadow: 0 0 0 0 rgba(13, 59, 102, 0); }
  }
}

/* Defense-in-depth: never render the bar on desktop. */
@media (min-width: 850px) {
  body.single-product .cpw-sticky-atc {
    display: none !important;
  }
}
