/**
 * ProsperX Flash Sales — frontend styles
 *
 * Theme-aware: inherits .pl-badge base styles from ProsperX Labs theme.
 * Uses CSS variables --pfs-accent and --pfs-urgency injected by the plugin.
 */

:root {
	--pfs-accent: #ff3d6e;
	--pfs-urgency: #ff3d6e;
	--pfs-dark: #2a1c4d;
	--pfs-deep: #432d76;
	--pfs-text-light: #ffffff;
}

/* ──────────────────────────────────────────────────────────
 * 1. FLASH SALE BADGE
 *    Inherits pill base from theme (.pl-badge). We just add the
 *    flashsale variant + a WooCommerce fallback if theme isn't active.
 * ────────────────────────────────────────────────────────── */
.pl-badge.pl-badge--flashsale,
.pl-badge--flashsale {
	background: linear-gradient(135deg, var(--pfs-accent) 0%, #ff6b9d 100%);
	color: var(--pfs-text-light);
	box-shadow: 0 2px 8px rgba(255, 61, 110, 0.35);
	position: relative;
	overflow: hidden;
}

.pl-badge--flashsale::before {
	content: "";
	position: absolute;
	top: 0; left: -100%;
	width: 100%; height: 100%;
	background: linear-gradient(
		90deg,
		transparent 0%,
		rgba(255, 255, 255, 0.4) 50%,
		transparent 100%
	);
	animation: pfsBadgeShine 3.5s ease-in-out infinite;
}

@keyframes pfsBadgeShine {
	0%   { left: -100%; }
	60%  { left: 100%; }
	100% { left: 100%; }
}

/* WooCommerce / non-theme fallback */
.pfs-badge.pfs-badge--fallback {
	display: inline-block;
	background: linear-gradient(135deg, var(--pfs-accent) 0%, #ff6b9d 100%);
	color: var(--pfs-text-light);
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 6px 12px;
	border-radius: 999px;
	box-shadow: 0 2px 8px rgba(255, 61, 110, 0.35);
}

/* ──────────────────────────────────────────────────────────
 * 2. PRODUCT-PAGE COUNTDOWN TIMER PANEL
 * ────────────────────────────────────────────────────────── */
.pfs-product-timer {
	background: linear-gradient(135deg, var(--pfs-deep) 0%, var(--pfs-dark) 100%);
	color: var(--pfs-text-light);
	border-radius: 14px;
	padding: 18px 20px;
	margin: 18px 0 22px;
	box-shadow: 0 6px 24px rgba(67, 45, 118, 0.25);
	position: relative;
	overflow: hidden;
}

.pfs-product-timer::before {
	content: "";
	position: absolute;
	top: -50%; right: -10%;
	width: 240px; height: 240px;
	background: radial-gradient(circle, rgba(255, 61, 110, 0.25) 0%, transparent 70%);
	pointer-events: none;
}

.pfs-product-timer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
	position: relative;
	z-index: 1;
	flex-wrap: wrap;
}

.pfs-product-timer__badge {
	display: inline-block;
	background: var(--pfs-accent);
	color: var(--pfs-text-light);
	font-size: 0.7rem;
	font-weight: 900;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 5px 11px;
	border-radius: 999px;
	box-shadow: 0 2px 6px rgba(255, 61, 110, 0.4);
}

.pfs-product-timer__saving {
	font-size: 0.95rem;
	font-weight: 700;
	color: #ffd54a;
	letter-spacing: 0.02em;
}

.pfs-product-timer__body {
	position: relative;
	z-index: 1;
}

.pfs-product-timer__label {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	opacity: 0.7;
	margin-bottom: 8px;
}

.pfs-product-timer__clock {
	display: flex;
	align-items: center;
	gap: 4px;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
}

.pfs-cd-cell {
	display: flex;
	flex-direction: column;
	align-items: center;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	padding: 8px 10px;
	min-width: 54px;
	backdrop-filter: blur(4px);
	transition: background 0.3s ease;
}

.pfs-cd-num {
	font-size: 1.7rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: 0.02em;
	font-variant-numeric: tabular-nums;
}

.pfs-cd-lbl {
	font-size: 0.6rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.7;
	margin-top: 4px;
}

.pfs-cd-sep {
	font-size: 1.5rem;
	font-weight: 800;
	opacity: 0.5;
	padding: 0 2px;
	align-self: flex-start;
	margin-top: 8px;
}

/* Urgency state (< 1 hour remaining) */
.pfs-product-timer.is-urgent .pfs-cd-cell {
	background: rgba(255, 61, 110, 0.25);
	animation: pfsPulse 1s ease-in-out infinite;
}

@keyframes pfsPulse {
	0%, 100% { transform: scale( 1 ); }
	50%      { transform: scale( 1.04 ); }
}

/* ──────────────────────────────────────────────────────────
 * 3. SITE-WIDE BANNER (top of every page)
 * ────────────────────────────────────────────────────────── */
.pfs-site-banner {
	background: linear-gradient(90deg, var(--pfs-deep) 0%, var(--pfs-accent) 100%);
	color: var(--pfs-text-light);
	padding: 8px 16px;
	text-align: center;
	position: relative;
	z-index: 999;
	font-size: 0.875rem;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}

.pfs-site-banner__inner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	flex-wrap: wrap;
	max-width: 1200px;
	margin: 0 auto;
}

.pfs-site-banner__badge {
	display: inline-block;
	background: rgba(255, 255, 255, 0.2);
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.pfs-site-banner__sep {
	opacity: 0.6;
}

.pfs-site-banner__text {
	font-weight: 600;
}

.pfs-site-banner__clock {
	display: inline-flex;
	gap: 4px;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
	font-weight: 800;
	letter-spacing: 0.04em;
}

.pfs-site-banner__clock [data-d]::after,
.pfs-site-banner__clock [data-h]::after,
.pfs-site-banner__clock [data-m]::after {
	content: ":";
	margin-left: 2px;
	opacity: 0.6;
}

/* Hide days segment if zero */
.pfs-site-banner__clock.no-days [data-d],
.pfs-site-banner__clock.no-days [data-d]::after {
	display: none;
}

/* ──────────────────────────────────────────────────────────
 * 4. PRODUCT CARD CLOCK (tiny chip on storefront cards)
 * ────────────────────────────────────────────────────────── */
.pfs-card-clock {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	background: rgba(42, 28, 77, 0.92);
	color: var(--pfs-text-light);
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	padding: 4px 8px;
	border-radius: 6px;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
	margin-top: 6px;
}

.pfs-card-clock::before {
	content: "⏱";
	margin-right: 3px;
	font-size: 0.85rem;
}

.pfs-card-clock [data-h]::after,
.pfs-card-clock [data-m]::after {
	content: ":";
	opacity: 0.6;
}

.pfs-card-clock.is-urgent {
	background: var(--pfs-urgency);
	animation: pfsPulse 1.2s ease-in-out infinite;
}

/* ──────────────────────────────────────────────────────────
 * 5. RESPONSIVE
 * ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
	.pfs-product-timer {
		padding: 16px;
		border-radius: 12px;
	}
	.pfs-cd-cell {
		min-width: 44px;
		padding: 7px 6px;
	}
	.pfs-cd-num {
		font-size: 1.35rem;
	}
	.pfs-cd-lbl {
		font-size: 0.55rem;
	}
	.pfs-cd-sep {
		font-size: 1.2rem;
		padding: 0 1px;
	}
	.pfs-product-timer__saving {
		font-size: 0.85rem;
	}
	.pfs-site-banner {
		font-size: 0.78rem;
		padding: 7px 10px;
	}
	.pfs-site-banner__inner {
		gap: 7px;
	}
}

@media (max-width: 380px) {
	.pfs-product-timer__head {
		flex-direction: column;
		align-items: flex-start;
	}
	.pfs-site-banner__sep {
		display: none;
	}
}

/* ──────────────────────────────────────────────────────────
 * 6. SAVE $X CHIP — shown next to discounted prices everywhere
 *    (single product, cart, mini-cart, catalog cards)
 *    Works even when the theme hides <del> strikethroughs.
 * ────────────────────────────────────────────────────────── */
.pfs-save-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: linear-gradient(135deg, var(--pfs-accent) 0%, #ff6b9d 100%);
	color: #fff;
	font-size: 0.68rem;
	font-weight: 900;
	letter-spacing: 0.06em;
	padding: 4px 9px;
	border-radius: 999px;
	box-shadow: 0 3px 10px rgba(255, 61, 110, 0.32);
	vertical-align: middle;
	margin-left: 6px;
	line-height: 1;
	text-transform: uppercase;
	white-space: nowrap;
	position: relative;
	top: -1px;
	animation: pfsChipPop 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

@keyframes pfsChipPop {
	from { transform: scale(0.6); opacity: 0; }
	to   { transform: scale(1);   opacity: 1; }
}

.pfs-save-chip__label   { opacity: 0.85; }
.pfs-save-chip__amount  { font-weight: 900; }
.pfs-save-chip__pct {
	background: rgba(255, 255, 255, 0.22);
	padding: 1px 6px;
	border-radius: 999px;
	font-size: 0.92em;
}

/* ──────────────────────────────────────────────────────────
 * 7. CUSTOM PRICE STRUCTURE (replaces WC's <del>/<ins>)
 *
 *    On a flash-sale product, our PHP filter outputs:
 *        <span class="pfs-price">
 *          <span class="pfs-price__old">$60.00</span>
 *          <span class="pfs-price__new">$54.00</span>
 *          <span class="pfs-save-chip">…</span>  (optional)
 *        </span>
 *
 *    These class names are unique to us — no theme rule
 *    targets them, so the layout is bulletproof.
 * ────────────────────────────────────────────────────────── */

/* Default: two-line stacked layout (old above, new below) */
.pfs-price {
	display: inline-block;
	line-height: 1.18;
	vertical-align: middle;
}

.pfs-price__old {
	display: block;
	opacity: 0.5;
	font-size: 0.78em;
	font-weight: 600;
	color: var(--pfs-dark);
	text-decoration: line-through;
	text-decoration-thickness: 1.5px;
	text-decoration-color: rgba(42, 28, 77, 0.6);
	margin: 0 0 5px 0;
	line-height: 1.1;
	letter-spacing: 0;
}

.pfs-price__old .woocommerce-Price-amount,
.pfs-price__old bdi {
	color: inherit !important;
	font-size: inherit !important;
	font-weight: inherit !important;
	text-decoration: inherit;
	background: transparent !important;
}

.pfs-price__new {
	display: block;
	color: var(--pfs-accent) !important;
	font-weight: 900;
	font-size: 1.15em;
	line-height: 1.05;
	letter-spacing: -0.01em;
}

.pfs-price__new .woocommerce-Price-amount,
.pfs-price__new bdi {
	color: var(--pfs-accent) !important;
	font-size: inherit !important;
	font-weight: inherit !important;
	background: transparent !important;
}

/* Range separator (for variable "From $X – $Y") */
.pfs-price__sep {
	margin: 0 5px;
	opacity: 0.55;
	font-weight: 700;
}

/* ── Context: size cards on product page ─────────────────── */
/* Roomy two-line stack — clean, readable, breathing room */
.pl-pack__price .pfs-price {
	display: block;
}
.pl-pack__price .pfs-price__old {
	font-size: 0.78em;
	margin-bottom: 6px;
}
.pl-pack__price .pfs-price__new {
	font-size: 1.25em;
}

/* ── Context: "SELECTED:" line ───────────────────────────── */
/* Inline with an arrow between for instant readability */
.pl-selected__price .pfs-price {
	display: inline-flex;
	align-items: baseline;
	gap: 12px;
}
.pl-selected__price .pfs-price__old {
	display: inline-block;
	margin: 0;
	font-size: 0.92em;
}
.pl-selected__price .pfs-price__new {
	display: inline-flex;
	align-items: baseline;
	font-size: 1.08em;
}
.pl-selected__price .pfs-price__new::before {
	content: "→";
	margin-right: 10px;
	opacity: 0.4;
	color: var(--pfs-dark);
	font-weight: 700;
	font-size: 0.85em;
}

/* ── Context: storefront product cards ───────────────────── */
/* Two-line stack same as size cards */
.product-footer-stack .price .pfs-price,
.product-card .price .pfs-price,
.price-wrap .price .pfs-price {
	display: block;
}
.product-footer-stack .price .pfs-price__old,
.product-card .price .pfs-price__old,
.price-wrap .price .pfs-price__old {
	font-size: 0.72em;
	margin-bottom: 4px;
}
.product-footer-stack .price .pfs-price__new,
.product-card .price .pfs-price__new,
.price-wrap .price .pfs-price__new {
	font-size: 1.1em;
}

/* ── Context: main product page big price ────────────────── */
/* Inline horizontal layout with chip — biggest, most prominent */
.pl-product__price .pfs-price,
.single-price .pfs-price {
	display: inline-flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 12px;
}
.pl-product__price .pfs-price__old,
.single-price .pfs-price__old {
	display: inline-block;
	font-size: 0.55em;
	margin: 0;
	opacity: 0.45;
}
.pl-product__price .pfs-price__new,
.single-price .pfs-price__new {
	display: inline-block;
	font-size: 1em;
}

/* ── SAVE chip placement ─────────────────────────────────── */
/* Default: hidden in tight contexts, visible in roomy ones */
.pfs-price .pfs-save-chip {
	display: none !important;
}

/* Show on the main product page big price area only */
.pl-product__price .pfs-price .pfs-save-chip,
.single-price .pfs-price .pfs-save-chip {
	display: inline-flex !important;
	margin-left: 4px;
	font-size: 0.72rem;
	padding: 5px 11px;
}

/* Mobile sizing tweaks */
@media (max-width: 640px) {
	.pl-pack__price .pfs-price__old {
		font-size: 0.74em;
		margin-bottom: 4px;
	}
	.pl-pack__price .pfs-price__new {
		font-size: 1.15em;
	}
	.pl-selected__price .pfs-price {
		gap: 8px;
	}
	.pl-selected__price .pfs-price__new::before {
		margin-right: 7px;
	}
	.product-footer-stack .price .pfs-price__old,
	.product-card .price .pfs-price__old {
		font-size: 0.7em;
		margin-bottom: 3px;
	}
	.pl-product__price .pfs-save-chip {
		font-size: 0.64rem;
		padding: 4px 9px;
	}
}
