/* ============================================================
   AuraBricks Theme — WooCommerce CSS
   Section : 03. Archive / Shop Page
   Source  : assets/css/woocommerce.css (lines 372–574)
   ============================================================ */

/* ============================================================
   03. Archive / Shop Page
   (Populated in Part 3 — woocommerce/archive-product.php)
   ============================================================ */

/* ── Shop / Archive Header ── */
body.woocommerce .abr-shop-header,
body.woocommerce-page .abr-shop-header {
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--abr-color-border, #e2e8f0);
}

body.woocommerce .abr-shop-header .aurabricks-breadcrumbs,
body.woocommerce-page .abr-shop-header .aurabricks-breadcrumbs {
	margin-bottom: 1rem;
}

body.woocommerce .abr-shop-header__title,
body.woocommerce-page .abr-shop-header__title {
	font-size: clamp(1.35rem, 3.5vw, 1.85rem);
	font-weight: 600;
	color: var(--abr-color-heading, #0f172a);
	line-height: 1.25;
	margin: 0 0 0.5rem 0;
	letter-spacing: -0.01em;
}

body.woocommerce .abr-shop-header .page-description,
body.woocommerce .abr-shop-header .term-description,
body.woocommerce-page .abr-shop-header .page-description,
body.woocommerce-page .abr-shop-header .term-description {
	color: var(--abr-color-text-muted, #64748b);
	font-size: 1rem;
	line-height: 1.65;
	max-width: 720px;
	margin: 0.5rem 0 0 0;
}

/* ── Shop Toolbar (Result Count & Ordering) ── */
body.woocommerce .abr-shop-toolbar,
body.woocommerce-page .abr-shop-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 16px;
	margin: 0 0 2rem 0;
	padding-bottom: 1.25rem;
	border-bottom: 1px solid var(--abr-color-border, #e2e8f0);
}

body.woocommerce .abr-shop-toolbar .woocommerce-result-count,
body.woocommerce-page .abr-shop-toolbar .woocommerce-result-count {
	margin: 0;
	float: none;
	font-size: 0.925rem;
	font-weight: 500;
	color: var(--abr-color-text-muted, #64748b);
}

body.woocommerce .abr-shop-toolbar .woocommerce-ordering,
body.woocommerce-page .abr-shop-toolbar .woocommerce-ordering {
	margin: 0;
	float: none;
	position: relative;
}

body.woocommerce .abr-shop-toolbar .woocommerce-ordering select,
body.woocommerce-page .abr-shop-toolbar .woocommerce-ordering select {
	appearance: none;
	-webkit-appearance: none;
	padding: 10px 38px 10px 16px;
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--abr-color-heading, #1e293b);
	background-color: var(--abr-color-surface, #ffffff);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 16px;
	border: 1px solid var(--abr-color-border, #cbd5e1);
	border-radius: var(--abr-woo-btn-radius, 8px);
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	transition: var(--abr-woo-transition);
	box-sizing: border-box;
}

body.woocommerce .abr-shop-toolbar .woocommerce-ordering select:hover,
body.woocommerce-page .abr-shop-toolbar .woocommerce-ordering select:hover {
	border-color: var(--abr-color-primary, #6366f1);
}

body.woocommerce .abr-shop-toolbar .woocommerce-ordering select:focus,
body.woocommerce-page .abr-shop-toolbar .woocommerce-ordering select:focus {
	outline: none;
	border-color: var(--abr-color-primary, #6366f1);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ── Pagination ── */
body.woocommerce nav.woocommerce-pagination,
body.woocommerce-page nav.woocommerce-pagination {
	display: flex;
	justify-content: center;
	margin: 3.5rem 0 2rem 0;
	padding: 0;
	text-align: center;
}

body.woocommerce nav.woocommerce-pagination ul,
body.woocommerce-page nav.woocommerce-pagination ul {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	border: none;
	white-space: nowrap;
}

body.woocommerce nav.woocommerce-pagination ul li,
body.woocommerce-page nav.woocommerce-pagination ul li {
	margin: 0;
	padding: 0;
	float: none;
	display: inline-block;
	border: none;
}

body.woocommerce nav.woocommerce-pagination ul li .page-numbers,
body.woocommerce-page nav.woocommerce-pagination ul li .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	height: 42px;
	padding: 0 14px;
	font-size: 0.925rem;
	font-weight: 600;
	color: var(--abr-color-heading, #1e293b);
	text-decoration: none;
	border: 1px solid var(--abr-color-border, #cbd5e1);
	border-radius: var(--abr-woo-btn-radius, 8px);
	background: var(--abr-color-surface, #ffffff);
	transition: var(--abr-woo-transition);
	box-sizing: border-box;
}

body.woocommerce nav.woocommerce-pagination ul li span.current,
body.woocommerce-page nav.woocommerce-pagination ul li span.current {
	background: var(--abr-color-primary, #6366f1);
	color: #ffffff;
	border-color: var(--abr-color-primary, #6366f1);
	box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

body.woocommerce nav.woocommerce-pagination ul li a.page-numbers:hover,
body.woocommerce-page nav.woocommerce-pagination ul li a.page-numbers:hover {
	border-color: var(--abr-color-primary, #6366f1);
	color: var(--abr-color-primary, #6366f1);
	background: var(--abr-color-surface-hover, #f8fafc);
	transform: translateY(-1px);
}

/* ── Mobile Responsive for Shop Toolbar ── */
@media (max-width: 640px) {
	body.woocommerce .abr-shop-toolbar,
	body.woocommerce-page .abr-shop-toolbar {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
	}

	body.woocommerce .abr-shop-toolbar .woocommerce-ordering,
	body.woocommerce-page .abr-shop-toolbar .woocommerce-ordering {
		width: 100%;
	}

	body.woocommerce .abr-shop-toolbar .woocommerce-ordering select,
	body.woocommerce-page .abr-shop-toolbar .woocommerce-ordering select {
		width: 100%;
	}

	body.woocommerce nav.woocommerce-pagination ul,
	body.woocommerce-page nav.woocommerce-pagination ul {
		gap: 6px;
		flex-wrap: wrap;
		justify-content: center;
	}

	body.woocommerce nav.woocommerce-pagination ul li .page-numbers,
	body.woocommerce-page nav.woocommerce-pagination ul li .page-numbers {
		min-width: 38px;
		height: 38px;
		padding: 0 10px;
		font-size: 0.875rem;
	}
}


/* ============================================================
   Shop Layout — Sidebar Integration
   Controls the two-column flex layout when the WooCommerce
   sidebar (woocommerce-sidebar) has active widgets.
   Layout class is set by aurabricks_woo_get_layout_class().
   ============================================================ */

/* ── Base Layout Container ── */
.abr-woo-layout {
	display: flex;
	align-items: flex-start;
	gap: var(--abr-woo-gap, 32px);
	width: 100%;
}

/* ── Full Width (no sidebar / empty sidebar) ── */
.abr-woo-layout--full .abr-woo-main {
	width: 100%;
	flex: 1 1 100%;
}

/* ── Sidebar Left (LTR default — sidebar at inline-start = LEFT) ── */
.abr-woo-layout--sidebar-left {
	flex-direction: row-reverse; /* sidebar is 2nd in DOM, row-reverse puts it on LEFT */
}

.abr-woo-layout--sidebar-left .abr-woo-main {
	flex: 1 1 0%;
	min-width: 0;
	overflow: hidden;
}

.abr-woo-layout--sidebar-left .abr-shop-sidebar {
	width: 280px;
	flex: 0 0 280px;
}

/* ── Sidebar Right (RTL default — sidebar at inline-start = RIGHT) ── */
.abr-woo-layout--sidebar-right .abr-woo-main {
	flex: 1 1 0%;
	min-width: 0;
	overflow: hidden;
}

.abr-woo-layout--sidebar-right .abr-shop-sidebar {
	width: 280px;
	flex: 0 0 280px;
}

/* ── Grid columns: 2 cols when sidebar is active ──────────────────────
   Must match the specificity of body.woocommerce ul.products in
   woo-grid.css to win the cascade.
   ──────────────────────────────────────────────────────────────────── */
body.woocommerce .abr-woo-layout--sidebar-left  ul.products,
body.woocommerce .abr-woo-layout--sidebar-right ul.products,
body.woocommerce-page .abr-woo-layout--sidebar-left  ul.products,
body.woocommerce-page .abr-woo-layout--sidebar-right ul.products {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ── Sidebar Widget Area ── */
.abr-shop-sidebar {
	position: sticky;
	top: calc(var(--abr-header-height, 80px) + 24px);
	/* Prevent sidebar from growing taller than viewport */
	max-height: calc(100vh - var(--abr-header-height, 80px) - 48px);
	overflow-y: auto;
	overflow-x: hidden;          /* ← يمنع الـ overflow الأفقي كالـ iframe */
	scrollbar-width: thin;
	scrollbar-color: var(--abr-color-border, #e2e8f0) transparent;
}

/* ── Widget Box ── */
.abr-shop-sidebar .widget {
	width: 100%;                 /* ← يأخذ عرض السايدبار فقط */
	box-sizing: border-box;      /* ← padding لا يزيد العرض */
	margin-bottom: 1.25rem;
	padding: 1.25rem;
	background: var(--abr-color-surface, #ffffff);
	border: 1px solid var(--abr-color-border, #e2e8f0);
	border-radius: var(--abr-woo-card-radius, 12px);
	/* overflow: visible — لا نضع overflow: hidden هنا
	   لأن بعض الـ widgets تتمدد عبر JS (فلاتر قابلة للطي)
	   والـ overflow يقطع المحتوى الـ expanded */
	overflow: visible;
	word-break: break-word;
}

.abr-shop-sidebar .widget:last-child {
	margin-bottom: 0;
}

/* ── كل العناصر الداخلية ترث العرض ── */
.abr-shop-sidebar .widget *,
.abr-shop-sidebar .widget *::before,
.abr-shop-sidebar .widget *::after {
	box-sizing: border-box;
	max-width: 100%;             /* ← أي عنصر لا يتجاوز عرض الـ widget */
}

/* ── صور وميديا ── */
.abr-shop-sidebar .widget img,
.abr-shop-sidebar .widget video,
.abr-shop-sidebar .widget iframe,
.abr-shop-sidebar .widget embed,
.abr-shop-sidebar .widget object {
	width: 100%;
	height: auto;
	display: block;
}

/* ── Forms & Inputs ── */
.abr-shop-sidebar .widget input,
.abr-shop-sidebar .widget select,
.abr-shop-sidebar .widget textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

/* ── Tables ── */
.abr-shop-sidebar .widget table {
	width: 100%;
	table-layout: fixed;         /* ← يمنع الجدول من اتساع الـ widget */
}

/* Widget Title */
.abr-shop-sidebar .abr-widget-title,
.abr-shop-sidebar .widget-title {
	font-size: 0.875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--abr-color-heading, #0f172a);
	margin: 0 0 1rem;
	padding-bottom: 0.625rem;
	border-bottom: 2px solid var(--abr-color-primary, #6366f1);
	white-space: normal;         /* ← يسمح بالـ wrap */
}

/* Widget Links */
.abr-shop-sidebar .widget a {
	color: var(--abr-color-text, #334155);
	text-decoration: none;
	transition: color 0.2s ease;
	word-break: break-word;      /* ← لينكات طويلة لا تكسر اللايوت */
}

.abr-shop-sidebar .widget a:hover {
	color: var(--abr-color-primary, #6366f1);
}

/* WooCommerce widget list reset */
.abr-shop-sidebar .widget ul {
	margin: 0;
	padding: 0;
	list-style: none;
	width: 100%;
}

.abr-shop-sidebar .widget ul li {
	padding: 0.35rem 0;
	font-size: 0.9rem;
	color: var(--abr-color-text, #334155);
	border-bottom: 1px solid var(--abr-color-border, #f1f5f9);
	width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;         /* ← يقطع النص الطويل */
}

.abr-shop-sidebar .widget ul li:hover {
	white-space: normal;         /* ← يظهر النص كاملاً عند hover */
	text-overflow: unset;
}

.abr-shop-sidebar .widget ul li:last-child {
	border-bottom: none;
}

/* ── WooCommerce Price Filter Widget ── */
.abr-shop-sidebar .widget_price_filter .price_slider_wrapper {
	width: 100%;
	box-sizing: border-box;
}

.abr-shop-sidebar .widget_price_filter .price_slider {
	width: 100% !important;      /* WooCommerce يضع width inline */
	margin-bottom: 1rem;
}

/* ── Responsive: Tablet (≤ 1024px) — Narrower sidebar —─ */
@media (max-width: 1024px) {
	.abr-woo-layout--sidebar-right .abr-shop-sidebar,
	.abr-woo-layout--sidebar-left  .abr-shop-sidebar {
		width: 220px;
		flex: 0 0 220px;
		/* Max-height أصغر على التابلت */
		max-height: calc(100vh - 60px);
	}
}

/* ── Responsive: Mobile (≤ 768px) — Stack vertically ── */
@media (max-width: 768px) {
	/* إعادة ترتيب flex للـ stack العمودي */
	.abr-woo-layout,
	.abr-woo-layout--sidebar-right,
	.abr-woo-layout--sidebar-left {
		flex-direction: column;
	}

	/* السايدبار يأخذ العرض الكامل ويحل sticky */
	.abr-woo-layout--sidebar-right .abr-shop-sidebar,
	.abr-woo-layout--sidebar-left  .abr-shop-sidebar {
		width: 100%;
		flex: 0 0 auto;
		max-height: none;        /* ← إزالة max-height على موبايل */
		overflow: visible;       /* ← المحتوى يظهر كاملاً بما فيه الـ expanding */
		overflow-x: visible;     /* ← تحديداً الأفقي أيضاً على الموبايل */
		position: static;        /* ← إلغاء sticky */
	}

	/* المنتجات تأخذ العرض الكامل */
	.abr-woo-layout--sidebar-right .abr-woo-main,
	.abr-woo-layout--sidebar-left  .abr-woo-main {
		width: 100%;
	}

	/* على موبايل نرجع لـ 2 columns في الجريد */
	body.woocommerce .abr-woo-layout--sidebar-left  ul.products,
	body.woocommerce .abr-woo-layout--sidebar-right ul.products,
	body.woocommerce-page .abr-woo-layout--sidebar-left  ul.products,
	body.woocommerce-page .abr-woo-layout--sidebar-right ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

