/*
 * Whapido Sticky Add-to-Cart (Single Product)
 * v0.1.7
 * Light bottom bar with qty and total price.
 */

body.single-product.whp-has-sticky-atc {
  padding-bottom: 96px;
  overflow-x: hidden;
}

/*
 * Mobile product title above gallery (Whapido style)
 * Rendered via hook in functions.php
 */
.whp-mobile-product-title {
  display: none;
}

@media (max-width: 991px) {
  .whp-mobile-product-title {
    display: block;
    padding: 8px 12px;
    margin: 0;
  }

  .whp-mobile-product-title-inner {
    font-weight: 800;
    font-size: 20px;
    line-height: 1.15;
    color: #111827;
  }

  /* Hide the default summary title on mobile to avoid duplication */
  body.single-product div.product .summary h1.product_title,
  body.single-product div.product .summary .product_title {
    display: none !important;
  }
}

/*
 * When our sticky is active, hide the original qty + add-to-cart button
 * in the product summary (the form still exists for JS syncing).
 * We do this only after JS adds the body class, so if JS fails the page
 * stays usable.
 */
body.single-product.whp-has-sticky-atc div.product .summary form.cart .quantity,
body.single-product.whp-has-sticky-atc div.product .summary form.cart .single_add_to_cart_button,
body.single-product.whp-has-sticky-atc div.product .summary form.cart button.single_add_to_cart_button,
body.single-product.whp-has-sticky-atc div.product .summary form.cart .woocommerce-variation-add-to-cart,
body.single-product.whp-has-sticky-atc div.product .summary form.cart .variations_button,
body.single-product.whp-has-sticky-atc div.product .summary form.cart .nasa-buy-now {
  display: none !important;
}

#whp-sticky-atc.whp-sticky-atc {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;

  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.12);

  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

#whp-sticky-atc .whp-sticky-inner {
  max-width: 1200px;
  margin: 0 auto;

  display: flex;
  align-items: center;
  gap: 12px;
}

#whp-sticky-atc .whp-sticky-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

#whp-sticky-atc .whp-qty-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;

  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #f3f4f6;
  color: #111827;

  font-size: 20px;
  line-height: 1;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;

  cursor: pointer;
  user-select: none;
}

#whp-sticky-atc .whp-qty-input {
  width: 56px;
  height: 40px;

  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;

  text-align: center;
  padding: 0 8px;
}

#whp-sticky-atc .whp-qty-input::-webkit-outer-spin-button,
#whp-sticky-atc .whp-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#whp-sticky-atc .whp-sticky-cta {
  flex: 1 1 auto;

  border-radius: 14px;
  padding: 14px 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
  overflow: hidden;

  background: var(--nasa-primary-color, var(--primary-color, #e13123));
  color: #fff;
  border: 0;

  cursor: pointer;
}

#whp-sticky-atc .whp-sticky-cta:hover {
  filter: brightness(0.95);
}

#whp-sticky-atc .whp-sticky-cta:disabled,
#whp-sticky-atc .whp-sticky-cta.whp-disabled {
  opacity: 0.60;
  cursor: not-allowed;
}

#whp-sticky-atc .whp-btn-price {
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

#whp-sticky-atc .whp-btn-label {
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex: 0 0 auto;
}

@media (min-width: 992px) {
  body.single-product.whp-has-sticky-atc {
    padding-bottom: 110px;
  }

  #whp-sticky-atc.whp-sticky-atc {
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  }

  #whp-sticky-atc .whp-qty-btn {
    width: 44px;
    height: 44px;
  }

  #whp-sticky-atc .whp-qty-input {
    width: 64px;
    height: 44px;
  }

  #whp-sticky-atc .whp-sticky-cta {
    padding: 16px 18px;
  }
}
