/**
 * Shop page – product sidebar layout, AJAX loading
 * Arsin Storefront Customizer
 * (استایل‌های لیوت محصولات حذف شده تا منبع مشکل پیدا شود)
 */

/* عنوان و توضیح آرشیو محصولات (فروشگاه / دسته) */
.asc-chrome-context .woocommerce-products-header,
.woocommerce-products-header {
	padding-bottom: 20px;
}

@media screen and (min-width: 768px) {
	.asc-chrome-context .woocommerce-products-header,
	.woocommerce-products-header {
		padding: 0 0 2em;
	}
}

/* ---- Product filters overlay (WooCommerce Blocks) ---- */
.wc-block-product-filters__overlay {
	border: 1px solid var(--asc-color-border);
	border-radius: var(--asc-border-radius);
	padding: 1.25rem;
	box-sizing: border-box;
}

/* استایل دکمه باز کردن overlay */
.wc-block-product-filters__open-overlay {
	font-family: var(--asc-font-family);
}

/* محدود کردن عرض overlay در دسکتاپ */
@media screen and (min-width: 768px) {
	.wc-block-product-filters__overlay {
		max-width: 240px;
		width: 100%;
	}
}

/* حذف padding در موبایل */
@media screen and (max-width: 767px) {
	.wc-block-product-filters__overlay {
		padding: 0;
	}
	
	/* استایل overlay باز در موبایل */
	:where(.wc-block-product-filters).is-overlay-opened .wc-block-product-filters__overlay {
		background-color: rgba(95, 95, 95, 0.35);
		pointer-events: auto;
		z-index: 99999;
	}
	
	/* استایل دکمه باز کردن overlay در موبایل */
	:where(.wc-block-product-filters) .wc-block-product-filters__open-overlay {
		align-items: center;
		background: var(--asc-color-bg);
		border: transparent;
		color: var(--asc-color-primary);
		display: flex;
		font-size: 16px;
		font-family: var(--asc-font-family);
		padding: 10px;
		justify-content: center;
	}
}

/* فیلتر قیمت: حداقل عرض اینپوت‌های کمترین و بیشترین مبلغ */
.wc-block-product-filter-price-slider input[type="text"].min,
.wc-block-product-filter-price-slider input[type="text"].max {
	min-width: 85px;
}

/* ---- Product sidebar layout ---- */
/* دسکتاپ: سایدبار سمت راست | موبایل: سایدبار بالای کاتالوگ */
@media screen and (min-width: 768px) {
	.left-sidebar .widget-area {
		margin-left: 0%;
	}
}

.asc-shop-layout {
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
	margin-bottom: 2rem;
}

.asc-shop-sidebar {
	flex: 0 0 240px;
	min-width: 0;
	max-width: 240px;
}

.asc-shop-products {
	flex: 1 1 300px;
	min-width: 0;
}

/* موبایل: سایدبار بالا، محصولات پایین */
@media screen and (max-width: 767px) {
	.asc-shop-layout {
		flex-direction: column;
		gap: 1.5rem;
	}

	.asc-shop-sidebar {
		flex: 1 1 auto;
		width: 100% !important;
		min-width: 100% !important;
		order: 1;
	}
	
	/* استایل widget block در سایدبار موبایل */
	.asc-shop-sidebar .widget_block {
		margin: 0 !important;
		padding: 15px !important;
	}

	.asc-shop-products {
		order: 2;
	}
}

/* دسکتاپ: محصولات چپ، سایدبار راست (RTL) */
@media screen and (min-width: 768px) {
	.asc-shop-products {
		order: 1;
	}

	.asc-shop-sidebar {
		order: 2;
	}

	[dir="rtl"] .asc-shop-layout {
		flex-direction: row-reverse;
	}
}

/* ---- Product cards styling ---- */
/* Flexbox برای یکسان کردن ارتفاع کارت‌ها */
.asc-shop-products ul.products {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
}

/* Border و ساختار کارت‌های محصول */
.asc-shop-products ul.products li.product {
	border: 1px solid var(--asc-color-border);
	border-radius: var(--asc-border-radius);
	overflow: hidden;
	box-sizing: border-box;
	padding: 0;
	display: flex;
	flex-direction: column;
}

/* لینک محصول: flex container برای چیدمان محتوا */
.asc-shop-products ul.products li.product > a {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
}

/* استایل دکمه‌های محصولات */
.asc-shop-products ul.products li.product .button {
	margin-bottom: unset;
	padding: 0.4em 0.8em;
	margin-top: auto;
	max-height: fit-content;
}

/* ---- Responsive product columns (استاندارد WooCommerce) ---- */
/* دسکتاپ: از تنظیم ادمین (loop_shop_columns) | تبلت: ۲ ستون | موبایل: از asc-shop-mobile-cols-* */

/* تبلت: 2 محصول در هر ردیف (768px تا 1023px) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
	.asc-shop-products ul.products li.product {
		width: 48% !important;
		margin-left: 4% !important;
		margin-right: 0 !important;
		clear: none !important;
	}

	.asc-shop-products ul.products li.product:nth-child(odd) {
		clear: both !important;
		margin-left: 0 !important;
	}

	.asc-shop-products ul.products li.product:nth-child(even) {
		margin-left: 4% !important;
	}

	[dir="rtl"] .asc-shop-products ul.products li.product {
		margin-right: 4% !important;
		margin-left: 0 !important;
	}

	[dir="rtl"] .asc-shop-products ul.products li.product:nth-child(odd) {
		margin-right: 0 !important;
	}

	[dir="rtl"] .asc-shop-products ul.products li.product:nth-child(even) {
		margin-right: 4% !important;
	}
}

/* موبایل: ستون‌ها از تنظیم ادمین (body.asc-shop-mobile-cols-1|2) — پیش‌فرض ۲ ستون */
@media screen and (max-width: 767px) {
	body.asc-shop-mobile-cols-2 .asc-shop-products ul.products li.product {
		width: 48%;
		margin-left: 4%;
		margin-right: 0;
		clear: none;
		float: left;
	}

	body.asc-shop-mobile-cols-2 .asc-shop-products ul.products li.product:nth-child(odd) {
		clear: both;
		margin-left: 0;
	}

	body.asc-shop-mobile-cols-2 .asc-shop-products ul.products li.product:nth-child(even) {
		margin-left: 4%;
	}

	body.asc-shop-mobile-cols-1 .asc-shop-products ul.products li.product {
		width: 100%;
		margin-left: 0;
		margin-right: 0;
		clear: both;
		float: none;
	}

	[dir="rtl"] body.asc-shop-mobile-cols-2 .asc-shop-products ul.products li.product {
		margin-right: 4%;
		margin-left: 0;
		float: right;
	}

	[dir="rtl"] body.asc-shop-mobile-cols-2 .asc-shop-products ul.products li.product:nth-child(odd) {
		margin-right: 0;
	}

	[dir="rtl"] body.asc-shop-mobile-cols-2 .asc-shop-products ul.products li.product:nth-child(even) {
		margin-right: 4%;
	}

	[dir="rtl"] body.asc-shop-mobile-cols-1 .asc-shop-products ul.products li.product {
		width: 100%;
		margin-right: 0;
		margin-left: 0;
		clear: both;
		float: none;
	}
}

/* ---- AJAX loading state ---- */
.asc-shop-loading .woocommerce ul.products,
.asc-shop-loading .woocommerce-pagination {
	opacity: 0.6;
	pointer-events: none;
}

.asc-shop-loading .asc-shop-layout {
	position: relative;
}

.asc-shop-loading .asc-shop-layout::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 24px;
	height: 24px;
	margin: -12px 0 0 -12px;
	border: 2px solid var(--asc-color-border);
	border-top-color: var(--asc-color-border-dark);
	border-radius: 50%;
	animation: asc-spin 0.7s linear infinite;
	pointer-events: none;
}

@keyframes asc-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ---- Sale badge styling ---- */
.onsale {
	position: absolute;
	background-color: white;
	top: 3px;
	right: 3px;
	color: var(--asc-color-primary) !important;
}
