/* Estilos compartidos para los flags de producto renderizados por Liquid. */
.product-flags__item {
  --product-flags-rendered-width: var(--pf-w, 70px);
  --product-flags-rendered-font-size: var(--pf-fs, 12px);
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 4px 4px 0;
  vertical-align: middle;
}
.product-flags__item[data-pf-p]:not([data-pf-active]) { display: none !important; }

.product-flags__flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--product-flags-rendered-width);
  min-height: calc(var(--product-flags-rendered-font-size) + 8px);
  border-radius: var(--pf-r, 4px);
  border: var(--pf-bw, 0) solid var(--pf-bc, transparent);
  font-size: var(--product-flags-rendered-font-size);
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-flags__flag--text {
  padding: 4px 6px;
  background: var(--pf-bg, #000);
  color: var(--pf-tx, #fff);
}

.product-flags__flag--label {
  width: auto;
  min-width: var(--product-flags-rendered-width);
  min-height: var(--pf-h, 28px);
  white-space: normal;
}

.product-flags__flag--image {
  padding: 0;
  min-height: 0;
  background: transparent;
  border: 0;
}

.product-flags__image {
  display: block;
  width: 100%;
  height: auto;
}

.product-flags__link {
  display: inline-flex;
  max-width: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: var(--pf-r, 4px);
}

.product-flags__link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

[data-product-flags-anchor] > .shopify-block:empty,
[data-product-flags-anchor] > .shopify-block:not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])) {
  display: none;
}

[data-product-flags-anchor] > .shopify-block:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active]) {
  display: contents;
}

/* :has no admite otro :has anidado; el estado se comprueba en el mismo nivel. */
.shopify-block:has(> [data-product-flags-anchor="title-above"]):not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])),
.shopify-block:has(> [data-product-flags-anchor="title-beside"]):not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])),
.shopify-block:has(> [data-product-flags-anchor="price-left"]):not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])),
.shopify-block:has(> [data-product-flags-anchor="price-right"]):not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])),
.shopify-block:has(> [data-product-flags-anchor="price-below"]):not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])),
[data-product-flags-anchor="title-above"]:not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])),
[data-product-flags-anchor="title-beside"]:not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])),
[data-product-flags-anchor="price-left"]:not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])),
[data-product-flags-anchor="price-right"]:not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])),
[data-product-flags-anchor="price-below"]:not(:has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active])) {
  display: none;
}

.shopify-block:has(> [data-product-flags-anchor="title-above"]):has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active]),
.shopify-block:has(> [data-product-flags-anchor="title-beside"]):has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active]),
.shopify-block:has(> [data-product-flags-anchor="price-left"]):has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active]),
.shopify-block:has(> [data-product-flags-anchor="price-right"]):has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active]),
.shopify-block:has(> [data-product-flags-anchor="price-below"]):has(.product-flags__item:not([data-pf-p]), .product-flags__item[data-pf-active]) {
  display: contents;
}

.product-flags__item--overlay {
  position: absolute;
  left: var(--pf-l, 0%);
  top: var(--pf-t, 0%);
  transform: translate(calc(var(--pf-l, 0%) * -1), calc(var(--pf-t, 0%) * -1));
  z-index: var(--product-flags-layer, 2);
  pointer-events: none;
}

.product-flags__item--overlay .product-flags__link {
  pointer-events: auto;
}

.product-flags__item--above_title {
  display: flex;
  width: 100%;
}

.product-flags__item--beside_title,
.product-flags__item--left_of_price,
.product-flags__item--right_of_price {
  flex: 0 1 auto;
}

.product-flags__item--below_price {
  display: flex;
  flex-basis: 100%;
  width: 100%;
}

@media screen and (max-width: 749px) {
  .product-flags__item {
    --product-flags-rendered-width: var(--pf-mw, var(--pf-w, 70px));
    --product-flags-rendered-font-size: var(--pf-mfs, var(--pf-fs, 12px));
  }

  .product-flags__item--overlay {
    left: var(--pf-ml, var(--pf-l, 0%));
    top: var(--pf-mt, var(--pf-t, 0%));
    transform: translate(calc(var(--pf-ml, var(--pf-l, 0%)) * -1), calc(var(--pf-mt, var(--pf-t, 0%)) * -1));
  }
}
