/**
 * Best Days Rx Storefront - frontend styles.
 * Everything is scoped beneath .bdrx-storefront so it can never leak onto
 * theme chrome, other WooCommerce pages, or anything outside the shop
 * archive this plugin owns. No selector in this file targets a bare
 * element, `.woocommerce`, `button`, `a`, `select`, `ul.products`, `body`,
 * or heading tag without the .bdrx-storefront (or a more specific
 * .bdrx-* ) ancestor/prefix.
 */

/*
 * ---------- Full-bleed breakout ----------
 * .bdrx-storefront-bleed escapes whatever width the theme's own content
 * wrapper imposes (max-width, percentage+float sidebar layout, a
 * Bootstrap-style .container, etc.). The actual escape happens entirely
 * via ancestor neutralization (the :has() rule below, plus
 * assets/js/storefront.js's initAncestorBreakout() catch-all) - both of
 * which force EVERY ancestor up to <body> to width:100% - so, once
 * those run, this element's own containing block is already exactly as
 * wide as <body> itself. width: 100% here is therefore all this element
 * needs.
 *
 * v0.8.34 ROOT CAUSE FIX: this rule previously used
 * position:relative; left:50%; width:100vw; transform:translateX(-50%) -
 * a common viewport-breakout technique, but one with a well-documented
 * flaw: 100vw is defined relative to the browser's layout viewport,
 * which in most browsers INCLUDES the vertical scrollbar's own track
 * width, while left:50% (computed against this element's actual,
 * scrollbar-adjusted containing block once neutralized to width:100%)
 * and the rest of the page's normal layout do NOT include it. Once the
 * ancestor-neutralization layers (unchanged, confirmed already
 * theme-agnostic and comprehensive on their own) make this element's
 * containing block exactly body-width, the extra few pixels 100vw adds
 * for the scrollbar are pure excess: this element became slightly
 * WIDER than the page's own true content width and shifted, so its
 * RIGHT edge no longer lined up with the theme header's own right edge
 * (which was never computed with vw at all) - reproducing exactly the
 * "storefront ends before the header on the right" symptom, and
 * explaining why Hero-level and Product Card-level CSS changes never
 * touched it: those live entirely inside this element, several layers
 * below the actual mismatch. It also explains why a broad Product
 * Layout change could shove the whole storefront right: any rule
 * touching a wide-enough descendant's own margin/width interacts with
 * this already-mismatched outer box's available space, moving where
 * the visibly clipped/overflowing portion sits without ever fixing the
 * box itself. Removing the vw/transform technique entirely and relying
 * solely on width:100% against an already-neutralized, scrollbar-safe
 * containing block removes the mismatch at its source rather than
 * compensating for it further down the tree.
 */
.bdrx-storefront-bleed {
	width: 100%;
}

/*
 * ---------- Ancestor neutralization (defensive, precisely scoped) ----------
 * :has() lets these rules match ONLY an ancestor that actually contains
 * our bleed wrapper - never any other element sharing the same class name
 * elsewhere on the page (a theme header/footer using .container, for
 * example, is untouched, since it does not contain .bdrx-storefront-bleed
 * as a descendant). This is now the PRIMARY breakout mechanism for
 * themes using one of these common wrapper class names (immediate, no
 * JS delay); assets/js/storefront.js's initAncestorBreakout() remains
 * the guaranteed catch-all for any other, unrecognized theme wrapper
 * class name, at the cost of a brief flash before it runs on that one
 * case. Layout properties only - never color/font/other theme styling -
 * and only on the one template that ever contains .bdrx-storefront-bleed.
 */
.site-main:has(.bdrx-storefront-bleed),
.content-area:has(.bdrx-storefront-bleed),
#primary:has(.bdrx-storefront-bleed),
#content:has(.bdrx-storefront-bleed),
#main:has(.bdrx-storefront-bleed),
.container:has(.bdrx-storefront-bleed),
.container-fluid:has(.bdrx-storefront-bleed),
.entry-content:has(.bdrx-storefront-bleed),
.page-content:has(.bdrx-storefront-bleed),
.wrapper:has(.bdrx-storefront-bleed),
.wrap:has(.bdrx-storefront-bleed),
.content-wrapper:has(.bdrx-storefront-bleed),
.content-area-wrapper:has(.bdrx-storefront-bleed) {
	max-width: none !important;
	width: 100% !important;
	overflow: visible !important;
	float: none !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

.bdrx-storefront {
	--bdrx-border: #e6e1d8;
	--bdrx-text: #1c1c1a;
	--bdrx-muted: #746f66;
	--bdrx-navy: #123c3d;      /* primary CTA / quiz strip - dark navy/teal */
	--bdrx-navy-hover: #0c2b2c;
	/* v0.8.40 - dedicated, NOT admin-customizable filter-active color -
	   see the ROOT CAUSE comment on .bdrx-filter-term__box's own active
	   rule below for why this exists as a separate variable from
	   --bdrx-navy, rather than reusing it. Same default value as
	   --bdrx-navy's own default, so nothing changes visually for any
	   site that has never customized Button Background - this variable
	   is simply never written to by Frontend\AppearanceStyles.php at
	   all (confirmed by direct read - that class's own $color_map has
	   no entry mapping any Appearance setting to this variable name),
	   so it can never end up lighter/paler than the checkbox's own
	   white checkmark contrast requires, no matter what an admin sets
	   Button Background to. */
	--bdrx-filter-active: #123c3d;
	--bdrx-button-text: #ffffff;
	--bdrx-coral: #cf5137;     /* price / active accent - warm red/coral */
	--bdrx-hero-bg: #f6f0e6;   /* soft warm/off-white */
	--bdrx-card-bg: #faf7f1;   /* subtle warm/light-gray card background */
	--bdrx-page-bg: transparent;
	--bdrx-hero-heading-size: clamp(44px, 4.2vw, 64px);
	--bdrx-base-font-size: 16px;
	--bdrx-tablet-cols: 2;
	--bdrx-mobile-cols: 1;
	max-width: 1560px;
	margin: 0 auto;
	padding: 0 0 64px; /* v0.8.37: horizontal padding removed - see .bdrx-storefront__gutter and Frontend\LayoutRenderer's own docblock on render_default_layout() for the full root-cause explanation. Vertical (bottom) spacing is unchanged. */
	color: var(--bdrx-text);
	background: var(--bdrx-page-bg);
	box-sizing: border-box;
	font-size: var(--bdrx-base-font-size);
}
/*
 * v0.8.37/v0.8.39 - carries the EXACT horizontal padding .bdrx-storefront
 * itself used to have (28px desktop / 20px Tablet-Mobile via the
 * existing --bdrx-mobile-page-gutter variable, unchanged values) -
 * wraps every top-level section that remains after v0.8.39's removal
 * of the old Hero/Banner system (Catalog, Trust Strip, Quiz CTA - see
 * Frontend\LayoutRenderer::render_default_layout()). Originally built
 * so Hero specifically would never inherit this padding (v0.8.37); now
 * simply the real, unchanged gutter mechanism for the sections that
 * are still rendered, kept exactly as-is since it was never Hero-
 * specific plumbing to begin with.
 */
.bdrx-storefront__gutter {
	padding: 0 28px;
}
.bdrx-storefront *,
.bdrx-storefront *::before,
.bdrx-storefront *::after {
	box-sizing: inherit;
}


/* Product card size/style presets, applied via a wrapper modifier class */
.bdrx-storefront--img-compact .bdrx-product-grid li.product img { height: clamp(170px, 13vw, 200px) !important; }
.bdrx-storefront--img-large .bdrx-product-grid li.product img { height: clamp(250px, 19vw, 290px) !important; }

/* ==================== Body layout ==================== */
.bdrx-storefront__body {
	display: flex;
	align-items: flex-start;
	gap: 32px;
}
.bdrx-storefront__main { flex: 1 1 auto; min-width: 0; }

/* ==================== Filters ==================== */
/* v0.8.25: [data-bdrx-filter-inline-mount] replaces the old
   .bdrx-storefront__filters wrapper - the real <nav class="bdrx-filters">
   now sits directly inside it with no intermediate wrapper. Desktop
   sidebar sizing (240px column) applies here; collapses to zero width
   when empty (assets/js/responsive.js moves the real node OUT when
   Tablet/Mobile Flyout is active, adding
   .bdrx-filter-inline-mount--empty explicitly rather than relying on
   the fragile :empty pseudo-class against PHP template whitespace). */
[data-bdrx-filter-inline-mount] { flex: 0 0 240px; width: 240px; }
[data-bdrx-filter-inline-mount].bdrx-filter-inline-mount--empty { flex: 0 0 0; width: 0; min-width: 0; overflow: hidden; }

.bdrx-filters__title-row {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 16px;
	font-weight: 700;
	margin-bottom: 20px;
}
.bdrx-filters__icon { display: inline-flex; color: var(--bdrx-navy); }

.bdrx-filters__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--bdrx-muted);
	margin-bottom: 8px;
}
.bdrx-filters__clear { color: var(--bdrx-coral); text-decoration: underline; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 13px; }
.bdrx-filters__clear--inactive { color: #c9c4b9; text-decoration: none; pointer-events: none; }

.bdrx-filter-section { border-top: 1px solid var(--bdrx-border); padding: 16px 0; }

.bdrx-filter-section__label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	list-style: none;
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--bdrx-text);
}
.bdrx-filters__admin-hint { margin: 10px 0 0; }
.bdrx-filters__admin-hint a { font-size: 11px; color: var(--bdrx-muted); text-decoration: underline; }
.bdrx-filter-section__label::-webkit-details-marker { display: none; }
.bdrx-filter-section__chevron { transition: transform .2s ease; color: var(--bdrx-muted); flex: 0 0 auto; }
.bdrx-filter-section[open] .bdrx-filter-section__chevron { transform: rotate(180deg); }

.bdrx-filter-section__terms { list-style: none; margin: 14px 0 0; padding: 0; }
.bdrx-filter-term { margin: 0 0 11px; }
.bdrx-filter-term a {
	display: flex;
	align-items: center;
	gap: 9px;
	text-decoration: none;
	color: var(--bdrx-text);
	font-size: 14px;
	line-height: 1.35;
	padding: 3px 2px;
	border-radius: 4px;
}
.bdrx-filter-term a:hover { background: rgba(0,0,0,.03); }
.bdrx-filter-term__name { flex: 1 1 auto; min-width: 0; }
.bdrx-filter-term__box {
	width: 16px;
	height: 16px;
	box-sizing: border-box;
	border: 1.5px solid #c9c4b9;
	border-radius: 4px;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
/*
 * v0.8.40 ROOT CAUSE FIX: this rule previously used var(--bdrx-navy)
 * for both the checked fill and the border - the SAME CSS variable
 * Frontend\AppearanceStyles::inline_style_attr() overwrites with
 * whatever hex color an admin has set for the unrelated Appearance >
 * "Button Background" field (confirmed by direct read of that class's
 * own $color_map array: 'button_background' => '--bdrx-navy'). A site
 * that customized their product CTA button to a light/pale color (a
 * plausible, on-brand choice given this project's own warm/cream
 * palette elsewhere) would see that SAME light color fill the "active"
 * filter checkbox and its border - at which point the white checkmark
 * drawn below has little to no contrast against it, and the active
 * checkbox's border also loses contrast against its own unchecked
 * neighbors, making a genuinely-active filter look unselected. This is
 * the confirmed, concrete explanation for "checkbox outlines visible,
 * clicking filters correctly, but the selected option shows no visible
 * checkmark" - not a request-state or ARIA defect (both were traced
 * and confirmed already correct - Renderers\FilterSidebarRenderer's
 * own $is_active boolean already drives the active class, aria-checked,
 * and this box's own class simultaneously, from one canonical
 * Frontend\FilterRequestState::parse() value).
 * FIX: --bdrx-filter-active (defined once, near --bdrx-navy, at the
 * exact same default hex value) is a genuinely separate CSS variable
 * that Frontend\AppearanceStyles.php never writes to at all - filter
 * checkbox contrast is now permanently decoupled from whatever an
 * admin sets an unrelated button color to, while looking visually
 * identical to before for every site that never customized that
 * setting.
 * v0.8.28's own .bdrx-filter-term__box.is-active direct selector
 * (alongside the existing .bdrx-filter-term--active descendant
 * combinator) is preserved unchanged - both are still emitted together
 * from the exact same $is_active boolean, never a second, independent
 * state source.
 */
.bdrx-filter-term--active .bdrx-filter-term__box,
.bdrx-filter-term__box.is-active {
	background: var(--bdrx-filter-active);
	border-color: var(--bdrx-filter-active);
	position: relative;
}
.bdrx-filter-term--active .bdrx-filter-term__box::after,
.bdrx-filter-term__box.is-active::after {
	content: '';
	position: absolute;
	left: 5px;
	top: 2px;
	width: 4px;
	height: 8px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.bdrx-filter-term--active a { font-weight: 600; }
.bdrx-filter-term__count { color: var(--bdrx-muted); font-size: 13px; flex: 0 0 auto; margin-left: auto; }
/* v0.8.25: the Flyout Host itself is display:none by default (never
   active - Desktop and Tablet Sidebar mode never move anything into
   it). .bdrx-filter-flyout--active (added by assets/js/responsive.js
   only when the real filter node has actually been moved into this
   host - Tablet Drawer or Mobile Flyout) makes it a full-viewport
   overlay container; the backdrop/panel INSIDE it still separately
   control their own open/closed visibility via .is-open, unchanged
   from the established pattern. */
[data-bdrx-filter-flyout] { display: none; }
[data-bdrx-filter-flyout].bdrx-filter-flyout--active {
	display: block;
	position: fixed;
	inset: 0;
	z-index: 1000;
	pointer-events: none; /* The host itself never blocks clicks - only its backdrop (when open) and panel do, via their own pointer-events rules below. */
}
/* Backdrop and panel structure - shared by Tablet Drawer and Mobile
   Flyout alike (one host, one set of rules, reused - not duplicated
   per device). Core off-canvas mechanics live here in storefront.css,
   never dependent on administrator Custom CSS for basic function -
   confirmed working with Mobile Full Shop CSS empty is a hard
   requirement this release. */
[data-bdrx-filter-flyout] [data-bdrx-filter-backdrop] {
	position: absolute;
	inset: 0;
	background: rgba(4,23,28,.55);
	opacity: 0;
	pointer-events: none;
	transition: opacity .22s ease;
}
[data-bdrx-filter-flyout] [data-bdrx-filter-backdrop].is-open { opacity: 1; pointer-events: auto; }
[data-bdrx-filter-flyout-panel] {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: min(88vw, 430px);
	max-width: none;
	background: #fff;
	z-index: 2;
	transform: translateX(-105%);
	visibility: hidden;
	pointer-events: none;
	transition: transform .22s ease, visibility .22s;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 20px;
	box-shadow: 8px 0 24px rgba(0,0,0,.12);
}
[data-bdrx-filter-flyout-panel].is-open {
	transform: translateX(0);
	visibility: visible;
	pointer-events: auto;
}
@media (max-width: 340px) {
	[data-bdrx-filter-flyout-panel] { width: 92vw; }
}
@media (prefers-reduced-motion: reduce) {
	[data-bdrx-filter-flyout-panel],
	[data-bdrx-filter-flyout] [data-bdrx-filter-backdrop] { transition: none; }
}
.bdrx-filter-flyout__done {
	display: block;
	width: 100%;
	min-height: 48px;
	margin-bottom: 16px;
	background: #fff;
	border: 1.5px solid currentColor;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}
/* Hidden holding area (Mobile Filter Mode = Hidden) - the real filter
   node lives here, preserved with its full state/listeners, rather
   than being detached from the document. */
[data-bdrx-filter-holding] { display: none; }

/* ==================== Toolbar ==================== */
.bdrx-toolbar {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 20px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--bdrx-border);
	min-height: 0;
}
.bdrx-toolbar__count { margin-right: auto; color: var(--bdrx-muted); font-size: 15px; }
.bdrx-toolbar__sort .orderby {
	border: 1px solid var(--bdrx-border);
	border-radius: 8px;
	padding: 11px 34px 11px 16px;
	min-height: 40px;
	font-size: 15px;
	background: #fff;
	color: var(--bdrx-text);
	min-width: 200px;
	box-sizing: border-box;
}
.bdrx-toolbar__filter-toggle {
	display: none;
	margin-right: auto;
	align-items: center;
	gap: 6px;
	background: #fff;
	border: 1px solid var(--bdrx-border);
	border-radius: 6px;
	padding: 9px 16px;
	font-size: 14px;
	cursor: pointer;
}

/* ==================== Product grid ====================
   !important is used on the STRUCTURAL properties here (display, float,
   flex, width, margin) - never on colors/typography - specifically to
   guarantee this plugin's CSS Grid layout wins regardless of whatever
   layout system (classic float-based, or a flex-based grid many modern
   themes use instead) the active theme's own WooCommerce integration CSS
   applies to `ul.products li.product`, which our <ul> unavoidably matches
   too (kept for MCP/theme compatibility - see ProductGridRenderer). This
   is the single most likely reason cards were rendering at theme-imposed
   sizes rather than this plugin's - a plain (non-important) `display:grid`
   can lose to a theme's `display:flex` at equal or higher specificity. */
.bdrx-product-grid {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(260px, 1fr)) !important;
	gap: 20px !important;
	list-style: none !important;
	margin: 0 0 40px !important;
	padding: 0 !important;
}
/*
 * ROOT CAUSE FIX - phantom empty first grid cell.
 * This <ul> carries the literal "products" class (kept intentionally -
 * see ProductGridRenderer - so WooCommerce/MCP's own per-item hooks and
 * any theme WooCommerce styling continue to recognize it as a product
 * loop). WooCommerce's own bundled stylesheet applies a classic clearfix
 * to that exact class, of the long-standing form:
 *   ul.products:before, ul.products:after { content: " "; display: table; }
 * That was written for the pre-Grid float-based layout, where a clearfix
 * pseudo-element is invisible and harmless. Once this element is
 * `display: grid` instead, that is no longer true: per the CSS Grid
 * spec, any ::before/::after with a used `content` value generates a
 * real box and becomes an actual grid item, placed BEFORE all real
 * children in source order - consuming exactly the first grid cell and
 * pushing every real product into the next one. This is a well-known
 * CSS Grid + legacy-clearfix interaction, not specific to any one theme.
 * Fix: remove box generation from those two pseudo-elements entirely,
 * scoped to this one element only - never a global clearfix/WooCommerce
 * reset.
 */
.bdrx-product-grid::before,
.bdrx-product-grid::after {
	content: none !important;
	display: none !important;
}
.bdrx-product-grid--cols-2 { grid-template-columns: repeat(2, minmax(260px, 1fr)) !important; }
.bdrx-product-grid--cols-3 { grid-template-columns: repeat(3, minmax(250px, 1fr)) !important; }
.bdrx-product-grid--cols-5 { grid-template-columns: repeat(5, minmax(220px, 1fr)) !important; }
.bdrx-product-grid.bdrx-product-grid--compact { gap: 16px !important; }

.bdrx-product-grid li.product {
	display: flex !important;
	flex-direction: column !important;
	float: none !important;
	clear: none !important;
	width: auto !important;
	max-width: none !important;
	flex-basis: auto !important;
	margin: 0 !important;
	background: var(--bdrx-card-bg);
	border: 1px solid rgba(0,0,0,.045);
	border-radius: 14px;
	padding: 16px;
	box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.bdrx-product-grid--compact li.product { padding: 14px !important; }

.bdrx-product-grid li.product > a.woocommerce-loop-product__link,
.bdrx-product-grid li.product > a.woocommerce-LoopProduct-link {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	text-decoration: none;
	color: inherit;
	text-align: left !important;
}

.bdrx-product-grid li.product img {
	width: 100% !important;
	max-width: 100% !important;
	height: clamp(210px, 16vw, 240px) !important;
	max-height: none !important;
	object-fit: contain !important;
	object-position: center;
	display: block;
	background: #fff;
	border-radius: 8px;
	margin: 0 0 14px;
}
.bdrx-product-grid--compact li.product img { height: clamp(180px, 14vw, 210px) !important; margin-bottom: 10px; }

.bdrx-card-eyebrow {
	display: block;
	text-align: left !important;
	text-transform: none;
	letter-spacing: normal;
	font-size: 13px;
	font-weight: 600;
	color: var(--bdrx-muted);
	margin: 0 0 5px;
}
.bdrx-storefront--eyebrow-uppercase .bdrx-card-eyebrow {
	text-transform: uppercase;
	letter-spacing: .04em;
}
.bdrx-storefront--eyebrow-accent .bdrx-card-eyebrow {
	color: var(--bdrx-navy);
}
.bdrx-product-grid li.product .woocommerce-loop-product__title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	margin: 0 0 6px;
	text-align: left !important;
	/* Max 2 lines - a long title never destroys card alignment; the
	   third+ line is clipped with an ellipsis rather than growing the
	   card unpredictably. Standard + -webkit- prefixed property together
	   cover all current browser engines. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.bdrx-storefront--title-compact .bdrx-product-grid li.product .woocommerce-loop-product__title { font-size: 14px; }
.bdrx-storefront--title-large .bdrx-product-grid li.product .woocommerce-loop-product__title { font-size: 18px; }

.bdrx-product-grid li.product .price {
	font-size: 15px;
	font-weight: 600;
	color: var(--bdrx-coral);
	margin: 0 0 14px;
	text-align: left !important;
}
.bdrx-storefront--price-standard .bdrx-product-grid li.product .price { color: var(--bdrx-text); }
.bdrx-product-grid li.product .price del { color: var(--bdrx-muted); font-weight: 400; opacity: .7; }
.bdrx-product-grid li.product .price ins { text-decoration: none; }

/* Card text alignment (meta zone only - the image stays centered via its
   own fixed-region rules regardless of this setting). */
.bdrx-storefront--card-center .bdrx-card-eyebrow,
.bdrx-storefront--card-center .bdrx-product-grid li.product .woocommerce-loop-product__title,
.bdrx-storefront--card-center .bdrx-product-grid li.product .price {
	text-align: center !important;
}
.bdrx-storefront--card-center .bdrx-product-grid li.product .mcp-shop-actions {
	justify-content: center;
}

/* CTA row - both the MCP two-button wrapper and a lone native WooCommerce
   add-to-cart link land here; both get consistent, compact styling.
   NOTE ON !important BELOW: MCP itself supports admin-configured colors
   for these exact buttons via CSS custom properties on the wrapping
   .mcp-shop-actions div (--mcp-primary-bg etc., set as an inline style
   attribute only when an admin has explicitly configured MCP's own Shop
   Action Appearance settings). Those custom properties are consumed by
   MCP's OWN stylesheet, which this plugin has no visibility into and does
   not control the load order of. !important is used ONLY on the visual
   properties below (color/background/border/padding/font) - never on
   anything that would change which link/label/href MCP decided to
   render - specifically so this plugin's presentation choices reliably
   win regardless of MCP's own CSS specificity or enqueue order. This is
   still purely "styling the result", not touching MCP's logic or markup. */
.bdrx-product-grid li.product .mcp-shop-actions {
	margin-top: auto;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.bdrx-product-grid li.product > a.button,
.bdrx-product-grid li.product .mcp-product-action,
.bdrx-product-grid li.product .add_to_cart_button {
	margin-top: auto;
}
.bdrx-product-grid li.product .button {
	background: var(--bdrx-navy) !important;
	color: var(--bdrx-button-text) !important;
	border: none !important;
	border-radius: 8px !important;
	padding: 12px 20px !important;
	min-height: 40px !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	white-space: nowrap;
	text-decoration: none !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	line-height: 1.2;
	box-sizing: border-box;
	transition: background-color .15s ease;
}
.bdrx-product-grid li.product .button:hover { background: var(--bdrx-navy-hover) !important; color: var(--bdrx-button-text) !important; }
.bdrx-product-grid li.product .mcp-product-learn-more {
	background: transparent !important;
	color: var(--bdrx-navy) !important;
	border: 1.4px solid var(--bdrx-navy) !important;
}
.bdrx-product-grid li.product .mcp-product-learn-more:hover { background: rgba(18,60,61,.06) !important; }

/* CTA Alignment: 'stretch' makes the action row fill the card width and
   each button share it equally - 'natural' (default, no class added) is
   the existing content-sized behavior above. Only sizing/layout - never
   changes MCP's button count, labels, or hrefs. */
.bdrx-storefront--cta-stretch .bdrx-product-grid li.product .mcp-shop-actions { flex-wrap: nowrap; }
.bdrx-storefront--cta-stretch .bdrx-product-grid li.product .mcp-shop-actions .button {
	flex: 1 1 0 !important;
	width: auto !important;
}
.bdrx-storefront--cta-stretch .bdrx-product-grid li.product > a.button:only-child {
	width: 100% !important;
}

/* Primary/secondary button style presets (product_card.primary_button_style
   / secondary_button_style) - applied via a modifier class on the
   .bdrx-storefront wrapper itself (see AppearanceStyles/templates), since
   MCP's own markup (mcp-product-learn-more etc.) can't be given a class by
   this plugin. These rules only ever change color/border of buttons
   already rendered by WooCommerce/MCP - never their markup or logic.
   !important + later declaration order: both needed to reliably win over
   the base .button/.mcp-product-learn-more rules above, which are
   themselves !important for the reasons explained there. */
.bdrx-storefront--primary-coral .bdrx-product-grid li.product .button:not(.mcp-product-learn-more) {
	background: var(--bdrx-coral) !important;
}
.bdrx-storefront--primary-coral .bdrx-product-grid li.product .button:not(.mcp-product-learn-more):hover {
	background: var(--bdrx-coral) !important;
	opacity: .88;
}
.bdrx-storefront--secondary-ghost .bdrx-product-grid li.product .mcp-product-learn-more {
	background: transparent !important;
	border: none !important;
	text-decoration: underline !important;
	padding-left: 6px !important;
	padding-right: 6px !important;
}

/* ==================== Pagination ==================== */
.bdrx-storefront__pagination { display: flex; justify-content: center; margin-top: 8px; }
.bdrx-storefront__pagination nav.woocommerce-pagination { width: 100%; display: flex; justify-content: center; }
.bdrx-storefront__pagination .page-numbers {
	list-style: none;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
}
.bdrx-storefront__pagination .page-numbers li { display: inline-flex; }
.bdrx-storefront__pagination .page-numbers a,
.bdrx-storefront__pagination .page-numbers span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 8px;
	border-radius: 50%;
	font-size: 15px;
	color: var(--bdrx-text);
	text-decoration: none;
}
.bdrx-storefront__pagination .page-numbers a:hover { background: #f1ede4; }
.bdrx-storefront__pagination .page-numbers .current { background: var(--bdrx-navy); color: #fff; font-weight: 600; }
.bdrx-storefront__pagination .page-numbers .dots { background: transparent; }

/* ==================== Trust strip ==================== */
.bdrx-trust-strip { border-top: 1px solid var(--bdrx-border); padding: 36px 0; margin-top: 8px; }
.bdrx-trust-strip__list {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.bdrx-trust-strip__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
	padding: 4px 16px;
	position: relative;
}
.bdrx-trust-strip__item:not(:last-child)::after {
	content: '';
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 1px;
	height: 32px;
	background: var(--bdrx-border);
}
.bdrx-trust-strip__icon { font-size: 20px; line-height: 1; }
.bdrx-trust-strip__heading { font-size: 14.5px; font-weight: 700; color: var(--bdrx-text); }
.bdrx-trust-strip__text { font-size: 12.5px; color: var(--bdrx-muted); }

/* ==================== Quiz CTA ==================== */
.bdrx-quiz-cta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	background: var(--bdrx-navy);
	color: #fff;
	border-radius: 16px;
	padding: 30px 40px;
	min-height: 84px;
	margin-top: 8px;
}
.bdrx-quiz-cta__text { display: flex; align-items: center; gap: 16px; text-align: left; }
.bdrx-quiz-cta__icon { flex: 0 0 auto; opacity: .9; font-size: 20px; line-height: 1; display: inline-flex; align-items: center; }
.bdrx-quiz-cta__copy-block { display: flex; flex-direction: column; gap: 4px; }
.bdrx-quiz-cta__heading { font-weight: 700; font-size: 18px; }
.bdrx-quiz-cta__copy { font-size: 14px; color: rgba(255,255,255,.72); }
.bdrx-quiz-cta__button {
	background: #fff;
	color: var(--bdrx-navy);
	padding: 13px 26px;
	border-radius: 8px;
	font-weight: 700;
	font-size: 14px;
	white-space: nowrap;
	text-decoration: none;
	flex: 0 0 auto;
}
.bdrx-quiz-cta__button:hover { background: #f0ece1; }

/* ==================== Responsive ==================== */
@media (max-width: 1280px) {
	.bdrx-product-grid,
	.bdrx-product-grid--cols-4,
	.bdrx-product-grid--cols-5 { grid-template-columns: repeat(3, minmax(210px, 1fr)); }
}

@media (max-width: 1024px) {
	/* v0.8.13: canonical Tablet range (768-1024px). Tablet Filter Mode
	   defaults to Sidebar (kept - not a drawer) per this release's
	   documented scope decision, so the body does NOT stack here and
	   the mobile filter toggle/drawer stay hidden - only the narrower-
	   viewport Hero/trust-strip treatment applies, shared with Mobile
	   below via the normal CSS cascade (the 767px block further down
	   overrides what Mobile needs to override, e.g. columns/stacking). */
	.bdrx-storefront { padding: 0 0 48px; } /* v0.8.37: horizontal component moved to .bdrx-storefront__gutter below - see that class's own docblock. */
	.bdrx-storefront__gutter { padding: 0 20px; }


	.bdrx-product-grid,
	.bdrx-product-grid--cols-2,
	.bdrx-product-grid--cols-3,
	.bdrx-product-grid--cols-4,
	.bdrx-product-grid--cols-5 { grid-template-columns: repeat(var(--bdrx-tablet-cols, 2), minmax(0, 1fr)) !important; }

	.bdrx-trust-strip__list { grid-template-columns: repeat(2, 1fr); }
	.bdrx-trust-strip__item:nth-child(2)::after { display: none; }
	.bdrx-trust-strip__item:not(:nth-child(2)):not(:last-child)::after { display: none; }

	.bdrx-quiz-cta { flex-direction: column; align-items: flex-start; text-align: left; min-height: 0; }
	.bdrx-quiz-cta__button { width: 100%; text-align: center; }
}

/* v0.8.14: Tablet Filter Mode = Drawer (opt-in, default is Sidebar - the
   1024px block above). Activated by assets/js/responsive.js adding
   .bdrx-tablet-filter-drawer to <html> only when Tablet Filter Mode is
   set to Drawer in the admin. Reuses the identical drawer treatment the
   767px Mobile block already defines - not a second implementation.
   v0.8.20: added !important to the drawer's STRUCTURAL positioning
   properties only (position/inset/transform/z-index, never visual
   properties like width/background/padding) - confirmed live that the
   drawer was rendering inline instead of off-canvas; the same
   admin-authored Mobile Full Shop CSS / Mobile Hero CSS that legitimately
   needs to load AFTER this stylesheet (Frontend\Assets::enqueue_custom_css())
   for its own purposes could, even unintentionally, carry a rule
   matching this selector and silently defeat the drawer's off-canvas
   positioning at equal specificity, later source order. Matches this
   same file's own established precedent for exactly this situation -
   see the Hero Height rule's docblock above ("hardening structural,
   admin-controlled properties so they apply BY DEFAULT... admin CSS can
   still intentionally override any of this by also using !important
   there"). */
@media (min-width: 768px) and (max-width: 1024px) {
	/* v0.8.25: drastically simplified - the Flyout Host/panel structural
	   CSS (position/inset/z-index/transform/visibility/pointer-events)
	   now lives once, at the base level (not device-specific), since
	   assets/js/responsive.js physically moves the real filter node
	   into [data-bdrx-filter-flyout-content] only when this mode is
	   actually active - this block only needs to arrange the
	   surrounding page (stacking, toggle button visibility, scroll
	   lock) for Tablet Drawer mode specifically. */
	html.bdrx-tablet-filter-drawer .bdrx-storefront__body { flex-direction: column; }
	html.bdrx-tablet-filter-drawer .bdrx-toolbar__filter-toggle { display: inline-flex !important; }
	html.bdrx-tablet-filter-drawer body.bdrx-filter-open { overflow: hidden; }
}

@media (max-width: 767px) {
	/* v0.8.13: canonical Mobile range (0-767px) - the one range where
	   the filter drawer activates. Everything Mobile-exclusive
	   (stacking, drawer, toggle visibility, mobile columns/Hero vars)
	   lives here, not in the 1024px block above, so Tablet keeps its
	   sidebar per the scope decision documented there. */

	/* v0.8.39: the old Hero/Banner system has been completely removed
	   from the active render path (see this release's own changelog for
	   the full audit) - no .bdrx-hero* selector renders anything at all
	   anymore. .bdrx-storefront__gutter itself (established in v0.8.37
	   to give Hero a genuinely unconditional full-width invariant by
	   moving the content gutter OFF Hero's own ancestor chain and onto
	   this class instead, applied to Catalog/Trust Strip/Quiz CTA) is
	   NOT Hero-specific plumbing - it is kept, unchanged, as the real
	   gutter mechanism for every remaining section on this device. */
	.bdrx-storefront__gutter { padding: 0 20px; }

	.bdrx-storefront__body { flex-direction: column; }
	/* v0.8.21: !important added, matching the exact same precedent
	   established in v0.8.20 for the drawer's structural positioning
	   properties - admin-authored Mobile Full Shop/Hero CSS loads AFTER
	   this stylesheet (Frontend\Assets::enqueue_custom_css()) and could,
	   even unintentionally, carry a rule matching this selector (e.g. a
	   broad reset written for an unrelated purpose) that silently
	   defeats this override at equal specificity, later source order -
	   confirmed as the exact same class of vulnerability the drawer
	   positioning rules had. */
	/* v0.8.25: drastically simplified - the Flyout Host/panel structural
	   CSS now lives once, at the base level, since
	   assets/js/responsive.js physically moves the real filter node
	   into place rather than this stylesheet trying to keep an
	   in-place node hidden/positioned via specificity/!important. This
	   block only needs to control the toggle button and body scroll
	   lock for the Mobile-always-drawer breakpoint. */
	.bdrx-toolbar__filter-toggle { display: inline-flex !important; }

	/* Scroll lock - v0.8.13 fix: this class was already being toggled by
	   assets/js/storefront.js's initFilterDrawer() (open()/close()), but
	   no CSS rule ever consumed it, so the background page never
	   actually stopped scrolling while the drawer was open. */
	body.bdrx-filter-open { overflow: hidden; }

	/* v0.8.25: Mobile Filter Mode = Inline or Hidden hides the toggle
	   button - the real filter node's PRESENTATION for these two modes
	   is now controlled entirely by assets/js/responsive.js moving it
	   between [data-bdrx-filter-inline-mount] (Inline; the mount's own
	   normal-flow CSS above applies automatically) and
	   [data-bdrx-filter-holding] (Hidden; display:none, defined once,
	   base level, above) - no per-mode positioning override is needed
	   here at all, since the node is never left in the Flyout Host for
	   these two modes in the first place. */
	html.bdrx-mobile-filter-inline .bdrx-toolbar__filter-toggle,
	html.bdrx-mobile-filter-hidden .bdrx-toolbar__filter-toggle {
		display: none !important;
	}

	.bdrx-product-grid,
	.bdrx-product-grid--cols-2,
	.bdrx-product-grid--cols-3,
	.bdrx-product-grid--cols-4,
	.bdrx-product-grid--cols-5 { grid-template-columns: repeat(var(--bdrx-mobile-cols, 1), minmax(0, 1fr)) !important; }
	.bdrx-trust-strip__list { grid-template-columns: 1fr; }
	.bdrx-trust-strip__item::after { display: none !important; }

	/* Mobile Sort styled to visually match the Filter button beside it
	   (reference: two matching side-by-side controls) - the underlying
	   <select> is still WooCommerce's own real woocommerce_catalog_ordering()
	   element (see Renderers\ToolbarRenderer) - never a second,
	   disconnected sort control. */
	.bdrx-toolbar__sort select {
		min-height: 44px;
		border: 1.5px solid currentColor;
		border-radius: 8px;
		padding: 0 12px;
	}
}


/* Advanced Layout: admin-only inline warning (see Frontend\LayoutRenderer::render_admin_warning()) - never shown to customers, current_user_can() gated in PHP before this class is ever output. */
.bdrx-admin-layout-warning {
	background: #fdecea;
	border: 1px solid #e0a3a3;
	color: #7a2e2e;
	border-radius: 8px;
	padding: 12px 14px;
	font-size: 13px;
	line-height: 1.5;
	margin: 0 0 20px;
}
