/* Pro Mini Cart for Elementor */

.pmce,
.pmce *,
.pmce *::before,
.pmce *::after {
	box-sizing: border-box;
}

.pmce {
	position: relative;
	--pmce-brand: #009B5D;       /* رنگ سازمانی */
	--pmce-brand-dark: #00844F;  /* حالت هاور */
	--pmce-brand-soft: #E6F5EE;  /* پس‌زمینه ملایم */
	--pmce-text: #1c1c1c;        /* رنگ متن (خنثی، بدون تمایل به آبی) */
}

/* مرورگرهای جدید: سایه‌های روشن‌تر و تیره‌تر از روی همان رنگ سازمانی ساخته می‌شوند،
   پس با تغییر رنگ در تنظیمات المنتور، هاور و پس‌زمینه ملایم هم خودکار عوض می‌شوند. */
@supports (color: color-mix(in srgb, red 50%, blue)) {
	.pmce {
		--pmce-brand-dark: color-mix(in srgb, var(--pmce-brand) 86%, #000);
		--pmce-brand-soft: color-mix(in srgb, var(--pmce-brand) 10%, #fff);
	}
}

/* لنگر دکمه و منوی باز شونده؛ عرضش به اندازه خود دکمه است تا منو دقیقاً زیر آن باز شود */
.pmce-anchor {
	position: relative;
	display: inline-block;
	vertical-align: middle;
}

html.pmce-lock {
	overflow: hidden;
}

/* ---------- Toggle button ---------- */
.pmce .pmce-toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	margin: 0;
	padding: 0.7em 1.1em;
	border: 1px solid transparent;
	border-radius: 999px;
	background-color: var(--pmce-brand);
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.pmce .pmce-toggle:hover {
	background-color: var(--pmce-brand-dark);
	color: #fff;
}

.pmce .pmce-toggle:active {
	transform: scale(0.97);
}

.pmce-toggle__icon {
	position: relative; /* نشان تعداد نسبت به آیکن شناور می‌شود */
	display: inline-flex;
	font-size: 20px;
	line-height: 1;
}

.pmce-toggle__icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* ---------- Badge (floating) ---------- */
.pmce-count {
	position: absolute;
	top: -8px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 999px;
	background-color: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	pointer-events: none;
}

.pmce--badge-right .pmce-count {
	right: -10px;
}

.pmce--badge-left .pmce-count {
	left: -10px;
}

.pmce:not(.pmce--show-zero).is-empty .pmce-count {
	display: none;
}

.pmce-count.pmce-bump {
	animation: pmce-bump 0.35s ease;
}

@keyframes pmce-bump {
	0%   { transform: scale(1); }
	40%  { transform: scale(1.35); }
	100% { transform: scale(1); }
}

/* تا زمانی که جاوااسکریپت صحت سبد را بررسی نکرده (کش صفحه!)، عدد و جمع کل نمایش داده نمی‌شود.
   اگر جاوااسکریپت اجرا نشد، بعد از ۲ ثانیه خودکار نمایش داده می‌شوند. */
.pmce:not(.is-ready) .pmce-count,
.pmce:not(.is-ready) .pmce-toggle__total {
	opacity: 0;
	animation: pmce-reveal 0s linear 2s forwards;
}

@keyframes pmce-reveal {
	to { opacity: 1; }
}

/* ---------- Overlay (drawer mode only) ---------- */
.pmce-overlay {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background-color: rgba(15, 23, 42, 0.5);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.pmce.is-open .pmce-overlay {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.3s ease;
}

.pmce--editor .pmce-overlay {
	display: none;
}

/* ---------- Panel (default: side drawer) ---------- */
.pmce-panel {
	position: fixed;
	top: 0;
	bottom: 0;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	width: min(420px, 92vw);
	max-width: 100vw;
	background-color: #fff;
	color: var(--pmce-text);
	text-align: start;
	box-shadow: 0 0 40px rgba(15, 23, 42, 0.18);
	visibility: hidden;
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.35s;
}

.pmce--pos-right .pmce-panel {
	right: 0;
	transform: translateX(100%);
}

.pmce--pos-left .pmce-panel {
	left: 0;
	transform: translateX(-100%);
}

.pmce.is-open .pmce-panel {
	transform: none;
	visibility: visible;
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Header ---------- */
.pmce-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 20px 24px;
	border-bottom: 1px solid #eef0f3;
}

.pmce-title {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.4;
}

.pmce .pmce-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: #f3f4f6;
	color: inherit;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}

.pmce .pmce-close:hover {
	background-color: var(--pmce-brand);
	color: #fff;
}

/* ---------- Notice ---------- */
.pmce-notice {
	padding: 10px 24px;
	background-color: #fef3c7;
	color: #92400e;
	font-size: 13px;
	line-height: 1.6;
}

.pmce-notice[hidden] {
	display: none;
}

/* ---------- Body / items ---------- */
.pmce-body {
	flex: 1;
	overflow-y: auto;
	padding: 4px 24px;
	overscroll-behavior: contain;
}

.pmce-items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.pmce-item {
	position: relative;
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr);
	grid-template-areas:
		"thumb details"
		"qty total";
	column-gap: 14px;
	row-gap: 10px;
	align-items: start;
	margin: 0;
	padding: 16px 0;
	border-bottom: 1px solid #eef0f3;
	transition: opacity 0.2s;
}

.pmce-item:last-child {
	border-bottom: 0;
}

.pmce-item.is-loading {
	opacity: 0.5;
	pointer-events: none;
}

.pmce-item__thumb {
	grid-area: thumb;
	width: 96px;
	height: 96px;
	overflow: hidden;
	border-radius: 12px;
	background-color: #f3f4f6;
}

.pmce-item__thumb a {
	display: block;
	width: 100%;
	height: 100%;
}

.pmce-item__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.pmce-item__details {
	grid-area: details;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.pmce-item__name {
	padding-inline-end: 32px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.7;
}

.pmce-item__name a {
	color: inherit;
	text-decoration: none;
}

.pmce-item .variation {
	margin: 0;
	color: #6b7280;
	font-size: 12px;
	line-height: 1.6;
}

.pmce-item .variation dt,
.pmce-item .variation dd {
	display: inline;
	margin: 0;
}

.pmce-item .variation dd {
	margin-inline-start: 0.4em;
}

.pmce-item .variation dd p {
	display: inline;
	margin: 0;
}

.pmce-item .variation dd::after {
	content: "\A";
	white-space: pre;
}

.pmce-item__total {
	grid-area: total;
	align-self: center;
	justify-self: end;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.4;
}

/* ---------- Quantity: مستطیل با حاشیه و انحنا، منفی چپ / مثبت راست ---------- */
.pmce-qty {
	grid-area: qty;
	display: flex;
	align-items: stretch;
	justify-content: space-between;
	width: 100%;
	direction: ltr; /* همیشه: منفی سمت چپ، مثبت سمت راست */
	padding: 2px;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	background-color: #fff;
}

.pmce .pmce-qty__btn {
	position: relative;
	display: block;
	flex: 0 0 28px;
	width: 28px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: inherit;
	background-color: transparent;
	color: var(--pmce-brand);
	font-size: 0;
	line-height: 0;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s, opacity 0.2s;
}

/* علامت + و − با دو خط CSS رسم می‌شود تا دقیقاً وسط دکمه قرار بگیرد */
.pmce .pmce-qty__btn::before,
.pmce .pmce-qty__btn::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	border-radius: 2px;
	background-color: currentColor;
	transform: translate(-50%, -50%);
}

.pmce .pmce-qty__btn::before {
	width: 12px;
	height: 2px;
}

.pmce .pmce-qty__btn--plus::after {
	width: 2px;
	height: 12px;
}

.pmce .pmce-qty__btn--minus::after {
	display: none;
}

.pmce .pmce-qty__btn:hover:not(:disabled) {
	background-color: var(--pmce-brand-soft);
}

.pmce .pmce-qty__btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

/* در تعداد ۱، دکمه منفی به سطل آشغال تبدیل می‌شود */
.pmce .pmce-qty__btn .pmce-trash {
	position: absolute;
	top: 50%;
	left: 50%;
	display: none;
	width: 18px;
	height: 18px;
	transform: translate(-50%, -50%);
}

.pmce .pmce-qty__btn.is-trash {
	color: #6b7280;
}

.pmce .pmce-qty__btn.is-trash::before {
	display: none;
}

.pmce .pmce-qty__btn.is-trash .pmce-trash {
	display: block;
}

.pmce .pmce-qty__btn.is-trash:hover,
.pmce .pmce-qty__btn.is-trash:focus-visible {
	background-color: #fee2e2;
	color: #dc2626;
}

/* محصولی که فقط یک عدد قابل سفارش است: فقط دکمه سطل */
.pmce .pmce-qty--single {
	width: auto;
	justify-self: start;
	justify-content: center;
}

/* فیلد عدد: با !important در مواردی که قالب‌ها استایل input را خراب می‌کنند (پدینگ، ارتفاع، رنگ پس‌زمینه) */
.pmce .pmce-qty input.pmce-qty__input {
	flex: 1 1 auto;
	width: 100% !important;
	min-width: 0 !important;
	height: 32px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	outline: 0;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--pmce-text);
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 32px;
	letter-spacing: 0;
	text-align: center;
	text-indent: 0;
	text-transform: none;
	opacity: 1 !important;
	-webkit-text-fill-color: currentColor !important;
	-moz-appearance: textfield;
	appearance: textfield;
}

.pmce .pmce-qty input.pmce-qty__input:focus {
	outline: 0;
	box-shadow: none !important;
}

.pmce .pmce-qty:focus-within {
	border-color: var(--pmce-brand);
}

/* ---------- Empty state ---------- */
.pmce-empty {
	display: none;
	padding: 40px 16px;
	color: #6b7280;
	text-align: center;
}

.pmce.is-empty .pmce-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
}

.pmce-empty__visual {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--pmce-empty-size, 120px);
	max-width: 100%;
	color: var(--pmce-brand);
	line-height: 1;
}

.pmce-empty__visual svg {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
}

.pmce-empty__visual i {
	font-size: calc(var(--pmce-empty-size, 120px) * 0.7);
}

.pmce-empty__img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	object-fit: contain;
}

/* رنگ‌های سبد آماده از رنگ سازمانی ویجت می‌آیند */
.pmce-ev-bg {
	fill: var(--pmce-brand-soft);
}

.pmce-ev-line {
	stroke: var(--pmce-brand);
}

.pmce-ev-fill {
	fill: var(--pmce-brand);
}

.pmce-ev-soft {
	opacity: 0.4;
}

.pmce-empty__text {
	margin: 0;
	font-size: 15px;
	line-height: 1.9;
}

.pmce.is-empty .pmce-items,
.pmce.is-empty .pmce-footer {
	display: none;
}

/* ---------- Footer ---------- */
.pmce-footer {
	display: grid;
	gap: 12px;
	padding: 20px 24px;
	border-top: 1px solid #eef0f3;
}

.pmce-subtotal {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	background-color: #f3f4f6;
	font-size: 15px;
}

.pmce-subtotal > span {
	color: #4b5563;
	font-weight: 500;
}

.pmce-subtotal strong {
	font-weight: 700;
}

.pmce-btn {
	display: block;
	padding: 14px 18px;
	border: 1px solid transparent;
	border-radius: 12px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.pmce-btn--checkout {
	background-color: var(--pmce-brand);
	color: #fff;
}

.pmce-btn--checkout:hover {
	background-color: var(--pmce-brand-dark);
	color: #fff;
}

.pmce-btn--cart {
	border-color: var(--pmce-brand);
	background-color: #fff;
	color: var(--pmce-brand);
}

.pmce-btn--cart:hover {
	background-color: var(--pmce-brand-soft);
	color: var(--pmce-brand-dark);
}

/* دکمه سبد خالی (مشاهده محصولات): باریک و وسط‌چین؛ رنگ‌ها از دکمه «ثبت سفارش» می‌آیند */
.pmce-btn--shop {
	display: inline-block;
	min-width: 200px;
	padding: 12px 28px;
}

/* ---------- Focus ---------- */
.pmce button:focus-visible,
.pmce a:focus-visible {
	outline: 2px solid var(--pmce-brand);
	outline-offset: 2px;
}

/* ======================================================================
 * Desktop (>= 1025px): منوی باز شونده زیر دکمه
 * موقعیت (top/left) را جاوااسکریپت از روی مکان دکمه حساب می‌کند؛ position: fixed باعث می‌شود
 * اگر هدر یا ستون overflow: hidden داشت، منو بریده نشود.
 * ==================================================================== */
@media (min-width: 1025px) {

	.pmce--desktop-dropdown .pmce-overlay,
	.pmce--desktop-dropdown .pmce-close {
		display: none;
	}

	.pmce--desktop-dropdown .pmce-panel {
		position: fixed;
		top: 0;
		bottom: auto;
		left: 0;
		right: auto;
		width: 400px;
		max-width: calc(100vw - 24px);
		border: 1px solid #eef0f3;
		border-radius: 14px;
		box-shadow: 0 14px 44px rgba(15, 23, 42, 0.16);
		opacity: 0;
		visibility: hidden;
		transform: translateY(8px);
		transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
	}

	/* پل نامرئی بین دکمه و منو تا با حرکت ماوس منو نبندد */
	.pmce--desktop-dropdown .pmce-panel::before {
		content: "";
		position: absolute;
		top: -14px;
		right: 0;
		left: 0;
		height: 14px;
	}

	.pmce--desktop-dropdown.is-open .pmce-panel {
		opacity: 1;
		visibility: visible;
		transform: none;
		transition: opacity 0.2s ease, transform 0.2s ease;
	}

	.pmce--desktop-dropdown .pmce-header {
		padding: 16px 20px;
	}

	.pmce--desktop-dropdown .pmce-body {
		flex: 0 1 auto;
		max-height: min(380px, calc(100vh - 330px));
		padding: 0 20px;
	}

	.pmce--desktop-dropdown .pmce-footer {
		padding: 16px 20px;
	}
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.pmce-panel,
	.pmce-overlay,
	.pmce-toggle,
	.pmce-count {
		transition: none;
		animation: none;
	}
}
