.woocommerce-product-gallery__image {
  position: relative;
  overflow: hidden;
  background: #000;
}

.wpcpv-item-video {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: block;
  cursor: pointer;
}

.wpcpv-item-video::after {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 31;
  width: 68px;
  height: 48px;
  content: "";
  background: rgba(0, 0, 0, 0.6);
  border-radius: 14px;
  transition: background 0.2s ease;
  transform: translate(-50%, -50%);
}

.wpcpv-item-video::before {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 32;
  width: 22px;
  height: 24px;
  pointer-events: none;
  content: "";
  background: #fff;
  clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
  transform: translate(-35%, -50%);
}

.wpcpv-item-video:hover::after {
  background: #d2212e;
}

.woocommerce-product-gallery__image iframe.yt-inline {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: block;
  width: 100% !important;
  height: 100% !important;
  background: #000;
  border: 0;
}

.woocommerce-product-gallery__image.yt-playing .wpcpv-item-video {
  display: none;
}

.flex-control-thumbs li.video-thumb {
  position: relative;
}

.flex-control-thumbs li.video-thumb::after {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 26px;
  height: 26px;
  content: "";
  background: rgba(210, 33, 46, 0.9);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
}

.flex-control-thumbs li.video-thumb::before {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 0;
  height: 0;
  content: "";
  border-color: transparent transparent transparent #fff;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  transform: translate(-35%, -50%);
}

.branches-wrap.open .action::after {
  display: none !important;
}

/* Payment methods are supporting information, not primary purchase actions. */
.single-product .hlv-payment-methods {
  margin: 7px 0 12px;
  color: #62676b;
  font-size: 12px;
  line-height: 1.5;
}

.single-product .hlv-payment-methods a {
  color: #1177b7;
  font-weight: 600;
  text-decoration: none;
}

.single-product .hlv-payment-methods a:hover,
.single-product .hlv-payment-methods a:focus-visible {
  color: #d2212e;
  text-decoration: underline;
}

/* Baokim still mounts its controls for the popup, but they no longer compete
 * visually with the two purchase actions. */
.single-product .card-singl-product .bk-btn,
.single-product .card-singl-product .installment-btn {
  display: none !important;
}

.hlv-mobile-purchase-bar {
  display: none;
}

/* Let Swiper stretch every related-product card to the tallest item. The old
 * inline fixed height was calculated before Swiper resized mobile slides and
 * clipped titles/prices when three narrow cards were shown. */
.single-product .related-swiper .swiper-wrapper {
  align-items: stretch;
}

.single-product .related-swiper .swiper-slide {
  height: auto;
}

.single-product .related-swiper .product-item {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.single-product .related-swiper .product-item .detail {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  height: auto !important;
}

.single-product .related-swiper .product-item .price-wrap {
  margin-top: auto;
}

@media (max-width: 768px) {
  :root {
    --hlv-mobile-purchase-height: 64px;
    --hlv-mobile-purchase-safe-area: env(safe-area-inset-bottom, 0px);
  }

  .hlv-has-mobile-purchase-bar .fixed-bottom-toolbar {
    display: none !important;
  }

  /* Keep the original controls in the form for WooCommerce/third-party hooks,
   * but do not show a duplicate action row beside the native sticky submits. */
  .hlv-has-mobile-purchase-bar .singl-product form.cart .btn-cart {
    display: none !important;
  }

  .single-product .hlv-payment-methods {
    order: -1;
  }

  .hlv-has-mobile-purchase-bar .site-footer {
    margin-bottom: calc(
      var(--hlv-mobile-purchase-height) + var(--hlv-mobile-purchase-safe-area)
    );
  }

  .hlv-has-mobile-purchase-bar .fixed-contact {
    right: 12px;
    bottom: calc(
      var(--hlv-mobile-purchase-height) + var(--hlv-mobile-purchase-safe-area) + 12px
    );
    z-index: 999;
    transform: none;
  }

  .hlv-has-mobile-purchase-bar .fixed-contact img {
    width: 46px;
    height: 46px;
  }

  .single-product .singl-product-slider .flex-viewport,
  .single-product .singl-product-slider .woocommerce-product-gallery__wrapper,
  .single-product .singl-product-slider .woocommerce-product-gallery__image {
    height: min(260px, 32vh) !important;
    min-height: 0 !important;
  }

  .single-product .singl-product-slider .woocommerce-product-gallery__image img {
    width: 100% !important;
    height: 100% !important;
    max-height: min(260px, 32vh) !important;
    aspect-ratio: auto;
    object-fit: contain;
  }

  .single-product .singl-product-slider .woocommerce-product-gallery.hlv-gallery-no-thumbs {
    margin-bottom: 15px !important;
  }

  .hlv-mobile-purchase-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    box-sizing: border-box;
    width: auto;
    max-width: none;
    height: calc(
      var(--hlv-mobile-purchase-height) + var(--hlv-mobile-purchase-safe-area)
    );
    padding: 0 0 var(--hlv-mobile-purchase-safe-area);
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.14);
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.14);
  }

  .hlv-mobile-purchase-bar > button {
    display: flex;
    flex: 0 0 50%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 50%;
    max-width: none;
    min-width: 0;
    min-height: 48px;
    margin: 0;
    padding: 7px 5px;
    color: #fff;
    font: inherit;
    line-height: 1.15;
    text-align: center;
    border: 0;
    border-radius: 0;
    touch-action: manipulation;
  }

  .hlv-mobile-purchase-bar > button:focus-visible {
    position: relative;
    z-index: 1;
    outline: 3px solid #fff;
    outline-offset: -5px;
  }

  .hlv-mobile-add-to-cart {
    color: #084f7d !important;
    background: #fdc400;
  }

  .hlv-mobile-buy-now {
    color: #fff !important;
    background: #1177b7;
    border-left: 1px solid rgba(255, 255, 255, 0.35) !important;
  }

  .hlv-mobile-add-to-cart:focus-visible {
    outline-color: #084f7d;
  }

  .single-product .related-swiper .product-item .detail {
    padding: 10px 10px 16px;
  }

  .single-product .related-swiper .product-item .detail .price-wrap .percent-sale {
    margin-left: 8px;
  }

  .single-product .singl-product-related .owl-w-nav .owl-nav .owl-prev {
    left: 0;
  }

  .single-product .singl-product-related .owl-w-nav .owl-nav .owl-next {
    right: 0;
  }

  .hlv-mobile-purchase-bar > button > span {
    font-size: 13px;
    font-weight: 800;
  }

  .hlv-mobile-purchase-price {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    font-weight: 700;
  }

  .hlv-mobile-purchase-bar > button:disabled,
  .hlv-mobile-purchase-bar > button.is-disabled {
    cursor: not-allowed;
    filter: grayscale(0.3);
    opacity: 0.58;
  }

}
