/* D4S Smart Product Labels v1.4.0 — Modern Premium */
.woocommerce ul.products li.product,
.woocommerce div.product .woocommerce-product-gallery {
    position: relative;
}

.d4s-spl-badge {
    position: absolute !important;
    top: var(--d4s-spl-top, 0px);
    right: var(--d4s-spl-offset, 0px);
    left: auto;
    z-index: 25;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    max-width: 95%;
    padding: 7px 14px;
    background-color: var(--d4s-spl-bg, #2768b6);
    background-image: linear-gradient(135deg, rgba(255,255,255,.19) 0%, rgba(255,255,255,.035) 46%, rgba(0,0,0,.13) 100%);
    color: var(--d4s-spl-fg, #ffffff);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    direction: rtl;
    text-align: center;
    white-space: nowrap;
    border: 0;
    border-radius: 0 0 0 10px;
    box-sizing: border-box;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .16), inset 0 1px 0 rgba(255,255,255,.22);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    isolation: isolate;
}

.d4s-spl-badge[data-d4s-position="left"] {
    left: var(--d4s-spl-offset, 0px);
    right: auto;
}

.d4s-spl-badge[data-d4s-position="right"] {
    right: var(--d4s-spl-offset, 0px);
    left: auto;
}

/* Anchor the badge to the actual product image, not the full card. */
.d4s-spl-image-anchor {
    position: relative !important;
    display: block;
    isolation: isolate;
}

.d4s-spl-image-anchor > .d4s-spl-badge {
    top: var(--d4s-spl-top, 0px);
}

/* Premium surface detail. Does not alter positioning or JS collision avoidance. */
.d4s-spl-badge::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, .18);
    pointer-events: none;
}

@media (max-width: 767px) {
    .d4s-spl-badge {
        max-width: calc(100% - 8px);
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .d4s-spl-badge {
        transition: box-shadow .2s ease, background-color .2s ease;
    }
}

/* v1.6.0 — Corner Ribbon: preserve the existing image anchoring and collision handling. */
.d4s-spl-badge .d4s-spl-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-inline-end: 7px;
    font-size: 1.1em;
    line-height: 1;
    flex-shrink: 0;
}
.d4s-spl-badge.d4s-spl-style-ribbon {
    background: var(--d4s-spl-bg, #2768b6);
    color: var(--d4s-spl-fg, #fff);
    border: 0;
    border-radius: 0 !important;
    padding-inline-start: 19px !important;
    padding-inline-end: 23px !important;
    box-shadow: 0 4px 12px rgba(15,23,42,.18);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%);
    min-height: 32px;
    text-shadow: 0 1px 1px rgba(0,0,0,.12);
}
.d4s-spl-badge.d4s-spl-style-ribbon[data-d4s-position="left"] {
    clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%);
}
.d4s-spl-badge.d4s-spl-style-ribbon::after {
    border: 0;
    border-top: 1px solid rgba(255,255,255,.22);
    border-radius: 0;
}
@media (max-width: 767px) {
    .d4s-spl-badge.d4s-spl-style-ribbon {
        min-height: 29px;
        padding-inline-start: 15px !important;
        padding-inline-end: 20px !important;
    }
}

/* v1.6.1 — explicit text-only badge, no reserved icon spacing. */
.d4s-spl-badge .d4s-spl-icon[hidden] { display: none !important; }
.d4s-spl-badge .d4s-spl-label-text { display: inline-block; }
