/* ============================================================
   PPB – related products on product listings
   Dedicated stylesheet loaded after ppb_custom.css.
   Keep this file limited to the product-card trigger only.
   ============================================================ */

/* AngarTheme can calculate a fixed card height before the async PPB check. */
.product-miniature,
.js-product-miniature,
.product-miniature .thumbnail-container,
.js-product-miniature .thumbnail-container {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Reserved slot keeps all product cards aligned, even when no relation exists. */
.product-miniature .ppb-listing-related-slot,
.js-product-miniature .ppb-listing-related-slot {
  position: relative;
  z-index: 20;
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 32px;
  min-height: 32px;
  flex: 0 0 32px;
  margin: 0;
  padding: 2px 8px;
  overflow: visible;
}

.product-miniature .ppb-listing-related-trigger,
.js-product-miniature .ppb-listing-related-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0 3px 0 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #313234;
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  overflow: visible;
  cursor: default;
  pointer-events: none;
}

.product-miniature .ppb-listing-related-label,
.js-product-miniature .ppb-listing-related-label {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 18px;
}

.product-miniature .ppb-listing-related-plus,
.js-product-miniature .ppb-listing-related-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #444;
  font-size: 18px;
  line-height: 16px;
  font-weight: 400;
}

/* Pending/checking/empty/error: reserve space, paint nothing. */
.product-miniature .ppb-listing-related-trigger:not(.is-available) .ppb-listing-related-label,
.product-miniature .ppb-listing-related-trigger:not(.is-available) .ppb-listing-related-plus,
.js-product-miniature .ppb-listing-related-trigger:not(.is-available) .ppb-listing-related-label,
.js-product-miniature .ppb-listing-related-trigger:not(.is-available) .ppb-listing-related-plus {
  visibility: hidden;
  opacity: 0;
}

/* Confirmed relation. */
.product-miniature .ppb-listing-related-trigger.is-available,
.product-miniature .ppb-listing-related-trigger[data-ppb-status="available"],
.js-product-miniature .ppb-listing-related-trigger.is-available,
.js-product-miniature .ppb-listing-related-trigger[data-ppb-status="available"] {
  pointer-events: auto;
  cursor: pointer;
  background: #fff;
  border-bottom: 1px solid #ddd;
}

.product-miniature .ppb-listing-related-trigger.is-available .ppb-listing-related-label,
.product-miniature .ppb-listing-related-trigger.is-available .ppb-listing-related-plus,
.product-miniature .ppb-listing-related-trigger[data-ppb-status="available"] .ppb-listing-related-label,
.product-miniature .ppb-listing-related-trigger[data-ppb-status="available"] .ppb-listing-related-plus,
.js-product-miniature .ppb-listing-related-trigger.is-available .ppb-listing-related-label,
.js-product-miniature .ppb-listing-related-trigger.is-available .ppb-listing-related-plus,
.js-product-miniature .ppb-listing-related-trigger[data-ppb-status="available"] .ppb-listing-related-label,
.js-product-miniature .ppb-listing-related-trigger[data-ppb-status="available"] .ppb-listing-related-plus {
  visibility: visible;
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .product-miniature .ppb-listing-related-trigger.is-available:hover,
  .js-product-miniature .ppb-listing-related-trigger.is-available:hover {
    color: #0071e3;
    background: none;
  }

  .product-miniature .ppb-listing-related-trigger.is-available:hover .ppb-listing-related-label,
  .js-product-miniature .ppb-listing-related-trigger.is-available:hover .ppb-listing-related-label {
    text-decoration: underline;
  }
}
