.apfg {
	--apfg-bg: #F2F3FF;
	--apfg-card: #ffffff;
	--apfg-text: #111827;
	--apfg-muted: #6b7280;
	--apfg-border: #00000033;
	--apfg-soft-border: #00000033;
	--apfg-primary: #FF4646;
	--apfg-primary-hover: #e83b3b;
	--apfg-success: #15803d;
	--apfg-danger: #b91c1c;
	--apfg-warning: #f59e0b;
	--apfg-radius: 12px;
	--apfg-shadow: 0 14px 40px rgba(17, 24, 39, 0.08);
	--apfg-shadow-soft: 0 8px 22px rgba(17, 24, 39, 0.06);
	color: var(--apfg-text);
	font-family: inherit;
}

.apfg *,
.apfg *::before,
.apfg *::after {
	box-sizing: border-box;
}

.apfg a {
	color: inherit;
	text-decoration: none;
}

.apfg button,
.apfg input,
.apfg select {
	font: inherit;
}

.apfg-layout {
	display: grid;
	grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

.apfg-filter-panel,
.apfg-product-card {
	background: var(--apfg-card);
	border: 1px solid var(--apfg-border);
	border-radius: var(--apfg-radius);
	box-shadow: var(--apfg-shadow-soft);
}

.apfg-filter-panel {
	position: sticky;
	top: 24px;
	padding: 20px;
}

.apfg-filter-form {
	display: grid;
	gap: 18px;
}

.apfg-filter-close,
.apfg-mobile-filter-toggle {
	display: none;
}

.apfg-filter-group {
	margin: 0;
	padding: 18px 0 0;
	border: 0;
	border-top: 1px solid var(--apfg-soft-border);
}

.apfg-filter-group:first-of-type {
	padding-top: 0;
	border-top: 0;
}

.apfg-filter-group legend,
.apfg-search-label span,
.apfg-sort-controls span {
	display: block;
	margin: 0 0 8px;
	color: var(--apfg-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0;
	text-transform: uppercase;
}

.apfg-filter-group legend {
	margin-bottom: 4px;
}

.apfg-search-label {
	display: block;
	width: 100%;
}

.apfg-search-input,
.apfg-sort-controls select {
	width: 100% !important;
	min-height: 42px;
	padding: 9px 12px !important;
	color: var(--apfg-text);
	background: #fff;
	border: 1px solid var(--apfg-border) !important;
	border-radius: 10px !important;
	outline: none;
	transition: border-color 160ms ease, box-shadow 160ms ease !important;
}

.apfg-search-input:focus,
.apfg-search-input:active,
.apfg-sort-controls select:focus {
	border-color: var(--apfg-primary) !important;
	box-shadow: 0 0 0 3px rgba(255, 70, 70, 0.16);
}

.apfg-filter-switches {
	display: grid;
	gap: 12px;
}

.apfg-switch {
	display: grid;
	grid-template-columns: 46px 1fr;
	gap: 10px;
	align-items: center;
	color: var(--apfg-text);
	cursor: pointer;
}

.apfg-switch input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.apfg-switch-ui {
	position: relative;
	width: 46px;
	height: 26px;
	background: #d1d5db;
	border-radius: 999px;
	transition: background 160ms ease;
}

.apfg-switch-ui::after {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	content: "";
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 2px 6px rgba(17, 24, 39, 0.24);
	transition: transform 160ms ease;
}

.apfg-switch input:checked + .apfg-switch-ui {
	background: var(--apfg-primary);
}

.apfg-switch input:checked + .apfg-switch-ui::after {
	transform: translateX(20px);
}

.apfg-switch input:focus-visible + .apfg-switch-ui {
	box-shadow: 0 0 0 3px rgba(255, 70, 70, 0.2);
}

.apfg-range-track {
	display: grid;
	gap: 8px;
}

.apfg-price-range {
	width: 100%;
	accent-color: var(--apfg-primary);
}

.apfg-dual-range {
	position: relative;
	height: 34px;
	margin-top: 2px;
}

.apfg-dual-range::before {
	position: absolute;
	top: 14px;
	left: 0;
	right: 0;
	height: 6px;
	content: "";
	background: linear-gradient(
		to right,
		#e5e7eb 0%,
		#e5e7eb var(--apfg-price-start, 0%),
		var(--apfg-primary) var(--apfg-price-start, 0%),
		var(--apfg-primary) var(--apfg-price-end, 100%),
		#e5e7eb var(--apfg-price-end, 100%),
		#e5e7eb 100%
	);
	border-radius: 999px;
}

.apfg-dual-range .apfg-price-range {
	position: absolute;
	top: 7px;
	left: 0;
	width: 100%;
	height: 20px;
	margin: 0;
	pointer-events: none;
	background: transparent;
	appearance: none;
}

.apfg-dual-range .apfg-price-range::-webkit-slider-runnable-track {
	height: 6px;
	background: transparent;
	border: 0;
}

.apfg-dual-range .apfg-price-range::-moz-range-track {
	height: 6px;
	background: transparent;
	border: 0;
}

.apfg-dual-range .apfg-price-range::-webkit-slider-thumb {
	width: 20px;
	height: 20px;
	margin-top: -7px;
	pointer-events: auto;
	background: var(--apfg-primary);
	border: 3px solid #fff;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(17, 24, 39, 0.22);
	cursor: grab;
	appearance: none;
}

.apfg-dual-range .apfg-price-range::-moz-range-thumb {
	width: 20px;
	height: 20px;
	pointer-events: auto;
	background: var(--apfg-primary);
	border: 3px solid #fff;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(17, 24, 39, 0.22);
	cursor: grab;
}

.apfg-dual-range .apfg-price-range:focus-visible::-webkit-slider-thumb {
	box-shadow: 0 0 0 4px rgba(255, 70, 70, 0.18), 0 2px 8px rgba(17, 24, 39, 0.22);
}

.apfg-dual-range .apfg-price-range:focus-visible::-moz-range-thumb {
	box-shadow: 0 0 0 4px rgba(255, 70, 70, 0.18), 0 2px 8px rgba(17, 24, 39, 0.22);
}

.apfg-price-range-min {
	z-index: 2;
}

.apfg-price-range-max {
	z-index: 3;
}

.apfg-price-labels {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 12px;
}

.apfg-price-labels span {
	color: var(--apfg-text);
	font-size: 13px;
	font-weight: 500;
	line-height: 1.25;
}

.apfg-checkbox-list {
	display: grid;
	gap: 10px;
	max-height: 240px;
	overflow: auto;
	padding-right: 4px;
}

.apfg-checkbox {
	display: grid;
	grid-template-columns: 22px 1fr;
	gap: 10px;
	align-items: center;
	cursor: pointer;
}

.apfg-checkbox input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.apfg-checkbox span {
	position: relative;
	width: 20px;
	height: 20px;
	border: 1px solid var(--apfg-border);
	border-radius: 6px;
	background: #fff;
	transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.apfg-checkbox span::after {
	position: absolute;
	top: 3px;
	left: 6px;
	width: 6px;
	height: 10px;
	content: "";
	border: solid #fff;
	border-width: 0 2px 2px 0;
	opacity: 0;
	transform: rotate(45deg);
}

.apfg-checkbox input:checked + span {
	background: var(--apfg-primary);
	border-color: var(--apfg-primary);
}

.apfg-checkbox input:checked + span::after {
	opacity: 1;
}

.apfg-checkbox input:focus-visible + span {
	box-shadow: 0 0 0 3px rgba(255, 70, 70, 0.18);
}

.apfg-checkbox em {
	color: var(--apfg-text);
	font-style: normal;
	line-height: 1.35;
}

.apfg-filter-actions {
	display: grid;
	gap: 10px;
	padding-top: 4px;
}

.apfg-apply-filters,
.apfg-clear-filters,
.apfg-load-more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 10px 16px;
	border: 1px solid transparent;
	border-radius: 10px;
	cursor: pointer;
	font-weight: 700;
	transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.apfg-apply-filters,
.apfg-load-more {
	color: #fff;
	background: var(--apfg-primary);
}

.apfg-apply-filters:hover,
.apfg-load-more:hover {
	background: var(--apfg-primary-hover);
}

.apfg-clear-filters {
	width: 100%;
	color: #fff;
	background: var(--apfg-primary);
	border-color: var(--apfg-primary);
}

.apfg-clear-filters:hover,
.apfg-clear-filters:focus-visible {
	color: #fff;
	background: var(--apfg-primary-hover);
	border-color: var(--apfg-primary-hover);
}

.apfg-clear-filters:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(255, 70, 70, 0.18);
}

.apfg-clear-filters:active {
	background: #d93636;
	border-color: #d93636;
	transform: translateY(1px);
}

.apfg[data-apfg-auto-filter="yes"] .apfg-apply-filters {
	display: none;
}

.apfg-grid-region {
	position: relative;
	min-width: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.apfg-result-count {
	margin: 0;
	color: var(--apfg-muted);
	font-weight: 700;
}

.apfg-sort-controls {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

.apfg-products {
	display: grid;
	grid-template-columns: repeat(var(--apfg-columns), minmax(0, 1fr));
	gap: 18px;
}

.apfg-product-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-width: 0;
	color: inherit;
	transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.apfg-product-card:hover {
	border-color: var(--apfg-border);
	box-shadow: var(--apfg-shadow);
	transform: translateY(-2px);
}

.apfg-product-card:focus-visible {
	outline: none;
	border-color: var(--apfg-primary);
	box-shadow: 0 0 0 3px rgba(255, 70, 70, 0.16), var(--apfg-shadow);
}

.apfg-card-media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #ffffff;
	padding: 10px;
}

.apfg-card-media img,
.apfg-card-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 8px;
}

.apfg-sale-badge,
.apfg-stock-badge {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	border-radius: 6px;
	font-size:  0.8rem;
	font-weight: 600;
	line-height: 1;
}

.apfg-sale-badge {
	position: absolute;
	top: 20px;
	left: 20px;
	z-index: 1;
	padding: 8px 12px;
	color: #fff;
	background: var(--apfg-primary);
}

.apfg-card-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	padding: 16px;
}

.apfg-card-title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
}

.apfg-product-card:hover .apfg-card-title,
.apfg-product-card:focus-visible .apfg-card-title {
	color: var(--apfg-primary);
}

.apfg-card-price {
	color: var(--apfg-primary);
	font-weight: 600;
}

.apfg-card-price del {
	color: var(--apfg-muted);
	font-weight: 500;
}

.apfg-card-price ins {
	color: var(--apfg-primary);
	font-weight: 600;
	text-decoration: none;
}

.apfg-price-prefix {
	color: var(--apfg-muted);
}

.apfg-price-value {
	color: var(--apfg-primary);
}

.apfg-stock-badge {
	margin: 0;
	padding: 6px 8px;
	color: var(--apfg-danger);
	background: #fee2e2;
}

.apfg-pagination {
	display: flex;
	justify-content: center;
	margin-top: 22px;
}

.apfg-empty {
	padding: 44px 20px;
	color: var(--apfg-muted);
	background: var(--apfg-bg);
	border: 1px dashed var(--apfg-border);
	border-radius: 12px;
	font-weight: 700;
	text-align: center;
}

.apfg.is-loading .apfg-grid-region {
	pointer-events: none;
}

.apfg.is-loading .apfg-products,
.apfg.is-loading .apfg-empty,
.apfg.is-loading .apfg-pagination {
	opacity: 0.45;
}

.apfg.is-loading .apfg-grid-region::after {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	content: "";
	background: rgba(255, 255, 255, 0.42);
	border-radius: var(--apfg-radius);
}

.apfg-notice {
	padding: 16px;
	background: #fff;
	border: 1px solid var(--apfg-border);
	border-radius: var(--apfg-radius);
}

.apfg .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 1100px) {
	.apfg-products.apfg-columns-4,
	.apfg-products.apfg-columns-5,
	.apfg-products.apfg-columns-6 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 900px) {
	.apfg-layout {
		grid-template-columns: 1fr;
	}

	.apfg-filter-panel {
		position: static;
	}

	.apfg-products,
	.apfg-products.apfg-columns-3,
	.apfg-products.apfg-columns-4,
	.apfg-products.apfg-columns-5,
	.apfg-products.apfg-columns-6 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 720px) {
	.apfg-mobile-filter-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		min-height: 44px;
		margin-bottom: 14px;
		color: #fff;
		background: var(--apfg-primary);
		border: 0;
		border-radius: 12px;
		font-weight: 800;
		transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
	}

	.apfg-mobile-filter-toggle:hover,
	.apfg-mobile-filter-toggle:focus-visible {
		background: var(--apfg-primary-hover);
	}

	.apfg-mobile-filter-toggle:focus-visible {
		outline: none;
		box-shadow: 0 0 0 3px rgba(255, 70, 70, 0.18);
	}

	.apfg-mobile-filter-toggle:active {
		background: #d93636;
		transform: translateY(1px);
	}

	.apfg-filter-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 34px;
		height: 34px;
		color: var(--apfg-text);
		background: #fff;
		border: 1px solid var(--apfg-border);
		border-radius: 10px;
		cursor: pointer;
		font-size: 24px;
		line-height: 1;
		transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
	}

	.apfg-filter-close:hover,
	.apfg-filter-close:focus-visible {
		color: #fff;
		background: var(--apfg-primary);
		border-color: var(--apfg-primary);
	}

	.apfg-filter-close:focus-visible {
		outline: none;
		box-shadow: 0 0 0 3px rgba(255, 70, 70, 0.18);
	}

	.apfg-filter-close:active {
		background: var(--apfg-primary-hover);
		border-color: var(--apfg-primary-hover);
		transform: translateY(1px);
	}

	.apfg-filter-panel {
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		z-index: 9999;
		width: min(88vw, 380px);
		padding: 20px;
		overflow-y: auto;
		border-radius: 0 12px 12px 0;
		transform: translateX(-102%);
		transition: transform 180ms ease;
	}

	.apfg.is-filter-open .apfg-filter-panel {
		transform: translateX(0);
	}

}

@media (max-width: 560px) {
	.apfg-grid-region {
		padding: 0;
	}

	.apfg-products,
	.apfg-products.apfg-columns-3,
	.apfg-products.apfg-columns-4,
	.apfg-products.apfg-columns-5,
	.apfg-products.apfg-columns-6 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	.apfg-card-price-sale {
		display: grid;
		gap: 2px;
		align-items: start;
	}

	.apfg-card-price-sale del,
	.apfg-card-price-sale ins {
		display: block;
	}

	.apfg-price-labels {
		align-items: flex-start;
		flex-direction: column;
	}
}
