/* سبد خرید سایت (همراه assets/js/cart.js و inc/cart.php):
   اعلان افزودن به سبد، و منوی کشویی آیکون سبد در هدر. */

/* ---------- اعلان «دوره به سبد خرید افزوده شد.» ---------- */

.nh-cart-toast {
	position: fixed;
	/* --nh-toast-top: پایین هدر یا نوار مدیریت اگر دیده می‌شوند (اسکریپت هنگام نمایش می‌سنجد) */
	top: calc(var(--nh-toast-top, 0px) + 10px + env(safe-area-inset-top, 0px));
	right: 8px;
	z-index: 100000;
	width: calc(100% - 16px);
	max-width: 440px;
	overflow: hidden;
	border-radius: 10px;
	background: #0098da;
	color: #fff;
	box-shadow: 0 8px 24px rgba(0, 60, 90, .25);
	opacity: 0;
	transform: translateY(-12px);
	transition: opacity .2s ease, transform .2s ease;
}

.nh-cart-toast[hidden] {
	display: none;
}

.nh-cart-toast.is-open {
	opacity: 1;
	transform: none;
}

/* افزودن دورهٔ دیگر وقتی اعلان هنوز باز است: یک تکان و برق کوچک تا معلوم باشد
   این اعلان تازه است و همان قبلی نیست */
.nh-cart-toast.is-bump {
	animation: nh-cart-toast-bump .5s ease;
}

@keyframes nh-cart-toast-bump {
	0% {
		transform: none;
		background-color: #0098da;
	}
	25% {
		transform: scale(1.05);
		background-color: #00b0f5;
	}
	55% {
		transform: scale(.98);
	}
	100% {
		transform: none;
		background-color: #0098da;
	}
}

@media (min-width: 768px) {
	.nh-cart-toast {
		right: 20px;
		width: calc(100% - 40px);
	}
}

.nh-cart-toast__body {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 12px 14px 8px;
}

.nh-cart-toast__text {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.6;
}

.nh-cart-toast__link {
	flex: 0 0 auto;
	padding: 6px 10px;
	border-radius: 6px;
	background: #fff;
	color: #0098da;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.6;
	white-space: nowrap;
	text-decoration: none;
}

.nh-cart-toast__link:hover,
.nh-cart-toast__link:focus {
	background: #fff;
	color: #0079ae;
	text-decoration: none;
}

.nh-cart-toast__close {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.nh-cart-toast__close:hover,
.nh-cart-toast__close:focus-visible {
	background: rgba(255, 255, 255, .18);
}

.nh-cart-toast__link:focus-visible,
.nh-cart-toast__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* خط پایین که در ۷٫۵ ثانیه از راست به چپ پر می‌شود؛ پایان پر شدن، اعلان را می‌بندد */
.nh-cart-toast__bar {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 3px;
	background: rgba(255, 255, 255, .85);
	transform: scaleX(0);
	transform-origin: right center;
}

.nh-cart-toast.is-open .nh-cart-toast__bar {
	animation: nh-cart-toast-fill var(--nh-toast-duration, 7.5s) linear forwards;
}

/* تا وقتی موس یا فوکوس کیبورد روی اعلان است، زمان نمی‌گذرد. hover فقط برای موس:
   در گوشی بعد از لمس، حالت hover می‌ماند و اعلان دیگر بسته نمی‌شد. */
@media (hover: hover) {
	.nh-cart-toast:hover .nh-cart-toast__bar {
		animation-play-state: paused;
	}
}

.nh-cart-toast:focus-within .nh-cart-toast__bar {
	animation-play-state: paused;
}

@keyframes nh-cart-toast-fill {
	to {
		transform: scaleX(1);
	}
}

/* ---------- منوی کشویی آیکون سبد در هدر ----------
   فقط با موس (دسکتاپ). در گوشی لمس آیکون مستقیم به صفحهٔ سبد خرید می‌رود. */

.nh-mini-cart {
	display: none;
}

@media (hover: hover) and (min-width: 992px) {
	li.rbt-mini-cart {
		position: relative;
	}

	/* padding-top پل نامرئی بین آیکون و منو است تا با رفتن موس به سمت منو بسته نشود */
	li.rbt-mini-cart.nh-has-items .nh-mini-cart {
		display: block;
		position: absolute;
		top: 100%;
		right: 0;
		z-index: 100;
		width: 300px;
		padding-top: 10px;
		opacity: 0;
		visibility: hidden;
		transform: translateY(6px);
		transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
	}

	li.rbt-mini-cart.nh-has-items:hover .nh-mini-cart,
	li.rbt-mini-cart.nh-has-items:focus-within .nh-mini-cart {
		opacity: 1;
		visibility: visible;
		transform: none;
		transition: opacity .2s ease, transform .2s ease, visibility 0s;
	}
}

.nh-mini-cart__list {
	max-height: 320px;
	overflow-y: auto;
	/* نوار اسکرول باریک و کم‌رنگ (فایرفاکس؛ کروم و سافاری پایین‌تر) */
	scrollbar-width: thin;
	scrollbar-color: #d5d8de transparent;
	margin: 0;
	padding: 6px 0;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 10px 30px rgba(19, 65, 98, .15);
	list-style: none;
	/* ردیف بالای هدر چپ‌چین است؛ بدون این، ضربدر سمت راست عنوان می‌افتاد */
	direction: rtl;
	text-align: right;
}

.nh-mini-cart__list::-webkit-scrollbar {
	width: 4px;
}

.nh-mini-cart__list::-webkit-scrollbar-track {
	background: transparent;
}

.nh-mini-cart__list::-webkit-scrollbar-thumb {
	border-radius: 4px;
	background: #d5d8de;
}

.nh-mini-cart__item {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 8px 14px;
	transition: opacity .2s ease;
}

.nh-mini-cart__item + .nh-mini-cart__item {
	border-top: 1px solid #f1f0f3;
}

.nh-mini-cart__item.is-removing {
	opacity: .4;
	pointer-events: none;
}

.nh-mini-cart__title {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	color: var(--color-heading, #192335);
	font-size: 14px;
	line-height: 1.7;
	white-space: nowrap;
	text-overflow: ellipsis;
	text-decoration: none;
}

.nh-mini-cart__title:hover,
.nh-mini-cart__title:focus {
	color: #0098da;
}

/* ضربدر حذف: سمت چپ عنوان، دایرهٔ سبز با ضربدر سفید */
.nh-mini-cart__remove {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #00ca9d;
	color: #fff;
	text-decoration: none;
	transition: background-color .2s ease, transform .2s ease;
}

.nh-mini-cart__remove svg {
	width: 15px;
	height: 15px;
}

/* رنگ لینک‌های هدر قالب روی currentColor می‌نشست و ضربدر تیره می‌شد؛ سفید مستقیم روی خط */
.nh-mini-cart__remove path {
	stroke: #fff;
	stroke-width: 3;
}

.nh-mini-cart__remove:hover,
.nh-mini-cart__remove:focus-visible {
	background: #00a882;
	color: #fff;
	transform: scale(1.1);
}

.nh-mini-cart__remove:focus-visible {
	outline: 2px solid #00ca9d;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.nh-cart-toast {
		transform: none;
		transition: opacity .2s ease;
	}

	.nh-cart-toast.is-bump {
		animation: none;
	}

	.nh-mini-cart {
		transition: none !important;
	}
}
