/* Astra Rabaty / Baltica – listing and product-code presentation.
   Overrides ONLY code labels; global settings still control their colors.
   No fixed height: long text must never be clipped on mobile.
   When "Reserve space" is enabled, JS equalizes the slot in each row. */

#js-product-list .js-product-miniature .astra-rabaty-product-code-slot {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  height: auto;
  margin: 3px 0 5px;
  padding: 0;
  overflow: visible;
}

#js-product-list .js-product-miniature .astra-rabaty-product-code--listing {
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 24px;
  height: auto;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid var(--astra-rabaty-code-border, var(--astra-rabaty-code-accent, #2f9e66));
  border-radius: 3px;
  color: var(--astra-rabaty-code-text, var(--astra-rabaty-code-accent, #2f9e66));
  background-color: var(--astra-rabaty-code-fill, transparent);
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
}

#js-product-list .js-product-miniature .astra-rabaty-product-code__message {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  max-height: none;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
  text-overflow: clip;
  -webkit-line-clamp: unset;
  -webkit-box-orient: initial;
}

#js-product-list .js-product-miniature .astra-rabaty-product-code__copy,
.astra-rabaty-product-code--product .astra-rabaty-product-code__copy {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 100%;
  min-width: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  vertical-align: baseline;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
}

#js-product-list .js-product-miniature .astra-rabaty-product-code__copy-icon,
.astra-rabaty-product-code--product .astra-rabaty-product-code__copy-icon {
  display: inline-block;
  flex: 0 0 13px;
  width: 13px;
  height: 13px;
  vertical-align: middle;
  pointer-events: none;
}

#js-product-list .js-product-miniature .astra-rabaty-product-code__copy:focus-visible,
.astra-rabaty-product-code--product .astra-rabaty-product-code__copy:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

#js-product-list .js-product-miniature .astra-rabaty-product-code__copy.is-copied,
.astra-rabaty-product-code--product .astra-rabaty-product-code__copy.is-copied {
  opacity: .65;
}

#js-product-list .js-product-miniature .astra-rabaty-product-code__copy.is-copy-failed,
.astra-rabaty-product-code--product .astra-rabaty-product-code__copy.is-copy-failed {
  text-decoration: underline wavy;
}

.astra-rabaty-product-code--product {
  border-radius: 3px;
  max-width: 100%;
  height: auto;
  white-space: normal;
}

.astra-rabaty-product-code--product .astra-rabaty-product-code__message {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 767px) {
  #js-product-list .js-product-miniature .astra-rabaty-product-code-slot {
    min-height: 46px;
    margin-top: 4px;
    margin-bottom: 5px;
  }
  #js-product-list .js-product-miniature .astra-rabaty-product-code--listing {
    min-height: 24px;
    height: auto;
    padding: 5px 6px;
    font-size: 11px;
    line-height: 1.4;
    white-space: normal;
    overflow: visible;
  }
}

/* Baltica: markup seen in the catalog uses .pro_second_box > .mini_name.
   The CSS fallback reserves the row even if JS is delayed, if the PrestaShop
   setting is not initialized yet, or if AJAX has just replaced the card.
   It is limited to this theme's miniature markup; no global storefront impact.
   When the JS slot exists, the pseudo-element is not rendered. */
.product_list_item .js-product-miniature .pro_second_box:not(:has(> .astra-rabaty-product-code--listing, > .astra-rabaty-product-code-slot))::before,
#js-product-list .js-product-miniature .pro_second_box:not(:has(> .astra-rabaty-product-code--listing, > .astra-rabaty-product-code-slot))::before {
  content: '';
  display: block;
  box-sizing: border-box;
  height: 32px;
  width: 100%;
  margin: 3px 0 5px;
  flex: 0 0 32px;
}

/* Campaign tiles rendered by Smarty, before JS has wrapped them in the slot. */
.product_list_item .js-product-miniature .pro_second_box > .astra-rabaty-product-code--listing,
#js-product-list .js-product-miniature .pro_second_box > .astra-rabaty-product-code--listing {
  min-height: 32px;
  height: auto;
  margin: 3px 0 5px;
  overflow: visible;
  white-space: normal;
}

/* Listing can also be rebuilt outside #js-product-list by external search. */
.product_list_item .js-product-miniature .astra-rabaty-product-code-slot {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  height: auto;
  margin: 3px 0 5px;
  padding: 0;
  overflow: visible;
}
.product_list_item .js-product-miniature .astra-rabaty-product-code--listing {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  overflow: visible;
  border-radius: 3px;
  white-space: normal;
}
.product_list_item .js-product-miniature .astra-rabaty-product-code__message {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
  -webkit-line-clamp: unset;
}

@media (max-width: 767px) {
  .product_list_item .js-product-miniature .pro_second_box:not(:has(> .astra-rabaty-product-code--listing, > .astra-rabaty-product-code-slot))::before,
  #js-product-list .js-product-miniature .pro_second_box:not(:has(> .astra-rabaty-product-code--listing, > .astra-rabaty-product-code-slot))::before {
    height: 46px;
    flex-basis: 46px;
    margin: 4px 0 5px;
  }
  .product_list_item .js-product-miniature .pro_second_box > .astra-rabaty-product-code--listing,
  #js-product-list .js-product-miniature .pro_second_box > .astra-rabaty-product-code--listing {
    min-height: 46px;
    margin: 4px 0 5px;
  }
  .product_list_item .js-product-miniature .astra-rabaty-product-code-slot {
    min-height: 46px;
    margin-top: 4px;
    margin-bottom: 5px;
  }
}
