/* Shop archive layout. */

/* Flexbox rather than a fixed grid-template-columns: if the sidebar is
   ever inactive/empty (see sidebar-shop.php's is_active_sidebar() guard)
   it simply won't be in the DOM at all, and a fixed 2-column grid would
   still reserve its 260px track — squeezing the product grid into that
   narrow leftover space instead of using the full width. flex:1 on
   .lf-shop-main naturally expands to fill whatever space is actually
   available, sidebar present or not. */
.lf-shop-layout {
	display: flex;
	align-items: flex-start;
	gap: 2rem;
	padding-block: var(--lf-section-gap);
}

.lf-shop-sidebar {
	flex: 0 0 260px;
}

.lf-shop-main {
	flex: 1 1 0%;
	min-width: 0; /* Allow content (e.g. long product titles) to wrap
	                 instead of forcing the flex item wider than the
	                 space actually available. */
}

.lf-shop-main {
	/* On archives the outer .lf-container is opened by .lf-shop-layout
	   instead, so this element carries no extra padding of its own. */
}

.lf-archive-header {
	margin-bottom: 1rem;
}

.lf-shop-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
	flex-wrap: wrap;
}

.lf-filter-open {
	display: none;
}

.woocommerce-result-count {
	color: var(--lf-muted);
	font-size: 0.85rem;
	margin: 0;
}

.woocommerce-ordering select {
	border: 1px solid var(--lf-border);
	border-radius: var(--lf-radius-sm);
	padding: 0.5rem 0.85rem;
	font-size: 0.85rem;
	background: var(--lf-card-background);
}

/* Product grid — reuse the same visual language as .lf-products-grid
   without renaming WooCommerce's own ul.products markup. */
ul.products {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

ul.products li.product {
	list-style: none;
}

.lf-shop-sidebar {
	background: var(--lf-card-background);
	border-radius: var(--lf-radius);
	padding: 1.25rem;
	box-shadow: var(--lf-shadow-sm);
}

.lf-filter-drawer__header {
	display: none;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1rem;
}

.lf-shop-sidebar .lf-widget {
	margin-bottom: 1.5rem;
}

.lf-shop-sidebar .lf-widget:last-child {
	margin-bottom: 0;
}

.lf-shop-sidebar .lf-widget-title {
	font-size: 0.9rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	margin-bottom: 0.75rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	user-select: none;
}

.lf-shop-sidebar .lf-widget-title::after {
	content: "";
	width: 8px;
	height: 8px;
	border-inline-end: 2px solid currentColor;
	border-block-end: 2px solid currentColor;
	transform: rotate(45deg);
	opacity: 0.5;
	flex-shrink: 0;
	transition: transform var(--lf-transition);
}

.lf-shop-sidebar .lf-widget.is-collapsed .lf-widget-title::after {
	transform: rotate(-45deg);
}

.lf-shop-sidebar .lf-widget-title:focus-visible {
	outline: 2px solid var(--lf-primary);
	outline-offset: 2px;
}

.lf-shop-sidebar .lf-widget > *:not(.lf-widget-title) {
	overflow: hidden;
	max-height: 600px;
	transition: max-height var(--lf-transition), opacity var(--lf-transition), margin var(--lf-transition);
}

.lf-shop-sidebar .lf-widget.is-collapsed > *:not(.lf-widget-title) {
	max-height: 0;
	opacity: 0;
	margin: 0;
}

/* ---- Active filter chips + Clear all ---- */

.lf-active-filters {
	margin-bottom: 1.25rem;
	padding-bottom: 1.25rem;
	border-bottom: 1px solid var(--lf-border);
}

.lf-active-filters__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 0.6rem;
}

.lf-filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	background: var(--lf-accent);
	color: var(--lf-primary-dark, var(--lf-primary));
	font-size: 0.8rem;
	font-weight: 600;
	padding: 0.35rem 0.75rem;
	border-radius: var(--lf-radius-pill);
}

.lf-filter-chip:hover {
	background: var(--lf-primary);
	color: #fff;
}

.lf-active-filters__clear {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--lf-primary);
	text-decoration: underline;
}

/* ---- WooCommerce's own filter widgets — styled to match the sidebar
   card rather than left in their unstyled default markup. ---- */

.lf-shop-sidebar .product-categories,
.lf-shop-sidebar .widget_layered_nav ul,
.lf-shop-sidebar .widget_rating_filter ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.5rem;
}

.lf-shop-sidebar .product-categories li a,
.lf-shop-sidebar .widget_layered_nav ul li a,
.lf-shop-sidebar .widget_rating_filter ul li a {
	color: var(--lf-muted);
	font-size: 0.9rem;
}

.lf-shop-sidebar .product-categories li a:hover,
.lf-shop-sidebar .widget_layered_nav ul li a:hover,
.lf-shop-sidebar .widget_rating_filter ul li a:hover,
.lf-shop-sidebar .product-categories li.chosen > a,
.lf-shop-sidebar .widget_layered_nav ul li.chosen a {
	color: var(--lf-primary);
}

.lf-shop-sidebar .product-categories li .count {
	color: var(--lf-muted);
	font-size: 0.75rem;
}

.lf-shop-sidebar .price_slider {
	margin-bottom: 1rem;
}

.lf-shop-sidebar .price_slider_amount {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	font-size: 0.85rem;
}

.lf-shop-sidebar .price_slider_amount button {
	background: var(--lf-primary);
	color: #fff;
	border: none;
	border-radius: var(--lf-radius-sm);
	padding: 0.4rem 1rem;
	font-size: 0.8rem;
	cursor: pointer;
}

.lf-shop-sidebar .ui-slider {
	position: relative;
	height: 4px;
	background: var(--lf-border);
	border-radius: var(--lf-radius-pill);
	margin: 1rem 0.4rem 1.25rem;
}

.lf-shop-sidebar .ui-slider-range {
	position: absolute;
	height: 100%;
	background: var(--lf-primary);
	border-radius: var(--lf-radius-pill);
}

.lf-shop-sidebar .ui-slider-handle {
	position: absolute;
	top: 50%;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	margin-left: -8px;
	background: #fff;
	border: 2px solid var(--lf-primary);
	border-radius: 50%;
	cursor: pointer;
	outline: none;
}

.lf-shop-sidebar .star-rating {
	display: inline-block;
	color: #f5a623;
	font-size: 0.85rem;
}

.woocommerce-pagination {
	display: flex;
	justify-content: center;
	margin-top: 2.5rem;
}

.woocommerce-pagination ul {
	display: flex;
	gap: 0.5rem;
	list-style: none;
	padding: 0;
}

.woocommerce-pagination a,
.woocommerce-pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	border-radius: var(--lf-radius-sm);
	background: var(--lf-card-background);
	border: 1px solid var(--lf-border);
}

.woocommerce-pagination .current {
	background: var(--lf-primary);
	color: #fff;
	border-color: var(--lf-primary);
}

@media (max-width: 900px) {
	.lf-filter-open {
		display: inline-flex;
	}

	.lf-filter-drawer__header {
		display: flex;
	}

	.lf-shop-sidebar.lf-filter-drawer {
		position: fixed;
		inset: 0 0 0 auto;
		width: min(85vw, 340px);
		border-radius: 0;
		transform: translateX(100%);
		transition: transform 220ms ease;
		z-index: 250;
		overflow-y: auto;
	}

	.lf-shop-sidebar.lf-filter-drawer.is-open {
		transform: translateX(0);
	}

	ul.products {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.85rem;
	}
}

@media (max-width: 480px) {
	ul.products {
		grid-template-columns: repeat(2, 1fr);
	}
}
