/**
 * MedLab WooCommerce shop archive — professional product cards (RTL)
 */

.medlab-wc-shop-archive {
	--medlab-shop-bg: #f4f5f7;
	--medlab-shop-card: #ffffff;
	--medlab-shop-text: #1a1a1a;
	--medlab-shop-muted: #6b7280;
	--medlab-shop-border: #e5e7eb;
	--medlab-shop-accent: #e11d48;
	--medlab-shop-accent-hover: #be123c;
	--medlab-shop-accent-soft: #fff1f2;
	--medlab-shop-teal: #0d9488;
	--medlab-shop-teal-hover: #0f766e;
	--medlab-shop-radius: 18px;
	--medlab-shop-radius-sm: 12px;
	--medlab-shop-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
	--medlab-shop-shadow-hover: 0 12px 36px rgba(15, 23, 42, 0.12);
}

.medlab-wc-shop-archive.woocommerce,
.medlab-wc-shop-archive .site-main,
.medlab-wc-shop-archive #primary,
.medlab-wc-shop-archive .site-content {
	background: var(--medlab-shop-bg) !important;
}

.medlab-wc-shop-shell {
	direction: rtl;
	padding: 16px 16px 48px;
	box-sizing: border-box;
	font-family: inherit;
}

.medlab-wc-shop-inner {
	max-width: 1320px;
	margin: 0 auto;
}

/* Breadcrumb */
.medlab-wc-shop-archive .woocommerce-breadcrumb {
	margin: 0 0 20px;
	padding: 0;
	background: transparent;
	border: none;
	font-size: 13px;
	color: var(--medlab-shop-muted);
}

.medlab-wc-shop-archive .woocommerce-breadcrumb a {
	color: var(--medlab-shop-text);
	text-decoration: none;
}

/* Intro */
.medlab-shop-intro {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 0 0 20px;
	padding: 22px 24px;
	background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
	border: 1px solid var(--medlab-shop-border);
	border-radius: var(--medlab-shop-radius);
	box-shadow: var(--medlab-shop-shadow);
}

.medlab-shop-intro__title {
	margin: 0 0 6px;
	font-size: clamp(1.35rem, 3vw, 1.75rem);
	font-weight: 700;
	color: var(--medlab-shop-text);
	line-height: 1.3;
}

.medlab-shop-intro__desc {
	margin: 0;
	font-size: 14px;
	color: var(--medlab-shop-muted);
	line-height: 1.6;
}

/* Toolbar: advanced search + result count + ordering */
.medlab-shop-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px 20px;
	margin: 0 0 16px;
	padding: 14px 18px;
	background: var(--medlab-shop-card);
	border: 1px solid var(--medlab-shop-border);
	border-radius: var(--medlab-shop-radius);
	box-shadow: var(--medlab-shop-shadow);
}

.medlab-shop-toolbar .medlab-shop-advanced-toggle {
	flex-shrink: 0;
}

.medlab-shop-toolbar .woocommerce-result-count {
	flex: 1;
	min-width: 140px;
	margin: 0;
	font-size: 13px;
	color: var(--medlab-shop-muted);
	text-align: center;
}

.medlab-shop-toolbar .woocommerce-ordering {
	margin: 0;
	margin-inline-start: auto;
	flex-shrink: 0;
}

.medlab-shop-toolbar .woocommerce-ordering select {
	border: 1px solid var(--medlab-shop-border);
	border-radius: 10px;
	padding: 8px 12px;
	font-size: 13px;
	background: #fff;
	color: var(--medlab-shop-text);
	min-height: 40px;
}

/* Products container */
.medlab-shop-products {
	margin: 0 0 32px;
	padding: 20px;
	background: var(--medlab-shop-card);
	border: 1px solid var(--medlab-shop-border);
	border-radius: var(--medlab-shop-radius);
	box-shadow: var(--medlab-shop-shadow);
	box-sizing: border-box;
}

.medlab-shop-products .medlab-shop-layout {
	margin: 0;
}

.medlab-shop-advanced-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border: 1px solid var(--medlab-shop-border);
	border-radius: 12px;
	background: #fff;
	color: var(--medlab-shop-text);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.medlab-shop-advanced-toggle:hover,
.medlab-shop-advanced-toggle[aria-expanded="true"] {
	border-color: var(--medlab-shop-teal);
	color: var(--medlab-shop-teal);
	box-shadow: 0 4px 16px rgba(13, 148, 136, 0.15);
}

.medlab-shop-advanced-toggle__icon {
	flex-shrink: 0;
}

/* Layout: filter panel (right in RTL) + products */
.medlab-shop-layout {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: 0;
	position: relative;
}

.medlab-shop-layout__main {
	flex: 1;
	min-width: 0;
	position: relative;
}

.medlab-shop-layout__main.is-loading {
	opacity: 0.55;
	pointer-events: none;
}

.medlab-shop-layout__main.is-loading::after {
	content: '';
	position: absolute;
	top: 48px;
	left: 50%;
	width: 36px;
	height: 36px;
	margin-left: -18px;
	border: 3px solid #e2e8f0;
	border-top-color: var(--medlab-shop-teal);
	border-radius: 50%;
	animation: medlab-shop-spin 0.7s linear infinite;
}

@keyframes medlab-shop-spin {
	to {
		transform: rotate(360deg);
	}
}

.medlab-shop-advanced-backdrop {
	display: none;
}

.medlab-shop-advanced-panel {
	flex: 0 0 0;
	width: 0;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transition: flex-basis 0.28s ease, width 0.28s ease, opacity 0.22s ease, visibility 0.22s ease;
	background: var(--medlab-shop-card);
	border: 1px solid transparent;
	border-radius: var(--medlab-shop-radius);
	box-sizing: border-box;
}

.medlab-shop-layout--filter-open .medlab-shop-advanced-panel {
	flex: 0 0 280px;
	width: 280px;
	opacity: 1;
	visibility: visible;
	border-color: var(--medlab-shop-border);
	box-shadow: var(--medlab-shop-shadow);
	margin-inline-start: 16px;
	overflow: auto;
	max-height: calc(100vh - 120px);
	position: sticky;
	top: 24px;
}

.medlab-shop-advanced-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 16px 16px 12px;
	border-bottom: 1px solid var(--medlab-shop-border);
}

.medlab-shop-advanced-panel__title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: var(--medlab-shop-text);
}

.medlab-shop-advanced-panel__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 8px;
	background: #f1f5f9;
	color: var(--medlab-shop-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.medlab-shop-advanced-panel__close:hover {
	background: #e2e8f0;
	color: var(--medlab-shop-text);
}

.medlab-shop-filter-groups {
	padding: 8px 12px 12px;
}

.medlab-shop-filter-group {
	border: 1px solid var(--medlab-shop-border);
	border-radius: 12px;
	overflow: hidden;
	background: #fafbfc;
}

.medlab-shop-filter-group + .medlab-shop-filter-group {
	margin-top: 10px;
}

.medlab-shop-filter-group__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 12px 14px;
	border: none;
	background: transparent;
	color: var(--medlab-shop-text);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-align: right;
}

.medlab-shop-filter-group__chevron {
	flex-shrink: 0;
	transition: transform 0.2s ease;
}

.medlab-shop-filter-group.is-open .medlab-shop-filter-group__chevron {
	transform: rotate(180deg);
}

.medlab-shop-filter-group__body {
	padding: 0 10px 10px;
}

.medlab-shop-filter-empty {
	margin: 0;
	padding: 8px 6px;
	font-size: 13px;
	color: var(--medlab-shop-muted);
}

.medlab-shop-cat-tree {
	list-style: none;
	margin: 0;
	padding: 0;
}

.medlab-shop-cat-tree__item {
	margin: 0;
}

.medlab-shop-cat-tree__row {
	display: flex;
	align-items: center;
	gap: 6px;
	min-height: 38px;
}

.medlab-shop-cat-tree__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: none;
	border-radius: 8px;
	background: #eef2f7;
	color: var(--medlab-shop-muted);
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s ease, transform 0.2s ease;
}

.medlab-shop-cat-tree__item.is-open > .medlab-shop-cat-tree__row .medlab-shop-cat-tree__toggle {
	transform: rotate(90deg);
}

.medlab-shop-cat-tree__bullet {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.medlab-shop-cat-tree__bullet::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #cbd5e1;
}

.medlab-shop-cat-tree__link {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 8px;
	border-radius: 8px;
	color: var(--medlab-shop-text);
	text-decoration: none;
	font-size: 13px;
	line-height: 1.5;
	transition: background 0.15s ease, color 0.15s ease;
}

.medlab-shop-cat-tree__link:hover,
.medlab-shop-cat-tree__item.is-active > .medlab-shop-cat-tree__row .medlab-shop-cat-tree__link {
	background: var(--medlab-shop-accent-soft);
	color: var(--medlab-shop-accent);
}

.medlab-shop-cat-tree__count {
	font-size: 11px;
	color: var(--medlab-shop-muted);
	background: #fff;
	border: 1px solid var(--medlab-shop-border);
	border-radius: 999px;
	padding: 2px 8px;
	flex-shrink: 0;
}

.medlab-shop-cat-tree__sub {
	list-style: none;
	margin: 0;
	padding: 0 0 4px 22px;
}

.medlab-shop-advanced-panel__foot {
	padding: 12px 16px 16px;
	border-top: 1px solid var(--medlab-shop-border);
}

.medlab-shop-advanced-panel__reset {
	display: block;
	text-align: center;
	padding: 10px 12px;
	border-radius: 10px;
	background: #f8fafc;
	color: var(--medlab-shop-teal);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

.medlab-shop-advanced-panel__reset:hover {
	background: #ecfdf5;
}

body.medlab-shop-filter-open {
	overflow: hidden;
}

@media (max-width: 900px) {
	.medlab-shop-layout--filter-open .medlab-shop-advanced-panel {
		position: fixed;
		top: 0;
		right: 0;
		left: auto;
		width: min(320px, 92vw);
		flex: none;
		height: 100vh;
		max-height: none;
		margin: 0;
		z-index: 100001;
		border-radius: 0;
	}

	.medlab-shop-layout--filter-open .medlab-shop-advanced-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(15, 23, 42, 0.45);
		z-index: 100000;
	}

	body.medlab-shop-filter-open {
		overflow: hidden;
	}

	.medlab-shop-layout--filter-open .medlab-shop-layout__main {
		width: 100%;
	}
}

/* Product grid */
.medlab-wc-shop-archive ul.products {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
	margin: 0 !important;
	padding: 0;
	list-style: none;
}

.medlab-wc-shop-archive ul.products::before,
.medlab-wc-shop-archive ul.products::after {
	display: none !important;
}

.medlab-wc-shop-archive ul.products li.medlab-shop-card {
	width: 100% !important;
	margin: 0 !important;
	padding: 0;
	float: none !important;
	clear: none !important;
}

/* Filter open: fewer columns so card size stays consistent */
.medlab-shop-layout--filter-open .medlab-shop-layout__main ul.products {
	grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

/* Card */
.medlab-shop-card__inner {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--medlab-shop-card);
	border: 1px solid var(--medlab-shop-border);
	border-radius: var(--medlab-shop-radius);
	box-shadow: var(--medlab-shop-shadow);
	overflow: hidden;
	transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.medlab-shop-card:hover .medlab-shop-card__inner {
	transform: translateY(-4px);
	box-shadow: var(--medlab-shop-shadow-hover);
	border-color: #d1d5db;
}

/* Media */
.medlab-shop-card__media {
	position: relative;
	background: linear-gradient(180deg, #fafbfc 0%, #f3f4f6 100%);
}

.medlab-shop-card__media-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.medlab-shop-card__thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
	padding: 20px;
	overflow: hidden;
}

.medlab-shop-card__thumb img {
	width: auto !important;
	height: auto !important;
	max-width: 88%;
	max-height: 88%;
	object-fit: contain;
	transition: transform 0.35s ease;
}

.medlab-shop-card:hover .medlab-shop-card__thumb img {
	transform: scale(1.06);
}

/* Sale badge */
.medlab-shop-card .onsale {
	position: absolute;
	top: 12px;
	right: 12px;
	left: auto;
	z-index: 2;
	margin: 0;
	min-width: auto;
	min-height: auto;
	padding: 5px 10px;
	border-radius: 999px;
	background: var(--medlab-shop-accent) !important;
	color: #fff !important;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.3;
	box-shadow: 0 2px 8px rgba(225, 29, 72, 0.35);
}

/* Body */
.medlab-shop-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 8px;
	padding: 16px 16px 18px;
}

.medlab-shop-card__rating {
	min-height: 18px;
}

.medlab-shop-card__rating .star-rating {
	float: none;
	margin: 0;
	font-size: 12px;
	color: #f59e0b;
}

.medlab-shop-card__title {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.55;
	min-height: 2.95em;
}

.medlab-shop-card__title a {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: var(--medlab-shop-text);
	text-decoration: none;
	transition: color 0.15s ease;
}

.medlab-shop-card__title a:hover {
	color: var(--medlab-shop-accent);
}

.medlab-shop-card__price {
	margin-top: auto;
	padding-top: 4px;
	font-size: 15px;
	font-weight: 700;
	color: var(--medlab-shop-text);
}

.medlab-shop-card__price del {
	opacity: 0.55;
	font-size: 12px;
	font-weight: 500;
	margin-left: 6px;
}

.medlab-shop-card__price ins {
	text-decoration: none;
	color: var(--medlab-shop-accent);
}

.medlab-shop-card__footer {
	padding-top: 10px;
}

.medlab-shop-card__btn,
.medlab-shop-card__footer .button,
.medlab-shop-card__footer a.button {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 42px;
	padding: 10px 14px !important;
	border: none !important;
	border-radius: 11px !important;
	background: var(--medlab-shop-teal) !important;
	color: #fff !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	text-align: center;
	text-decoration: none;
	box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
	transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.medlab-shop-card__btn:hover,
.medlab-shop-card__footer .button:hover,
.medlab-shop-card__footer a.button:hover {
	background: var(--medlab-shop-teal-hover) !important;
	color: #fff !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 14px rgba(13, 148, 136, 0.32);
}

.medlab-shop-card__footer .added_to_cart {
	display: block;
	margin-top: 8px;
	font-size: 12px;
	text-align: center;
	color: var(--medlab-shop-teal);
	text-decoration: none;
}

/* Pagination */
.medlab-wc-shop-archive nav.woocommerce-pagination {
	margin-top: 8px;
}

.medlab-wc-shop-archive nav.woocommerce-pagination ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	border: none;
}

.medlab-wc-shop-archive nav.woocommerce-pagination ul li {
	border: none;
}

.medlab-wc-shop-archive nav.woocommerce-pagination ul li a,
.medlab-wc-shop-archive nav.woocommerce-pagination ul li span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	min-height: 40px;
	padding: 0 12px;
	border: 1px solid var(--medlab-shop-border) !important;
	border-radius: 10px;
	background: #fff;
	color: var(--medlab-shop-text);
	font-size: 14px;
	text-decoration: none;
}

.medlab-wc-shop-archive nav.woocommerce-pagination ul li span.current {
	background: var(--medlab-shop-teal);
	border-color: var(--medlab-shop-teal) !important;
	color: #fff;
}

/* Notices */
.medlab-wc-shop-archive .woocommerce-notices-wrapper {
	margin-bottom: 16px;
}

/* Elementor Products widget compatibility */
.medlab-wc-shop-archive .elementor-widget-woocommerce-products ul.products,
.elementor-widget-woocommerce-products ul.products {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
}

/* Responsive */
@media (max-width: 1200px) {
	.medlab-wc-shop-archive ul.products,
	.medlab-wc-shop-archive .elementor-widget-woocommerce-products ul.products,
	.elementor-widget-woocommerce-products ul.products {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.medlab-shop-layout--filter-open .medlab-shop-layout__main ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 900px) {
	.medlab-wc-shop-archive ul.products,
	.medlab-wc-shop-archive .elementor-widget-woocommerce-products ul.products,
	.elementor-widget-woocommerce-products ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 14px;
	}

	.medlab-shop-intro {
		padding: 18px 16px;
	}

	.medlab-shop-toolbar {
		flex-direction: column;
		align-items: stretch;
		padding: 14px 16px;
	}

	.medlab-shop-toolbar .woocommerce-result-count {
		text-align: right;
	}

	.medlab-shop-toolbar .woocommerce-ordering {
		margin-inline-start: 0;
		width: 100%;
	}

	.medlab-shop-toolbar .woocommerce-ordering select {
		width: 100%;
	}

	.medlab-shop-products {
		padding: 14px;
	}
}

@media (max-width: 520px) {
	.medlab-wc-shop-shell {
		padding: 12px 10px 36px;
	}

	.medlab-wc-shop-archive ul.products,
	.medlab-wc-shop-archive .elementor-widget-woocommerce-products ul.products,
	.elementor-widget-woocommerce-products ul.products {
		grid-template-columns: 1fr;
	}

	.medlab-shop-card__thumb {
		padding: 16px;
	}
}
