/**
 * Smart Badges Styling
 */

/* Ensure parent containers are relative for absolute badges */
.woocommerce ul.products li.product,
.woocommerce div.product div.images {
	position: relative;
}

.pb-badges-zone {
	position: absolute;
	display: flex;
	flex-direction: column;
	gap: 6px;
	z-index: 10;
	pointer-events: none;
}

/* Positioning Zones */
.pb-zone-top-left {
	top: 15px;
	left: 15px;
	align-items: flex-start;
}

.pb-zone-top-right {
	top: 15px;
	right: 15px;
	align-items: flex-end;
}

.pb-zone-bottom-left {
	bottom: 15px;
	left: 15px;
	align-items: flex-start;
}

.pb-zone-bottom-right {
	bottom: 15px;
	right: 15px;
	align-items: flex-end;
}

/* Base Badge Style */
.pb-badge {
	position: relative;
	z-index: 1;
	display: inline-block;
	padding: 4px 12px;
	font-size: 0.75rem;
	font-weight: 800;
	text-transform: uppercase;
	border-radius: 4px;
	letter-spacing: 0.5px;
	transition: all 0.3s ease;
	pointer-events: auto; /* re-enable hover events overridden by parent */
}
.pb-badge:hover {
	z-index: 20;
}

/* --- STYLE: SOLID --- */
.pb-badge-style-solid .pb-badge {
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
	color: white;
	/* Soft gradient using the dynamic RGB color */
	background: linear-gradient(135deg, rgb(var(--pb-badge-rgb, 100, 116, 139)) 0%, rgba(var(--pb-badge-rgb, 100, 116, 139), 0.8) 100%);
}

/* --- STYLE: OUTLINE --- */
.pb-badge-style-outline .pb-badge {
	background: white;
	box-shadow: 0 2px 5px rgba(0,0,0,0.05);
	border: 1.5px solid rgb(var(--pb-badge-rgb, 100, 116, 139));
	color: rgb(var(--pb-badge-rgb, 100, 116, 139));
}

/* --- STYLE: GLASSMORPHISM --- */
.pb-badge-style-glass .pb-badge {
	background: rgba(var(--pb-badge-rgb, 100, 116, 139), 0.2);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid rgba(var(--pb-badge-rgb, 100, 116, 139), 0.5);
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
	color: #fff;
	text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* FOMO Pulse Animation */
.pb-badge-fomo {
	animation: pb-badge-pulse 2s infinite;
}

@keyframes pb-badge-pulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.05); }
	100% { transform: scale(1); }
}

/* Responsive adjustment */
@media (max-width: 768px) {
	.pb-zone-top-left { top: 10px; left: 10px; }
	.pb-zone-top-right { top: 10px; right: 10px; }
	.pb-zone-bottom-left { bottom: 10px; left: 10px; }
	.pb-zone-bottom-right { bottom: 10px; right: 10px; }
	.pb-badge {
		padding: 3px 8px;
		font-size: 0.65rem;
	}
}

/* Burn Badge SVG Icon */
.pb-badge-burn {
	display: inline-flex;
	align-items: center;
}
.pb-badge-burn::before {
	content: "";
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-right: 4px;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Tooltips */
.pb-badge[data-tooltip] {
	position: relative;
	cursor: help;
}

.pb-badge[data-tooltip]::after {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 6px);
	background: rgba(15, 23, 42, 0.95);
	color: #fff;
	padding: 5px 10px;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.2;
	border-radius: 6px;
	width: max-content;
	max-width: 140px;
	text-align: center;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	z-index: 100;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	border: 1px solid rgba(255,255,255,0.1);
	/* Default position (center) */
	left: 50%;
	transform: translateX(-50%) translateY(8px);
}

.pb-badge[data-tooltip]:hover::after {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

/* Zone-specific tooltip alignment to prevent cutoff */
.pb-zone-top-left .pb-badge[data-tooltip]::after,
.pb-zone-bottom-left .pb-badge[data-tooltip]::after {
	left: 0;
}
.pb-zone-top-right .pb-badge[data-tooltip]::after,
.pb-zone-bottom-right .pb-badge[data-tooltip]::after {
	right: 0;
	left: auto;
}

/* Tooltips in TOP zones open DOWNWARDS to avoid being cut off by overflow:hidden */
.pb-zone-top-left .pb-badge[data-tooltip]::after,
.pb-zone-top-right .pb-badge[data-tooltip]::after {
	bottom: auto;
	top: calc(100% + 6px);
	transform: translateY(-8px);
}
.pb-zone-top-left .pb-badge[data-tooltip]:hover::after,
.pb-zone-top-right .pb-badge[data-tooltip]:hover::after {
	transform: translateY(0);
}

/* Tooltips in BOTTOM zones open UPWARDS */
.pb-zone-bottom-left .pb-badge[data-tooltip]::after,
.pb-zone-bottom-right .pb-badge[data-tooltip]::after {
	transform: translateY(8px);
}
.pb-zone-bottom-left .pb-badge[data-tooltip]:hover::after,
.pb-zone-bottom-right .pb-badge[data-tooltip]:hover::after {
	transform: translateY(0);
}
