/**
 * Copyright since 2026 Prestacraft
 *
 * Stackable Product Labels - Front Office Styles
 *
 * @author    Prestacraft <contact@prestacraft.com>
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
 */

/* Hide native PrestaShop product flags when our labels are present */
.prestacraftlabels-container ~ .product-flags,
.product-flags:has(~ .prestacraftlabels-container) {
    display: none !important;
}

/* Container - overlays product image */
.prestacraftlabels-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

/* Ensure parent containers have relative positioning */
.product-miniature .thumbnail-container,
.product-miniature .product-thumbnail,
.product__images .carousel-inner,
.product__images,
.js-images-container,
.product-cover,
.images-container,
.product-images > .product-cover {
    position: relative;
}

/* Base label style */
.prestacraftlabels-label {
    position: absolute;
    display: inline-block;
    padding: 4px 10px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: opacity 0.2s ease;
    box-sizing: border-box;
}

/* ─── 8 Positions ─────────────────────────────────────── */

.prestacraftlabels-label.pos-top-left {
    top: 8px;
    left: 8px;
}

.prestacraftlabels-label.pos-top-center {
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.prestacraftlabels-label.pos-top-right {
    top: 8px;
    right: 8px;
}

.prestacraftlabels-label.pos-middle-left {
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
}

.prestacraftlabels-label.pos-middle-right {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}

.prestacraftlabels-label.pos-bottom-left {
    bottom: 8px;
    left: 8px;
}

.prestacraftlabels-label.pos-bottom-center {
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.prestacraftlabels-label.pos-bottom-right {
    bottom: 8px;
    right: 8px;
}

/* ─── Shapes ──────────────────────────────────────────── */

.prestacraftlabels-label.shape-rectangle {
    border-radius: 0;
}

.prestacraftlabels-label.shape-rounded {
    border-radius: 4px;
}

.prestacraftlabels-label.shape-circle {
    border-radius: 50%;
    padding: 8px;
    text-align: center;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.prestacraftlabels-label.shape-ribbon {
    clip-path: polygon(0 0, 100% 0, 90% 50%, 100% 100%, 0 100%);
    padding-right: 16px;
}

/* Ribbon on right side needs mirrored clip-path */
.prestacraftlabels-label.shape-ribbon.pos-top-right,
.prestacraftlabels-label.shape-ribbon.pos-middle-right,
.prestacraftlabels-label.shape-ribbon.pos-bottom-right {
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 10% 100%, 0 50%);
    padding-right: 10px;
    padding-left: 16px;
}

/* ─── Stacking: handled dynamically by front.js ─────── */

/* ─── Responsive ──────────────────────────────────────── */

@media (max-width: 768px) {
    .prestacraftlabels-label {
        font-size: 10px !important;
        padding: 3px 6px;
    }

    .prestacraftlabels-label.shape-circle {
        padding: 5px;
        min-width: 28px;
        min-height: 28px;
    }

    .prestacraftlabels-label.shape-ribbon {
        padding-right: 12px;
    }

    .prestacraftlabels-label.pos-top-left,
    .prestacraftlabels-label.pos-top-right,
    .prestacraftlabels-label.pos-bottom-left,
    .prestacraftlabels-label.pos-bottom-right {
        top: 4px;
    }

    .prestacraftlabels-label.pos-bottom-left,
    .prestacraftlabels-label.pos-bottom-right,
    .prestacraftlabels-label.pos-bottom-center {
        bottom: 4px;
    }
}

@media (max-width: 480px) {
    .prestacraftlabels-label {
        font-size: 9px !important;
        padding: 2px 5px;
    }
}

/* ─── Print: hide labels ──────────────────────────────── */

@media print {
    .prestacraftlabels-container {
        display: none;
    }
}
