/**
 * PDP labels overlay on product image (M1-style placement).
 *
 * Important: individual labels keep their own CSS classes and inline
 * positioning (migrated from M1 / Amasty). This file only makes sure
 * the labels container sits over the gallery area and does not try
 * to restyle or reposition each label.
 */

/* Make the media wrapper a positioning context */
.product.media {
    position: relative;
}

/* Stretch labels wrapper over the image area */
.product.media .all-labels {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    pointer-events: none;
    width: 350px;
    height: 450px;
}

/* Allow each label to receive clicks and use its own styles/positions */
.product.media .all-labels > div,
.product.media .all-labels > span {
    pointer-events: auto;
}

/* Base for Amasty-style positioned labels (amlabel-table2) on PDP */
.product.media .all-labels .amlabel-table2 {
    position: absolute;
    z-index: 4;
}

.product.media .all-labels .amlabel-table2.top-left {
    top: 0;
    left: 0;
}

.product.media .all-labels .amlabel-table2.top-center {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.product.media .all-labels .amlabel-table2.top-right {
    top: 0;
    right: 0;
}

.product.media .all-labels .amlabel-table2.middle-left {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.product.media .all-labels .amlabel-table2.middle-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.product.media .all-labels .amlabel-table2.bottom-left {
    /* Lift bottom-left labels (e.g. Bestseller) above the thumbnail strip */
    bottom: 0;
    left: 0;
}

.product.media .all-labels .amlabel-table2.bottom-right {
    bottom: 0;
    right: 0;
}

.product.media .all-labels .amlabel-table2.bottom-center {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.product.media .all-labels .amlabel-table2.middle-right {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

/* Shared discount label styling (M1-style) for PDP + PLP.
   Matches original rule from styles.css:
   .sticker .labelsale { background-image: url(../images/icon-sale.png); ... } */
.all-labels .sticker .labelsale {
    background-image: url(../images/icon-sale.png);
    background-repeat: no-repeat;
    background-position: 0 0;
    height: 44px;
    line-height: 35px;
    width: 52px;
    background-color: transparent;
    color: #ffffff;
    text-align: center;
    text-transform: uppercase;
    padding: 0 10px;
    font-size: 12px;
    display: block;
}

/* Ensure the sticker container is anchored over the image (PDP + PLP). */
.all-labels .sticker {
    position: absolute;
    z-index: 6;
}

.all-labels .sticker.top-right {
    top: 0;
    right: 0;
}

.all-labels .sticker.top-left {
    top: 0;
    left: 0;
}

/* New label: green M1-style ribbon */
.all-labels .sticker .labelnew {
    background-color: #009a3d;
    color: #ffffff;
    display: block;
    padding: 0 12px;
    height: 26px;
    line-height: 26px;
    font-size: 12px;
    text-transform: uppercase;
    text-align: center;
}

/* Preorder label: red ribbon (same structure as .labelnew) */
.all-labels .sticker .labelpreorder {
    background-color: #d60b15;
    color: #ffffff;
    display: block;
    padding: 0 12px;
    height: 26px;
    line-height: 26px;
    font-size: 12px;
    text-transform: uppercase;
    text-align: center;
}

/* PLP: overlay labels on product image area for list-style38 and list-style41 */
.product-list-style-38 .product-item-top,
.product-list-style-41 .product-item-top {
    position: relative;
}

.product-list-style-38 .all-labels--plp,
.product-list-style-41 .all-labels--plp {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    pointer-events: none;
    /* Constrain overlay to main image area (PLP category/search) */
    width: 193px;
    height: 200px;
}

/* Homepage: Codazon widgets use larger image box */
body.cms-index-index .product-list-style-38 .all-labels--plp,
body.cms-index-index .product-list-style-41 .all-labels--plp {
    width: 212px;
    height: 200px;
}

.product-list-style-38 .all-labels--plp > div,
.product-list-style-41 .all-labels--plp > div {
    pointer-events: auto;
}

/* PLP: position Amasty-style labels by Category Position (cat_pos) */
.product-list-style-38 .all-labels--plp .amlabel-table2,
.product-list-style-41 .all-labels--plp .amlabel-table2 {
    position: absolute;
    z-index: 4;
}

.product-list-style-38 .all-labels--plp .amlabel-table2.top-left,
.product-list-style-41 .all-labels--plp .amlabel-table2.top-left {
    top: 0;
    left: 0;
}

.product-list-style-38 .all-labels--plp .amlabel-table2.top-center,
.product-list-style-41 .all-labels--plp .amlabel-table2.top-center {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.product-list-style-38 .all-labels--plp .amlabel-table2.top-right,
.product-list-style-41 .all-labels--plp .amlabel-table2.top-right {
    top: 0;
    right: 0;
}

.product-list-style-38 .all-labels--plp .amlabel-table2.middle-left,
.product-list-style-41 .all-labels--plp .amlabel-table2.middle-left {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.product-list-style-38 .all-labels--plp .amlabel-table2.middle-center,
.product-list-style-41 .all-labels--plp .amlabel-table2.middle-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.product-list-style-38 .all-labels--plp .amlabel-table2.bottom-left,
.product-list-style-41 .all-labels--plp .amlabel-table2.bottom-left {
    bottom: 0;
    left: 0;
}

.product-list-style-38 .all-labels--plp .amlabel-table2.bottom-right,
.product-list-style-41 .all-labels--plp .amlabel-table2.bottom-right {
    bottom: 0;
    right: 0;
}

.product-list-style-38 .all-labels--plp .amlabel-table2.bottom-center,
.product-list-style-41 .all-labels--plp .amlabel-table2.bottom-center {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.product-list-style-38 .all-labels--plp .amlabel-table2.middle-right,
.product-list-style-41 .all-labels--plp .amlabel-table2.middle-right {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}
