/*
 * @package      Webcode_ProductLabel
 *
 * @author       Kostadin Bashev (bashev@webcode.bg)
 * @copyright Copyright © 2021–2026 Webcode (https://webcode.bg/)
 * @license   https://webcode.bg/license (proprietary — see EULA)
 *
 * Plain CSS, requested from default_head_blocks.xml, because the module has to reach two
 * theme families: Luma/blank compile Magento LESS, Hyva ships Tailwind and never runs that
 * pipeline. A css/source/_module.less would therefore be picked up by Luma only — which is
 * exactly what left Hyva completely unstyled until 26.08.2026. Do not migrate this back to
 * LESS without giving Hyva its own delivery; per-label tweaks belong in the label's Custom
 * CSS field (.product-label-{id}), not here.
 */

.product.media,
a.product-item-photo {
    position: relative;
}

a.product-item-photo {
    display: block;
}

.product-labels {
    display: contents;
    display: block;
}

/*
 * Luma only. `.product.media` also spans the thumbnail strip, so the labels get their own
 * layer, which js/label-anchor.js measures onto the main image. The four pinned edges are
 * only the no-js fallback — the script replaces `right`/`bottom` with an explicit size.
 * Hyva needs none of this: there the block is moved into the gallery's own main image
 * wrapper (see hyva_catalog_product_view.xml), which is already the right box.
 */
.product.media .product-labels {
    bottom: 0;
    left: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 2;
}

.product-label {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 40px;
    padding: 4px 8px;
    font-size: 13px;
    line-height: 16px;
    background-position: center;
    background-size: cover;
    color: #fff;
    text-align: center;
    pointer-events: none;
}

.product-label img {
    max-width: 100%;
    max-height: 100%;
}

.product-label span {
    position: relative;
    z-index: 1;
}

.product-label--top-left {
    top: 10px;
    left: 10px;
}

.product-label--top-right {
    top: 10px;
    right: 10px;
}

.product-label--bottom-left {
    bottom: 10px;
    left: 10px;
}

.product-label--bottom-right {
    bottom: 10px;
    right: 10px;
}

/* Stack multiple labels sharing a corner */
.product-label--top-left ~ .product-label--top-left,
.product-label--top-right ~ .product-label--top-right {
    margin-top: 30px;
}

.product-label--discount {
    background-color: #d23b46;
}

.product-label--new {
    background-color: #ffc817;
    color: #23233a;
    text-transform: uppercase;
}

.product-label--out_of_stock {
    background-color: #6a6a7e;
}

.product-label--backorder {
    background-color: #0e9f6e;
}
