/*
Shop / category / tag archives. No archive-product.php override â€” every
piece here (result count, sorting, pagination, sidebar) is WooCommerce's
own default markup, restyled. Two exceptions, both relocated by
inc/woocommerce.php out of #primary so they aren't squeezed into the
narrow content column: the page header (title/breadcrumb) above the
sidebar/product-grid columns, and the archive description -- an SEO text
block -- at the very bottom of the page instead, below them.
*/

/* Full-width header band: breadcrumb + title, above the sidebar/product-grid
   columns rather than inside them. */
.shop-page-header {
	padding-block: var(--space-6) var(--space-3);
}

.shop-page-header .page-header {
	padding-block: 0;
}

.shop-page-header .page-title {
	margin-block-end: 0;
}

/* SEO text block: the shop/category description, at the very bottom of the
   page (below the sidebar/product-grid columns) rather than above the
   products -- see new_ubit_shop_seo_box(). Boxed off so it visibly reads
   as supplementary content, not part of the product listing above it. */
.shop-seo-box {
	padding-block: var(--space-8);
	background: var(--color-surface);
	border-block-start: 1px solid var(--color-border);
}

.shop-seo-box .page-description,
.shop-seo-box .term-description {
	margin-block-end: 0;
}

/* #primary.content-area's base container treatment lives in
   product-card.css (loaded on every WooCommerce page). When the
   shop-layout wrapper below is present, it owns the width/padding
   instead â€” #primary inside it just fills its grid column. */
.shop-layout {
	max-width: var(--container-w);
	margin-inline: auto;
	padding-inline: var(--container-pad);
	padding-block: var(--space-3) var(--space-8);
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-6);
	align-items: start;
}



.shop-layout #primary.content-area {
	max-width: none;
	margin-inline: 0;
	padding-inline: 0;
	padding-block: 0;
}

/* AJAX sort/filter/pagination navigation (shop-filters.js) sets this while
   the next #primary content is being fetched. */
#primary.is-loading {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity var(--transition-fast);
}

@media (min-width: 1024px) {
	.shop-layout {
		grid-template-columns: 260px 1fr;
	}

	.shop-layout > aside {
		order: -1;
	}
}

/* .page-description is the shop page's own description (its page content);
   .term-description is a category/tag/attribute archive's -- WooCommerce
   uses different wrapper classes for the two. */
.page-description,
.term-description {
	color: var(--color-muted);
	margin-block-end: var(--space-6);
	font-size: var(--text-sm);
}

/* Toolbar: mobile filter toggle + result count + sorting -------------------- */

.shop-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	flex-wrap: wrap;
	margin-block-end: var(--space-5);
	/* padding-block-end: var(--space-4); */
	/* border-bottom: 1px solid var(--color-border); */
	flex-direction: row-reverse;
}

.woocommerce-result-count {
	font-size: var(--text-sm);
	color: var(--color-muted);
}

#shop-filters-toggle {
	margin-inline-start: auto;
}

@media (min-width: 1024px) {
	#shop-filters-toggle {
		display: none;
	}
}

/* Sorting pills (replaces WooCommerce's default <select>) -------------------- */

.shop-sorting {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	color: #cbcbcb;
}

.shop-sorting__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2);
	list-style: none;
}

.shop-sorting__pill {
	display: inline-flex;
	align-items: center;
	min-height: 29px;
	padding-inline: var(--space-2);
	border-radius: var(--radius-md);
	font-size: var(--text-xs);
	font-weight: var(--font-medium);
	color: var(--color-muted);
	white-space: nowrap;
	transition: background-color var(--transition-fast), color var(--transition-fast);
}

.shop-sorting__pill:hover {
	background: var(--color-surface);
}

.shop-sorting__pill.is-active {
	background: var(--color-ink);
	color: var(--color-bg);
}

.shop-sorting__pill.is-active:hover {
	background: var(--color-ink);
}

/* Filter sidebar / widgets ---------------------------------------------------- */

#shop-filters {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
}

#shop-filters[hidden] {
	display: none;
}

@media (min-width: 1024px) {
	#shop-filters[hidden] {
		display: block;
	}

	/* Sticky on desktop only -- on mobile it's a full-screen modal (below),
	   not a side column, so sticking it would be odd.
	   --new-ubit-shop-filters-top (set by shop-filters.js from the sticky
	   header's actual rendered height, which varies with the admin bar and
	   responsive breakpoints) keeps it clear of the header at any height;
	   the 96px fallback is just a reasonable guess for before that JS runs. */
	#shop-filters {
		position: sticky;
		top: calc(var(--new-ubit-shop-filters-top, 96px) + var(--space-4));
		max-height: calc(100vh - var(--new-ubit-shop-filters-top, 96px) - var(--space-4) * 2);
		overflow-y: auto;
	}
}

/* Fixed filter panel: on-sale toggle + price range ---------------------------- */

.shop-filters__panel {
	/* margin-block-end: var(--space-6); */
	/* padding-block-end: var(--space-6); */
	/* border-bottom: 1px solid var(--color-border); */
}

.shop-filters__header {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding-block-end: var(--space-5);
	margin-block-end: var(--space-5);
	border-bottom: 1px solid var(--color-border);
}

.shop-filters__clear {
	margin-inline-start: auto;
	padding: 0;
	background: none;
	border: none;
	font-size: var(--text-xs);
	color: var(--color-muted);
	cursor: pointer;
}

.shop-filters__clear:hover {
	color: var(--color-primary);
}

/* Close (X) only exists for the mobile full-screen modal (@media
   max-width: 1023.98px below) -- desktop's sidebar has no need to close
   anything. */
.shop-filters__close {
	display: none;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	color: var(--color-muted);
}

.shop-filters__close:hover {
	color: var(--color-ink);
}

/* "پاک کردن فیلتر" + "تایید" -- the mobile modal's fixed bottom bar (below).
   Desktop's sidebar has its own clear link in the header instead
   (.shop-filters__clear above) and no apply/confirm step at all, since
   filters there already apply live with no modal to dismiss. */
.shop-filters__actions {
	display: none;
}

.shop-filters__heading {
	font-size: var(--text-base);
	font-weight: var(--font-semibold);
}

.shop-filters__header .icon {
	color: var(--color-muted);
}

/* Below 1024px, "not hidden" is a full-screen modal instead of an inline
   collapsible block -- same #shop-filters[hidden]/JS toggle mechanism as
   before (shop-filters.js), just presented differently. .shop-filters__panel
   splits into three rows: the header pinned at the top, .shop-filters__scroll
   (form + any dynamic-sidebar widgets) filling the space between and
   scrolling on its own, and .shop-filters__actions (clear + confirm)
   fixed to the bottom of the screen. */
@media (max-width: 1023.98px) {
	#shop-filters:not([hidden]) {
		position: fixed;
		inset: 0;
		z-index: 120;
		display: flex;
		padding: 0;
		border: none;
		border-radius: 0;
		background: var(--color-bg);
	}

	.shop-filters__panel {
		display: flex;
		flex-direction: column;
		width: 100%;
		min-height: 0;
	}

	.shop-filters__header {
		flex-shrink: 0;
		padding: var(--space-4) var(--space-5);
		margin-block-end: 0;
	}

	/* Its job moves to .shop-filters__actions' own "پاک کردن فیلتر" button
	   below. */
	.shop-filters__clear {
		display: none;
	}

	.shop-filters__scroll {
		flex: 1;
		min-height: 0;
		overflow-y: auto;
		padding: var(--space-5);
		/* Room at the bottom so the last filter section never ends up
		   hidden behind the fixed .shop-filters__actions bar. */
		padding-block-end: calc(var(--space-5) + 56px + var(--space-4) + env(safe-area-inset-bottom, 0px));
	}

	.shop-filters__close {
		display: inline-flex;
	}

	.shop-filters__actions {
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 1;
		display: flex;
		gap: var(--space-3);
		padding: var(--space-4) var(--space-5);
		padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
		border-top: 1px solid var(--color-border);
		background: var(--color-bg);
	}

	.shop-filters__actions .btn {
		flex: 1;
	}
}

/* Each filter "widget" in the panel (the toggle group, price range,
   categories) gets the same light divider the dynamic widgets below them
   already use (see .widget) -- :last-child drops it off whichever one
   ends up last, since the categories section only renders when there
   actually are categories. The two toggles share one such divider (see
   .shop-filters__toggles below) rather than each getting their own --
   they read as one section, not two. */
.shop-filters__toggles,
.shop-filters__price,
.shop-filters__categories {
	padding-block-end: var(--space-5);
	border-bottom: 1px solid var(--color-border);
}

.shop-filters__toggles:last-child,
.shop-filters__price:last-child,
.shop-filters__categories:last-child {
	padding-block-end: 0;
	border-bottom: none;
}

.shop-filters__toggles {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.shop-filters__toggle-row {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	flex-direction: row-reverse;
	justify-content: space-between;
}

.shop-filters__toggle-label {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	font-size: var(--text-xs);
	color: var(--color-ink);
}

.shop-filters__toggle-label .icon {
	width: 1.1em;
	height: 1.1em;
	color: var(--color-sale);
}

/* Toggle switch ---------------------------------------------------------------- */

.switch {
	position: relative;
	display: inline-flex;
	flex-shrink: 0;
	cursor: pointer;
}

.switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.switch__track {
	display: block;
	width: 40px;
	height: 24px;
	border-radius: var(--radius-full);
	background: var(--color-border);
	transition: background-color var(--transition-fast);
}

.switch__thumb {
	position: absolute;
	inset-block-start: 2px;
	inset-inline-start: 2px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--color-bg);
	box-shadow: var(--shadow-sm);
	transition: transform var(--transition-fast);
}

.switch input:checked + .switch__track {
	background: var(--color-primary);
}

.switch input:checked + .switch__track .switch__thumb {
	transform: translateX(-16px);
}

.switch input:focus-visible + .switch__track {
	box-shadow: 0 0 0 3px var(--color-focus-ring);
}

/* Collapsible section header -- shared by the price range and category
   filter sections (and any future one added the same way: a
   .shop-filters__section-toggle button whose aria-controls points at the
   collapsible body, toggled in shop-filters.js). ------------------------- */

.shop-filters__section-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 0;
	background: none;
	border: none;
	font-size: var(--text-sm);
	font-weight: var(--font-semibold);
	color: var(--color-ink);
	cursor: pointer;
}

.shop-filters__section-toggle .icon {
	color: var(--color-muted);
	transition: transform var(--transition-fast);
}

.shop-filters__section-toggle[aria-expanded="false"] .icon {
	transform: rotate(-90deg);
}

/* Price range -------------------------------------------------------------- */

.shop-filters__price-body {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	margin-block-start: var(--space-1);
}

.shop-filters__price-body[hidden],
.shop-filters__categories-body[hidden] {
	display: none;
}

.shop-filters__price-fields {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.shop-filters__price-field {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	font-size: var(--text-sm);
	color: var(--color-muted);
}

.shop-filters__price-input {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding-inline: var(--space-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
}

.shop-filters__price-input .input {
	flex: 1;
	width: auto;
	min-width: 0;
	min-height: 40px;
	padding-inline: 0;
	border: none;
}

.shop-filters__price-input .input:focus-visible {
	box-shadow: none;
	outline: none;
}

.shop-filters__price-input span:last-child {
	color: var(--color-muted);
	font-size: var(--text-xs);
	white-space: nowrap;
}

.shop-filters__slider {
	position: relative;
	display: flex;
	align-items: center;
	height: 10px;
}

.shop-filters__slider-track,
.shop-filters__slider-range {
	position: absolute;
	inset-inline: 0;
	height: 6px;
	border-radius: var(--radius-full);
}

.shop-filters__slider-track {
	background: var(--color-border);
}

.shop-filters__slider-range {
	background: var(--color-primary);
}

.shop-filters__slider-input {
	position: absolute;
	inset-inline: 0;
	width: 100%;
	margin: 0;
	background: none;
	appearance: none;
	-webkit-appearance: none;
	pointer-events: none;
}

.shop-filters__slider-input::-webkit-slider-runnable-track {
	-webkit-appearance: none;
	background: transparent;
}

.shop-filters__slider-input::-moz-range-track {
	background: transparent;
	border: none;
}

.shop-filters__slider-input::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	border: 3px solid var(--color-primary);
	border-radius: 50%;
	background: var(--color-bg);
	box-shadow: var(--shadow-sm);
	cursor: pointer;
	pointer-events: auto;
}

.shop-filters__slider-input::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border: 2px solid var(--color-primary);
	border-radius: 50%;
	background: var(--color-bg);
	box-shadow: var(--shadow-sm);
	cursor: pointer;
	pointer-events: auto;
}

.shop-filters__slider-labels {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: var(--text-xs);
	color: var(--color-muted);
}

/* Category filter (checkbox list) ------------------------------------------- */

.shop-filters__categories {
	margin-block-start: var(--space-6);
}

.shop-filters__categories-body {
	margin-block-start: var(--space-4);
}

.shop-filters__checkbox-list {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	list-style: none;
}

.shop-filters__checkbox {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	font-size: var(--text-sm);
	color: var(--color-ink);
	cursor: pointer;
}

.shop-filters__checkbox > span:first-of-type {
	flex: 1;
}

.shop-filters__checkbox-count {
	font-size: var(--text-xs);
	color: var(--color-muted);
}

.shop-filters__checkbox input {
	width: 18px;
	height: 18px;
	accent-color: var(--color-primary);
}

.widget {
	margin-block-end: var(--space-6);
	padding-block-end: var(--space-6);
	border-bottom: 1px solid var(--color-border);
}

.widget:last-child {
	border-bottom: none;
}

.widget-title {
	font-size: var(--text-sm);
	font-weight: var(--font-semibold);
	margin-block-end: var(--space-3);
}

.widget ul {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	list-style: none;
}

.widget ul a {
	font-size: var(--text-sm);
	color: var(--color-muted);
}

.widget ul a:hover {
	color: var(--color-ink);
}

.widget_price_filter .price_slider_amount {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2);
	margin-block-start: var(--space-4);
	font-size: var(--text-sm);
}

.widget_price_filter .price_slider_amount .button {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding-inline: var(--space-4);
	border-radius: var(--radius-md);
	background: var(--color-primary);
	color: var(--color-bg);
	font-size: var(--text-sm);
	font-weight: var(--font-medium);
}

/* Notice styling (.woocommerce-message/-error/-info) lives in
   product-card.css, shared across every WooCommerce page. */

/* Pagination --------------------------------------------------------------------- */

.woocommerce-pagination {
	margin-block-start: var(--space-8);
}

.woocommerce-pagination .page-numbers {
	display: flex;
	justify-content: center;
	gap: var(--space-2);
	list-style: none;
}

.woocommerce-pagination .page-numbers a,
.woocommerce-pagination .page-numbers span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	font-variant-numeric: tabular-nums;
}

.woocommerce-pagination .page-numbers a:hover {
	background: var(--color-surface);
}

.woocommerce-pagination .page-numbers .current {
	background: var(--color-primary);
	color: var(--color-bg);
	font-weight: var(--font-semibold);
}

/* Infinite scroll (shop-filters.js) -- built entirely by JS; WooCommerce's
   own .woocommerce-pagination above stays in the DOM (hidden), used only
   as the source of the "next page" link. No-JS / no-IntersectionObserver
   visitors just see the normal pagination instead, untouched. */

.shop-load-more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-3);
	margin-block-start: var(--space-8);
}

.shop-load-more__sentinel {
	width: 100%;
	height: 1px;
}

.shop-load-more__status {
	font-size: var(--text-sm);
	color: var(--color-muted);
}

.shop-load-more__button {
	min-width: 220px;
}

/* .btn sets display:inline-flex, which (same specificity, author beats UA)
   would otherwise win over the browser's default [hidden]{display:none}. */
.shop-load-more__button[hidden] {
	display: none;
}
