/* Product archive filters: reuse the existing Elementor/YITH DOM in a
 * mobile/tablet drawer. Desktop keeps the original sidebar. */
.bmag-filter-toolbar,
.bmag-filter-drawer-head,
.bmag-filter-drawer-footer,
.bmag-filter-overlay {
	display: none;
}

@media (max-width: 1024px) {
	body.bmag-product-filter-ready.bmag-filter-drawer-open {
		overflow: hidden;
		touch-action: none;
	}

	body.bmag-product-filter-ready .bmag-filter-layout {
		display: block !important;
	}

	body.bmag-product-filter-ready .bmag-filter-results-column {
		inline-size: 100% !important;
		max-inline-size: none !important;
		min-inline-size: 0 !important;
	}

	body.bmag-product-filter-ready .bmag-filter-results-column > .elementor-widget-wrap,
	body.bmag-product-filter-ready .bmag-filter-results-column > .elementor-element-populated {
		inline-size: 100%;
	}

	.bmag-filter-toolbar {
		align-items: center;
		display: flex;
		gap: 10px;
		inline-size: 100%;
		justify-content: space-between;
		margin: 0 0 20px;
		padding-inline: clamp(12px, 3vw, 20px);
	}

	.bmag-filter-trigger,
	.bmag-filter-toolbar-clear,
	.bmag-filter-close,
	.bmag-filter-clear,
	.bmag-filter-view {
		align-items: center;
		border: 0;
		cursor: pointer;
		display: inline-flex;
		font-family: Arial, sans-serif;
		justify-content: center;
		min-block-size: 48px;
	}

	.bmag-filter-trigger {
		background: #045cb4;
		border-radius: 10px;
		box-shadow: 0 4px 12px rgba(4, 92, 180, 0.18);
		color: #fff;
		flex: 1 1 auto;
		font-size: 16px;
		font-weight: 700;
		gap: 9px;
		justify-content: flex-start;
		padding: 11px 16px;
	}

	.bmag-filter-trigger:focus-visible,
	.bmag-filter-toolbar-clear:focus-visible,
	.bmag-filter-close:focus-visible,
	.bmag-filter-clear:focus-visible,
	.bmag-filter-view:focus-visible,
	.bmag-filter-sidebar a:focus-visible {
		outline: 3px solid #35c0f4;
		outline-offset: 2px;
	}

	.bmag-filter-trigger-icon,
	.bmag-filter-trigger-icon svg {
		block-size: 22px;
		display: block;
		inline-size: 22px;
	}

	.bmag-filter-trigger-icon svg {
		fill: none;
		stroke: currentColor;
		stroke-linecap: round;
		stroke-width: 2;
	}

	.bmag-filter-count {
		align-items: center;
		background: #fff;
		border-radius: 999px;
		color: #045cb4;
		display: inline-flex;
		font-size: 13px;
		font-weight: 700;
		justify-content: center;
		margin-inline-start: auto;
		min-block-size: 24px;
		min-inline-size: 24px;
		padding-inline: 6px;
	}

	.bmag-filter-count[hidden],
	.bmag-filter-toolbar-clear[hidden],
	.bmag-filter-overlay[hidden] {
		display: none !important;
	}

	.bmag-filter-toolbar-clear {
		background: transparent;
		color: #045cb4;
		font-size: 14px;
		font-weight: 700;
		padding-inline: 8px;
	}

	.bmag-filter-overlay {
		background: rgba(4, 29, 49, 0.54);
		border: 0;
		display: block;
		inset: 0;
		position: fixed;
		z-index: 10060;
	}

	body.bmag-product-filter-ready .bmag-filter-sidebar {
		background: #fff;
		block-size: 100dvh;
		box-shadow: -14px 0 34px rgba(4, 29, 49, 0.2);
		inline-size: min(92vw, 420px) !important;
		inset-block: 0;
		inset-inline-end: 0;
		margin: 0 !important;
		max-inline-size: 420px !important;
		overflow: hidden;
		position: fixed !important;
		transform: translateX(105%);
		transition: transform 220ms ease;
		z-index: 10070;
	}

	html[dir="rtl"] body.bmag-product-filter-ready .bmag-filter-sidebar {
		box-shadow: 14px 0 34px rgba(4, 29, 49, 0.2);
		transform: translateX(-105%);
	}

	body.bmag-product-filter-ready.bmag-filter-drawer-open .bmag-filter-sidebar,
	html[dir="rtl"] body.bmag-product-filter-ready.bmag-filter-drawer-open .bmag-filter-sidebar {
		transform: translateX(0);
	}

	body.bmag-product-filter-ready .bmag-filter-sidebar > .elementor-widget-wrap,
	body.bmag-product-filter-ready .bmag-filter-sidebar > .elementor-element-populated {
		block-size: 100%;
		display: block !important;
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: 0 20px 94px !important;
		-webkit-overflow-scrolling: touch;
	}

	.bmag-filter-drawer-head {
		align-items: center;
		background: #fff;
		border-block-end: 1px solid #dbe6ef;
		display: flex;
		justify-content: space-between;
		margin: 0 -20px 18px;
		min-block-size: 70px;
		padding: max(10px, env(safe-area-inset-top)) 16px 10px 20px;
		position: sticky;
		top: 0;
		z-index: 3;
	}

	html[dir="rtl"] .bmag-filter-drawer-head {
		padding-inline: 16px 20px;
	}

	.bmag-filter-drawer-title {
		color: #0b3654;
		font-size: 20px;
		line-height: 1.25;
	}

	.bmag-filter-close {
		background: #eef6fb;
		border-radius: 9px;
		color: #045cb4;
		inline-size: 48px;
		padding: 0;
	}

	.bmag-filter-close svg {
		block-size: 24px;
		fill: none;
		inline-size: 24px;
		stroke: currentColor;
		stroke-linecap: round;
		stroke-width: 2;
	}

	.bmag-filter-drawer-head + .elementor-widget-button {
		display: none !important;
	}

	body.bmag-product-filter-ready .bmag-filter-sidebar .elementor-widget {
		margin-block-end: 18px !important;
	}

	body.bmag-product-filter-ready .bmag-filter-sidebar .elementor-heading-title,
	body.bmag-product-filter-ready .bmag-filter-sidebar .filter-title {
		color: #0b3654 !important;
		font-family: Arial, sans-serif !important;
		font-size: 18px !important;
		font-weight: 700 !important;
		line-height: 1.35 !important;
		margin-block: 6px 10px !important;
		text-align: start !important;
	}

	body.bmag-product-filter-ready .bmag-filter-sidebar .elementor-widget-shortcode a,
	body.bmag-product-filter-ready .bmag-filter-sidebar .filter-item > a,
	body.bmag-product-filter-ready .bmag-filter-sidebar .filter-item .term-label {
		align-items: center;
		border-block-end: 1px solid #e6eef4;
		box-sizing: border-box;
		color: #263746;
		display: flex !important;
		font-family: Arial, sans-serif;
		font-size: 16px !important;
		line-height: 1.35 !important;
		min-block-size: 48px;
		padding: 11px 8px !important;
		text-align: start;
		text-decoration: none;
	}

	body.bmag-product-filter-ready .bmag-filter-sidebar .elementor-widget-shortcode a.bmag-filter-shape-active,
	body.bmag-product-filter-ready .bmag-filter-sidebar .filter-item.active > a,
	body.bmag-product-filter-ready .bmag-filter-sidebar .filter-item.active .term-label {
		background: #eaf7fd;
		border-radius: 8px;
		color: #045cb4 !important;
		font-weight: 700;
	}

	body.bmag-product-filter-ready .bmag-filter-sidebar .elementor-widget-yith_wcan_filters,
	body.bmag-product-filter-ready .bmag-filter-sidebar .yith-wcan-filters,
	body.bmag-product-filter-ready .bmag-filter-sidebar .filters-container {
		block-size: auto !important;
		max-block-size: none !important;
		overflow: visible !important;
	}

	body.bmag-product-filter-ready .bmag-filter-sidebar :is(ul, .filter-items) {
		margin-block: 0 18px !important;
		padding: 0 !important;
	}

	body.bmag-product-filter-ready .bmag-filter-sidebar .filter-item {
		margin: 0 !important;
	}

	.bmag-filter-drawer-footer {
		align-items: center;
		background: #fff;
		border-block-start: 1px solid #dbe6ef;
		bottom: 0;
		display: grid;
		gap: 10px;
		grid-template-columns: minmax(110px, 0.8fr) minmax(150px, 1.2fr);
		inline-size: min(92vw, 420px);
		inset-inline-end: 0;
		margin: 0;
		padding: 12px 16px max(12px, env(safe-area-inset-bottom));
		position: fixed;
		z-index: 10071;
	}

	.bmag-filter-clear,
	.bmag-filter-view {
		border-radius: 9px;
		font-size: 15px;
		font-weight: 700;
		padding-inline: 14px;
	}

	.bmag-filter-clear {
		background: #eef6fb;
		color: #045cb4;
	}

	.bmag-filter-clear:disabled {
		color: #8496a5;
		cursor: default;
		opacity: 0.72;
	}

	.bmag-filter-view {
		background: #045cb4;
		color: #fff;
	}

	body.bmag-product-filter-ready .bmag-filter-legacy-quote {
		display: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bmag-filter-sidebar {
		transition: none;
	}
}
