/* YITH Badge Management */

.yith-wcbm-badge {
	z-index: 3;
}

.yith-wcbm-badge-text {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: -0.1px;
	font-weight: bold;
}

.iconic-wsb-product-bumps__image .yith-wcbm-badge {
	display: none !important;
}

/* Black text on yellow boxes. These exclusions are intentionally badge-specific styling rules. */
.yith-wcbm-badge.yith-wcbm-badge-text:not(.yith-wcbm-badge-34432):not(.yith-wcbm-badge-43067):not(.yith-wcbm-badge-34427) p {
	color: #000;
}

/* Positioning contexts for PHP-wrapped badge groups */
.container-image-and-badge,
.product-images,
.woocommerce-product-gallery,
.woocommerce-product-gallery__image,
a.img-thumbnail:has(.sc-yith-wcbm-badges) {
	position: relative;
}

/* Flex wrapper added by PHP */
.sc-yith-wcbm-badges {
	position: absolute;
	top: 6px;
	right: 6px;
	left: auto;
	bottom: auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	width: calc(100% - 12px);
	z-index: 3;
	line-height: normal;
	text-indent: 0;
	pointer-events: none;
}

body.single-product .product-images .sc-yith-wcbm-badges,
body.single-product .woocommerce-product-gallery .sc-yith-wcbm-badges,
body.single-product .woocommerce-product-gallery__image .sc-yith-wcbm-badges {
	top: 10px;
	right: 10px;
	gap: 5px;
	width: calc(100% - 20px);
}

/* Keep linked product images clickable */
.sc-yith-wcbm-badges .yith-wcbm-badge {
	pointer-events: none;
}

/* Let flexbox handle stacking */
.sc-yith-wcbm-badges > .yith-wcbm-badge {
	position: static !important;
	top: auto !important;
	right: auto !important;
	bottom: auto !important;
	left: auto !important;
	margin: 0 !important;
	width: auto !important;
	height: auto !important;
	min-width: max-content;
	max-width: 100%;
	transform-origin: top right;
}

.sc-yith-wcbm-badges > .yith-wcbm-badge-34427 {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	right: auto !important;
	transform-origin: top left;
}

/* Keep badge text compact */
.sc-yith-wcbm-badges > .yith-wcbm-badge .yith-wcbm-badge-text,
.sc-yith-wcbm-badges > .yith-wcbm-badge .yith-wcbm-badge__wrap {
	display: inline-block;
	max-width: 100%;
}

.sc-yith-wcbm-badges > .yith-wcbm-badge .yith-wcbm-badge-text {
	white-space: nowrap;
}

/*
Hide badge groups until JS has calculated the final visible set,
then fade them in subtly.
*/
.sc-yith-wcbm-badges {
	opacity: 0;
	transition: opacity 160ms ease-in;
}

.sc-yith-wcbm-badges.sc-yith-wcbm-ready {
	opacity: 1;
}

/* Existing desktop scaling outside single product pages */
body:not(.single-product) .sc-yith-wcbm-badges > .yith-wcbm-badge {
	transform-origin: top right;
}

body:not(.single-product) .sc-yith-wcbm-badges > .yith-wcbm-badge-34432 {
	transform-origin: top left;
}

@media screen and (min-width: 998px) and (max-width: 1315px) {
	body:not(.single-product) .sc-yith-wcbm-badges > .yith-wcbm-badge {
		transform: scale(0.8);
	}
}

@media screen and (max-width: 480px) {
	.sc-yith-wcbm-badges {
		top: 4px;
		right: 4px;
		gap: 3px;
		max-width: calc(100% - 8px);
	}

	.sc-yith-wcbm-badges > .yith-wcbm-badge .yith-wcbm-badge-text {
		white-space: normal;
	}
}