/**
 * Email Auto Updater — B2B “before price” / offer markup (storefront)
 *
 * Handle: eau-b2b-offer (wp_enqueue_style). Dequeue in child theme and copy
 * selectors you need, or override with higher specificity on live.
 *
 * Disable this file: add_filter( 'eau_b2b_enqueue_offer_stylesheet', '__return_false' );
 *
 * ---------------------------------------------------------------------------
 * CLASS REFERENCE (all outputs)
 * ---------------------------------------------------------------------------
 *
 * Block wrapper (outer)
 *   .eau-b2b-offer                 — root; always present on our blocks
 *   .eau-b2b-offer--before-only   — only strikethrough “before” line, prepended to Woo price HTML
 *   .eau-b2b-offer--full          — full offer from template / shortcode / variation AJAX (before + current + optional badge)
 *   .eau-b2b-offer--loop          — product grid / archive / related / Jet-style cards
 *   .eau-b2b-offer--pdp           — before-only block on single product page (main product price)
 *   .eau-b2b-offer--variable      — container injected for variable products (filled via AJAX)
 *   .eau-b2b-offer--loop-b2b      — appended B2B line in loops when theme price HTML had no Whols amount
 *   .eau-b2b-offer--append-current — modifier on that block (same element as --loop-b2b)
 *   .eau-b2b-offer--loop-price-row — wraps all loop price fragments (Elementor column + JetWoo safe)
 *
 * Inner (from default template or your custom HTML in settings)
 *   .eau-b2b-before               — struck-through “before” amount (contains Woo .woocommerce-Price-amount)
 *   .eau-b2b-current              — current B2B line in full blocks
 *   .eau-b2b-badge                — optional badge span in custom templates ({badge} placeholder)
 *   .eau-b2b-offer__label         — not output by default; add in custom template e.g. <span class="eau-b2b-offer__label">B2B pris</span>
 *
 * Sale flash (image / thumb area; keeps Woo .onsale for theme compatibility)
 *   .eau-b2b-onsale               — our hook; style alongside .onsale
 *   .eau-b2b-sale-flash           — same element; extra hook for your CSS
 *
 * Variable product JS
 *   .eau-b2b-var-offer            — wrapper matched by script (keep class if you replace markup via filter)
 *   .eau-b2b-var-loading          — temporary “…” while AJAX loads
 *
 * WooCommerce still outputs .price, .woocommerce-Price-amount, etc. inside amounts.
 *
 * One line + right align: .eau-b2b-offer--loop-price-row (output in loops). Elementor
 * containers often use flex-direction: column; the row wrapper is one flex child so
 * inner prices stay on a single horizontal line.
 * ---------------------------------------------------------------------------
 */

/* Jet/Elementor: let the row fill the Archive Price widget */
.elementor-widget-jet-woo-builder-archive-product-price .eau-b2b-offer--loop-price-row {
	width: 100%;
	max-width: 100%;
}

/* Single wrapper around before + Woo/Jet price + optional append (shop loops) */
.eau-b2b-offer.eau-b2b-offer--loop-price-row {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	justify-content: flex-end;
	align-items: baseline;
	column-gap: 0.45em;
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	font-size: inherit;
	line-height: inherit;
}

.eau-b2b-offer--loop-price-row > * {
	flex: 0 0 auto;
	margin: 0;
	max-width: 100%;
}

.eau-b2b-offer--loop-price-row .eau-b2b-offer--before-only.eau-b2b-offer--loop {
	display: block;
	margin: 0;
}

.eau-b2b-offer--loop-price-row .eau-b2b-offer--loop-b2b.eau-b2b-offer--append-current {
	margin: 0;
}

/* Root blocks */
.eau-b2b-offer {
	margin: 0.5em 0;
	font-size: 0.95em;
	line-height: 1.45;
}

/* Prepended “before” line only (Whols/WC price follows in same .price) */
.eau-b2b-offer--before-only {
	display: block;
	margin: 0.15em 0 0.65em;
}

.eau-b2b-offer--before-only.eau-b2b-offer--loop {
	margin: 0.35em 0;
	font-size: 0.88em;
}

/*
 * Loop price row — one line, right-aligned (standard Woo shop loop).
 * :has() limits this to cards that contain B2B loop markup.
 */
.woocommerce ul.products li.product .price:has(.eau-b2b-offer--loop),
ul.products li.product .price:has(.eau-b2b-offer--loop) {
	display: flex;
	flex-wrap: nowrap;
	justify-content: flex-end;
	align-items: baseline;
	column-gap: 0.45em;
	row-gap: 0;
	text-align: right;
}

.woocommerce ul.products li.product .price:has(.eau-b2b-offer--loop) .eau-b2b-offer--before-only.eau-b2b-offer--loop,
ul.products li.product .price:has(.eau-b2b-offer--loop) .eau-b2b-offer--before-only.eau-b2b-offer--loop,
.woocommerce ul.products li.product .price:has(.eau-b2b-offer--loop) .eau-b2b-offer--loop-b2b.eau-b2b-offer--append-current,
ul.products li.product .price:has(.eau-b2b-offer--loop) .eau-b2b-offer--loop-b2b.eau-b2b-offer--append-current {
	display: block;
	margin: 0;
	flex: 0 0 auto;
}

/* Appended B2B current price in grids (when Whols did not print inside get_price_html) */
.eau-b2b-offer--loop-b2b.eau-b2b-offer--append-current {
	margin: 0.25em 0 0;
	font-size: 0.95em;
}

.woocommerce ul.products li.product .price:has(.eau-b2b-offer--loop) .eau-b2b-offer--loop-b2b.eau-b2b-offer--append-current,
ul.products li.product .price:has(.eau-b2b-offer--loop) .eau-b2b-offer--loop-b2b.eau-b2b-offer--append-current {
	margin: 0;
}

/* Only if you add a label via filter eau_b2b_loop_price_label */
.eau-b2b-offer--loop-b2b .eau-b2b-offer__label {
	display: block;
	font-size: 0.85em;
	opacity: 0.88;
	margin-bottom: 0.15em;
}

/* Full block (shortcode, variable AJAX, custom loop template) */
.eau-b2b-offer--full.eau-b2b-offer--loop {
	font-size: 0.88em;
}

.eau-b2b-offer--variable {
	margin: 0.5em 0;
}

/* Inner spans */
.eau-b2b-offer .eau-b2b-before {
	text-decoration: line-through;
	opacity: 0.85;
	margin-right: 0.35em;
}

.eau-b2b-offer .eau-b2b-current {
	font-weight: 600;
}

.eau-b2b-offer .eau-b2b-badge {
	display: inline-block;
	margin-left: 0.5em;
	padding: 0.12em 0.45em;
	font-size: 0.75em;
	font-weight: 600;
	border-radius: 3px;
	background: #c62828;
	color: #fff;
	vertical-align: middle;
}

.eau-b2b-var-loading {
	opacity: 0.7;
	font-size: 0.9em;
}

/* Sale flash — themes often position .onsale absolutely; .eau-b2b-sale-flash is for your overrides */
.onsale.eau-b2b-onsale.eau-b2b-sale-flash {
	/* intentionally minimal; match theme .onsale or replace look on live */
}
