/*
 * PC-1574 badge engine: badges on the product cards (classes/badges/class-pc-badge-frontend.php).
 * Colors, margins and transforms come per badge as custom properties in the style attribute; the mobile
 * transform rule (--pc-badge-tf-m) is added inline at the General Settings breakpoint.
 */

.pc-badges {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 5;
	pointer-events: none;
}

.pc-badges__group {
	position: absolute;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
}

.pc-badges__group--top-left {
	top: 0;
	left: 0;
	align-items: flex-start;
}

.pc-badges__group--top-center {
	top: 0;
	left: 50%;
	align-items: center;
	transform: translateX(-50%);
}

.pc-badges__group--top-right {
	top: 0;
	right: 0;
	align-items: flex-end;
}

.pc-badges__group--middle-left {
	top: 50%;
	left: 0;
	align-items: flex-start;
	transform: translateY(-50%);
}

.pc-badges__group--middle-center {
	top: 50%;
	left: 50%;
	align-items: center;
	transform: translate(-50%, -50%);
}

.pc-badges__group--middle-right {
	top: 50%;
	right: 0;
	align-items: flex-end;
	transform: translateY(-50%);
}

.pc-badges__group--bottom-left {
	flex-direction: column-reverse;
	bottom: 0;
	left: 0;
	align-items: flex-start;
}

.pc-badges__group--bottom-center {
	flex-direction: column-reverse;
	bottom: 0;
	left: 50%;
	align-items: center;
	transform: translateX(-50%);
}

.pc-badges__group--bottom-right {
	flex-direction: column-reverse;
	bottom: 0;
	right: 0;
	align-items: flex-end;
}

.pc-badge {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--pc-badge-fg, #1a1a1a);
	transform: var(--pc-badge-tf, none);
}

/* F7.3 formatting: the same weight in the editor preview and on the card (wp-admin sets strong/b to 600). */
.pc-badge strong,
.pc-badge b {
	font-weight: 700;
}

.pc-badge[hidden] {
	display: none;
}

.pc-badge--text,
.pc-badge--css,
.pc-badge--fallback {
	padding: 4px 8px;
	background-color: var(--pc-badge-bg, #ffe14f);
}

.pc-badge--preset-rounded {
	border-radius: 6px;
}

.pc-badge--preset-pill {
	border-radius: 999px;
}

.pc-badge--preset-circle {
	min-width: 3.2em;
	min-height: 3.2em;
	padding: 4px;
	border-radius: 50%;
}

.pc-badge__text {
	display: block;
	overflow-wrap: anywhere;
}

.pc-badge--advanced,
.pc-badge--css-template,
.pc-badge--image-template {
	padding: 0;
	background: none;
}

/*
 * CSS template badges (the YITH library, class yith-wcbm-badge-css): the look of a YITH CSS badge from the YITH Badge
 * Management frontend.css 3.30.0 (.yith-wcbm-badge, .yith-wcbm-badge-css, .yith-wcbm-css-text, p), so the badge looks
 * the same with or without the YITH plugin's stylesheet; the shop's own stylesheet styles the same class names on top.
 * Unlike YITH the badge is not absolute: it stays in its position group (relative: the template parts are placed in it).
 */
.pc-badges .pc-badge.yith-wcbm-badge-css,
.pc-badge.yith-wcbm-badge-css {
	position: relative;
	flex-direction: column;
	justify-content: center;
	min-width: max-content;
	max-width: none;
	padding: 0;
	font-size: 13px;
	font-weight: 400;
	line-height: normal;
	text-align: center;
	color: #3c434a;
}

.pc-badge.yith-wcbm-badge-css .yith-wcbm-badge__wrap * {
	word-break: keep-all;
	overflow-wrap: normal;
}

.pc-badge.yith-wcbm-badge-css .yith-wcbm-css-text,
.pc-badge.yith-wcbm-badge-css .yith-wcbm-badge-text {
	display: block;
	font-size: 12pt;
	color: #fff;
}

.pc-badge.yith-wcbm-badge-css p {
	margin: 0;
	font-size: inherit;
	line-height: inherit;
}

/*
 * K5b (Aron, 2026-11-09: the badge shows on the product page). The shop's own stylesheet hides the YITH CSS badges
 * there (.single-product .yith-wcbm-badge.yith-wcbm-badge-css { display: none !important }, measured on staging
 * 2026-11-15); a badge that has not started yet stays hidden.
 */
.single-product .pc-badges .pc-badge.yith-wcbm-badge-css:not([hidden]) {
	display: inline-flex !important;
}

/*
 * Shop font (Tamas, 2026-11-15: the font set in WPCodeBox, not Open Sans): the badge inherits the page font, the
 * WPCodeBox snippet "Website SCSS" sets it (body geologica-light; b / strong and .yith-wcbm-badge-text span
 * geologica-medium). The YITH frontend.css gives Open Sans to the YITH class names our badges carry
 * (.yith-wcbm-badge, .yith-wcbm-badge.yith-wcbm-badge-css); these selectors are stronger than those.
 */
.pc-badge.pc-badge.yith-wcbm-badge,
.pc-badge .yith-wcbm-badge {
	font-family: inherit;
}

/* The template svg only carries the template's stylesheet (YITH hides it the same way). */
.pc-badge.yith-wcbm-badge-css .pc-badge__tpl {
	display: none;
}

.pc-badge__shape {
	position: relative;
	display: inline-block;
	line-height: 1;
}

.pc-badge__tpl {
	display: block;
	max-width: 100%;
	height: auto;
}

.pc-badge__shape .yith-wcbm-saved-percentage,
.pc-badge__shape .yith-wcbm-saved-money,
.pc-badge__shape .yith-wcbm-symbol-off {
	position: absolute;
	left: 0;
	margin: 0;
	color: var(--badge-text-color, #fff);
}

.pc-badge--flip .pc-badge__text {
	transform: scaleX(-1);
}

/* F7 flip direction: without a direction class the pre-F7 horizontal flip above applies. */
.pc-badge--flip.pc-badge--flip-vertical .pc-badge__text {
	transform: scaleY(-1);
}

.pc-badge--flip.pc-badge--flip-both .pc-badge__text {
	transform: scale(-1, -1);
}

.pc-badges .pc-badge__img {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
}
