/* ================================================================
 * گیفت پتیشا — استایل فرانت‌اند
 * دکمه‌ی شناور · نوار پیشرفت · مودال هدیه · انفجار شادی
 * ================================================================ */

:root {
	--gop-purple: #7c3aed;
	--gop-purple-2: #8b5cf6;
	--gop-purple-light: #a78bfa;
	--gop-grad: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 45%, #7c3aed 100%);
	--gop-grad-btn: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
	--gop-ink: #1d2030;
	--gop-shadow: 0 18px 40px -16px rgba(124, 58, 237, 0.55);
	--gop-font: 'dana-fd', 'dana', 'Dana', 'Vazirmatn', 'Vazir', 'IRANSansX', 'IRANSans', Tahoma, sans-serif;
}

/* اگر فونت دانا روی سایت بارگذاری نشده، فایل‌های لایسنس‌دار خود را در پوشه‌ی
   assets/fonts/ قرار دهید و این بلوک را از حالت کامنت خارج کنید (دانا فونت تجاری است).
@font-face {
	font-family: 'dana';
	src: url('../fonts/dana-regular.woff2') format('woff2'),
	     url('../fonts/dana-regular.woff') format('woff');
	font-weight: 400;
	font-display: swap;
}
@font-face {
	font-family: 'dana';
	src: url('../fonts/dana-bold.woff2') format('woff2'),
	     url('../fonts/dana-bold.woff') format('woff');
	font-weight: 700;
	font-display: swap;
}
*/

/* ================================================================
 * دکمه‌ی شناور
 * ================================================================ */
.gop-fab {
	position: fixed;
	right: 22px;
	bottom: 22px;
	width: 72px;
	height: 72px;
	border: none;
	background: transparent;
	padding: 0;
	cursor: pointer;
	z-index: 99990;
	border-radius: 50%;
	-webkit-tap-highlight-color: transparent;
	font-family: var(--gop-font);
	animation: gopFabIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
	transition: transform 0.25s;
}

.gop-fab:hover {
	transform: scale(1.06);
}

@keyframes gopFabIn {
	from { transform: scale(0) rotate(-30deg); opacity: 0; }
	to   { transform: scale(1) rotate(0); opacity: 1; }
}

/* رینگ پیشرفت */
.gop-fab-ring {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
	overflow: visible;
}

.gop-ring-bg {
	fill: none;
	stroke: rgba(124, 58, 237, 0.15);
	stroke-width: 7;
}

.gop-ring-fill {
	fill: none;
	stroke: url(#gopGrad);
	stroke: var(--gop-purple);
	stroke-width: 7;
	stroke-linecap: round;
	stroke-dasharray: 339.292;
	stroke-dashoffset: 339.292;
	transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.4s;
	filter: drop-shadow(0 0 4px rgba(124, 58, 237, 0.4));
}

.gop-fab.gop-ready .gop-ring-fill {
	stroke: #34d399;
	filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.6));
}

/* دایره‌ی داخلی */
.gop-fab-inner {
	position: absolute;
	inset: 9px;
	border-radius: 50%;
	background: var(--gop-grad);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--gop-shadow), inset 0 1px 1px rgba(255, 255, 255, 0.4);
	transition: background 0.4s;
}

.gop-fab.gop-ready .gop-fab-inner {
	background: linear-gradient(135deg, #34d399, #10b981);
	box-shadow: 0 18px 40px -16px rgba(16, 185, 129, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.gop-fab-gift {
	width: 30px;
	height: 30px;
	color: #fff;
	transition: transform 0.3s;
}

.gop-fab.gop-ready .gop-fab-gift {
	animation: gopGiftBounce 1.4s ease-in-out infinite;
}

@keyframes gopGiftBounce {
	0%, 100% { transform: translateY(0) rotate(0); }
	25%      { transform: translateY(-3px) rotate(-6deg); }
	75%      { transform: translateY(-3px) rotate(6deg); }
}

/* حلقه‌ی تپش هنگام آماده بودن */
.gop-fab-pulse {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	pointer-events: none;
	opacity: 0;
}

.gop-fab.gop-ready .gop-fab-pulse {
	opacity: 1;
	animation: gopPulse 1.8s ease-out infinite;
}

@keyframes gopPulse {
	0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
	70%  { box-shadow: 0 0 0 18px rgba(16, 185, 129, 0); }
	100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* تولتیپ */
.gop-fab-tooltip {
	position: fixed;
	right: 104px;
	bottom: 38px;
	background: var(--gop-ink);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	padding: 9px 14px;
	border-radius: 11px;
	z-index: 99989;
	white-space: nowrap;
	box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.4);
	font-family: var(--gop-font);
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transform: translateX(-8px);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.gop-fab-tooltip.gop-show {
	opacity: 1;
	visibility: visible;
	transform: translateX(0);
}

.gop-fab-tooltip::after {
	content: "";
	position: absolute;
	left: 100%;
	bottom: 14px;
	border: 7px solid transparent;
	border-left-color: var(--gop-ink);
}

.gop-fab-tooltip.gop-tip-ready {
	background: #0f8a5f;
}

.gop-fab-tooltip.gop-tip-ready::after {
	border-left-color: #0f8a5f;
}

@keyframes gopTipIn {
	from { opacity: 0; transform: translateX(8px); }
	to   { opacity: 1; transform: translateX(0); }
}

/* رقص کوتاه دکمه هنگام رسیدن به هدف */
.gop-fab.gop-pop {
	animation: gopFabPop 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes gopFabPop {
	0%   { transform: scale(1); }
	25%  { transform: scale(1.22) rotate(-6deg); }
	45%  { transform: scale(0.94) rotate(5deg); }
	65%  { transform: scale(1.1) rotate(-3deg); }
	100% { transform: scale(1) rotate(0); }
}

/* قفل اسکرول هنگام باز بودن مودال */
html.gop-modal-lock,
body.gop-modal-lock {
	overflow: hidden;
}

/* ================================================================
 * مودال
 * ================================================================ */
.gop-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(28, 22, 46, 0.55);
	backdrop-filter: blur(5px);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 26px 20px;
	overflow-y: auto;
	font-family: var(--gop-font);
	direction: rtl;
	opacity: 0;
	transition: opacity 0.28s ease;
}

.gop-modal-overlay.gop-open {
	opacity: 1;
}

.gop-modal {
	position: relative;
	background: linear-gradient(180deg, #ffffff 0%, #faf8ff 100%);
	width: 100%;
	max-width: 600px;
	margin: auto;
	overflow: visible;
	border-radius: 22px;
	padding: 26px 24px 22px;
	box-shadow: 0 40px 80px -24px rgba(40, 20, 80, 0.5);
	transform: scale(0.92) translateY(12px);
	transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.gop-modal-overlay.gop-open .gop-modal {
	transform: scale(1) translateY(0);
}

/* دکمه‌ی بستن — دایره‌ی قرمز کاملاً بیرون از کادر، گوشه‌ی بالا/چپ */
.gop-modal-close {
	position: absolute;
	top: -18px;
	left: -18px;
	width: 42px;
	height: 42px;
	padding: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, #f87171, #ef4444);
	border: 3px solid #fff;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 10px 22px -6px rgba(239, 68, 68, 0.65);
	z-index: 5;
	transition: transform 0.2s, box-shadow 0.2s;
}

.gop-modal-close:hover {
	transform: rotate(90deg) scale(1.08);
	box-shadow: 0 12px 26px -6px rgba(239, 68, 68, 0.8);
}

.gop-modal-close svg {
	width: 18px;
	height: 18px;
}

/* سربرگ مودال — تراز و فشرده */
.gop-modal-header {
	text-align: center;
	margin-bottom: 18px;
}

.gop-modal-headline {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-bottom: 8px;
}

.gop-modal-emoji {
	font-size: 30px;
	line-height: 1;
	animation: gopEmojiPop 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes gopEmojiPop {
	0%   { transform: scale(0) rotate(-20deg); }
	60%  { transform: scale(1.2) rotate(8deg); }
	100% { transform: scale(1) rotate(0); }
}

.gop-modal-title {
	font-size: 20px;
	font-weight: 800;
	color: var(--gop-ink);
	margin: 0;
}

.gop-modal-lead {
	font-size: 13.5px;
	color: #4a4f63;
	margin: 0 0 4px;
	font-weight: 600;
}

.gop-modal-lead-2 {
	font-size: 12.5px;
	color: #7c8094;
	margin: 0;
	line-height: 1.8;
}

/* شبکه‌ی هدایا */
.gop-modal-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

/* کارت هدیه — فشرده */
.gop-gift-card {
	position: relative;
	background: #fff;
	border: 1.5px solid #f0ecfa;
	border-radius: 16px;
	padding: 8px 10px 10px;
	display: flex;
	flex-direction: column;
	transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
	animation: gopCardIn 0.5s ease backwards;
}

.gop-gift-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 18px 34px -18px rgba(124, 58, 237, 0.4);
	border-color: #e0d4fb;
}

.gop-gift-card.gop-is-selected {
	border-color: #34d399;
	box-shadow: 0 14px 30px -16px rgba(16, 185, 129, 0.45);
}

@keyframes gopCardIn {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: translateY(0); }
}

.gop-gift-card:nth-child(1) { animation-delay: 0.05s; }
.gop-gift-card:nth-child(2) { animation-delay: 0.12s; }
.gop-gift-card:nth-child(3) { animation-delay: 0.19s; }
.gop-gift-card:nth-child(4) { animation-delay: 0.26s; }

.gop-gift-thumb {
	position: relative;
	width: 100%;
	height: 104px;
	border-radius: 12px;
	background: #f4f1fc;
	background-size: cover;
	background-position: center;
	overflow: hidden;
	margin-bottom: 10px;
}

.gop-gift-thumb-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	font-size: 34px;
	color: #cabdf0;
}

/* نام محصول به‌صورت بج سفید شیری گرادینتی — نزدیک لبه‌ی بالای تصویر */
.gop-gift-name-badge {
	position: absolute;
	top: -13px;
	right: 14px;
	max-width: calc(100% - 28px);
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 241, 254, 0.95));
	color: var(--gop-ink);
	font-size: 11.5px;
	font-weight: 800;
	line-height: 1.5;
	padding: 5px 9px;
	border-radius: 9px;
	text-align: right;
	box-shadow: 0 6px 16px -6px rgba(40, 20, 80, 0.4);
	backdrop-filter: blur(3px);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	z-index: 2;
	transition: background 0.3s, box-shadow 0.3s, color 0.3s;
}

/* وقتی هدیه انتخاب شده، بج نام سبز می‌شود تا انتخاب‌بودن مشخص باشد */
.gop-is-selected .gop-gift-name-badge {
	background: linear-gradient(135deg, #10b981, #059669);
	box-shadow: 0 10px 22px -10px rgba(16, 185, 129, 0.7);
	color: #fff;
}

/* دکمه‌ها — «انتخاب» پهن، «مشاهده» فقط آیکونِ باریک */
.gop-gift-actions {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 8px;
	margin-top: auto;
}

/* دکمه‌ی مشاهده‌ی محصول */
.gop-view-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 700;
	color: var(--gop-purple);
	background: #f5f1fe;
	border: 1.5px solid #e8ddfb;
	border-radius: 10px;
	width: 40px;
	padding: 9px 0;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.18s, border-color 0.18s;
}

.gop-view-btn:hover {
	background: #ede4fc;
	color: var(--gop-purple);
}

.gop-view-btn svg {
	width: 16px;
	height: 16px;
}

/* دکمه‌ی انتخاب هدیه — گرادینت بنفش */
.gop-select-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 800;
	color: #fff;
	background: var(--gop-grad-btn);
	border: none;
	border-radius: 10px;
	padding: 9px 8px;
	cursor: pointer;
	overflow: hidden;
	box-shadow: 0 10px 22px -10px rgba(124, 58, 237, 0.75);
	transition: transform 0.16s, box-shadow 0.2s, background 0.3s;
}

.gop-select-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 26px -10px rgba(124, 58, 237, 0.85);
}

.gop-select-btn:active {
	transform: translateY(1px);
}

.gop-select-btn svg {
	width: 15px;
	height: 15px;
}

.gop-select-btn .gop-btn-text {
	white-space: nowrap;
}

.gop-select-btn .gop-btn-icon-heart {
	display: none;
}

.gop-select-btn .gop-btn-spinner {
	display: none;
	width: 15px;
	height: 15px;
	border: 2.4px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: gopSpin 0.7s linear infinite;
}

@keyframes gopSpin {
	to { transform: rotate(360deg); }
}

/* حالت در حال بارگذاری */
.gop-select-btn.gop-loading {
	pointer-events: none;
	opacity: 0.92;
}

.gop-select-btn.gop-loading .gop-btn-icon-gift,
.gop-select-btn.gop-loading .gop-btn-text {
	display: none;
}

.gop-select-btn.gop-loading .gop-btn-spinner {
	display: inline-block;
}

/* حالت انتخاب‌شده — قلب در سبد */
.gop-select-btn.gop-selected {
	background: linear-gradient(135deg, #10b981, #059669);
	box-shadow: 0 10px 22px -10px rgba(16, 185, 129, 0.7);
}

.gop-select-btn.gop-selected .gop-btn-icon-gift {
	display: none;
}

.gop-select-btn.gop-selected .gop-btn-icon-heart {
	display: inline-flex;
	animation: gopHeartbeat 1.3s ease-in-out infinite;
}

@keyframes gopHeartbeat {
	0%, 100%   { transform: scale(1); }
	15%        { transform: scale(1.28); }
	30%        { transform: scale(1); }
	45%        { transform: scale(1.18); }
	60%        { transform: scale(1); }
}

/* پایین مودال */
.gop-modal-foot {
	text-align: center;
	margin-top: 22px;
}

.gop-foot-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12.5px;
	font-weight: 600;
	color: #7c8094;
	background: #f4f2fa;
	padding: 8px 16px;
	border-radius: 999px;
}

/* پیام خطا داخل مودال */
.gop-modal-error {
	display: none;
	margin: 0 0 16px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #b91c1c;
	font-size: 13px;
	font-weight: 600;
	padding: 11px 15px;
	border-radius: 11px;
	text-align: center;
}

.gop-modal-error.gop-show {
	display: block;
}

/* ================================================================
 * بوم انفجار شادی
 * ================================================================ */
.gop-confetti-canvas {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 100001;
}

/* ================================================================
 * نوار پیشرفت شورت‌کد
 * ================================================================ */
.gop-sc-wrap {
	font-family: var(--gop-font);
	direction: rtl;
	background: linear-gradient(135deg, #faf8ff, #f3eefe);
	border: 1.5px solid #ece3fd;
	border-radius: 16px;
	padding: 16px 18px;
	margin: 16px 0;
	box-shadow: 0 8px 22px -16px rgba(124, 58, 237, 0.4);
}

.gop-sc-top {
	display: flex;
	align-items: center;
	gap: 9px;
	margin-bottom: 12px;
}

.gop-sc-emoji {
	font-size: 20px;
	flex-shrink: 0;
}

.gop-sc-text {
	font-size: 14px;
	font-weight: 700;
	color: #3a3550;
	line-height: 1.7;
}

.gop-sc-text strong {
	color: var(--gop-purple);
	font-size: 15px;
}

.gop-sc-track {
	position: relative;
	height: 14px;
	background: #ece6f8;
	border-radius: 999px;
	overflow: hidden;
}

.gop-sc-bar {
	position: relative;
	height: 100%;
	width: 0;
	background: var(--gop-grad);
	border-radius: 999px;
	transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
	overflow: hidden;
}

.gop-sc-bar::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 255, 255, 0.45),
		transparent
	);
	transform: translateX(-100%);
	animation: gopShine 2.2s ease-in-out infinite;
}

@keyframes gopShine {
	0%   { transform: translateX(-100%); }
	60%  { transform: translateX(220%); }
	100% { transform: translateX(220%); }
}

.gop-sc-wrap.gop-sc-done .gop-sc-bar {
	background: linear-gradient(135deg, #34d399, #10b981);
}

.gop-sc-open-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 14px;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 800;
	color: #fff;
	background: var(--gop-grad-btn);
	border: none;
	border-radius: 11px;
	padding: 11px 22px;
	cursor: pointer;
	box-shadow: 0 10px 22px -10px rgba(124, 58, 237, 0.7);
	transition: transform 0.16s, box-shadow 0.2s;
	animation: gopBtnPulse 2s ease-in-out infinite;
}

.gop-sc-open-btn:hover {
	transform: translateY(-1px);
}

@keyframes gopBtnPulse {
	0%, 100% { box-shadow: 0 10px 22px -10px rgba(124, 58, 237, 0.7); }
	50%      { box-shadow: 0 10px 28px -8px rgba(124, 58, 237, 0.9); }
}

/* پوشش نوار پیشرفت در صفحه‌ی سبد خرید */
.gop-cart-progress {
	width: 100%;
	margin: 0 0 22px;
}

.gop-cart-progress .gop-sc-wrap {
	margin: 0;
}

/* نسخه‌ی فشرده برای سبد کناری قالب */
.gop-sc-injected {
	padding: 12px 14px 0;
}

.gop-sc-sidecart {
	padding: 12px 13px;
	margin: 0;
	border-radius: 13px;
}

.gop-sc-sidecart .gop-sc-top {
	margin-bottom: 9px;
	gap: 7px;
}

.gop-sc-sidecart .gop-sc-emoji {
	font-size: 17px;
}

.gop-sc-sidecart .gop-sc-text {
	font-size: 12.5px;
	line-height: 1.65;
}

.gop-sc-sidecart .gop-sc-text strong {
	font-size: 13px;
}

.gop-sc-sidecart .gop-sc-track {
	height: 11px;
}

.gop-sc-sidecart .gop-sc-open-btn {
	margin-top: 11px;
	width: 100%;
	font-size: 12.5px;
	padding: 9px 14px;
	border-radius: 10px;
}

/* تعداد ثابت آیتم هدیه در سبد */
.gop-cart-qty-fixed {
	display: inline-block;
	font-weight: 700;
	color: var(--gop-purple);
}

/* بج «🎁 هدیه‌ی رایگان پتیشا» در ردیف هدیه‌ی سبد و مینی‌کارت */
.gop-gift-line .variation {
	margin: 4px 0 0;
}

.gop-gift-line .variation dt {
	display: none;
}

.gop-gift-line .variation dd {
	margin: 0;
}

.gop-gift-line .variation dd p {
	display: inline-block;
	margin: 0;
	font-family: 'dana-fd', var(--gop-font);
	background: #7740e7;
	padding: 5px 13px;
	border-radius: 25px;
	color: #fff !important;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.6;
}

/* ================================================================
 * ریسپانسیو
 * ================================================================ */
@media (max-width: 600px) {
	.gop-fab {
		width: 62px;
		height: 62px;
		right: 16px;
		left: auto;
		bottom: 16px;
	}
	.gop-fab-gift {
		width: 26px;
		height: 26px;
	}
	.gop-modal {
		padding: 24px 16px 20px;
		border-radius: 20px;
	}
	.gop-modal-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}
	.gop-modal-title {
		font-size: 18px;
	}
	.gop-modal-close {
		top: -14px;
		left: -10px;
		width: 38px;
		height: 38px;
	}
	.gop-fab-tooltip {
		right: 86px;
		left: auto;
		bottom: 30px;
		font-size: 12px;
	}
	/* دکمه‌های کارت روی موبایل فشرده‌تر تا در یک ردیف جا شوند */
	.gop-gift-actions {
		gap: 6px;
	}
	.gop-select-btn {
		font-size: 12px;
		padding: 9px 6px;
		gap: 4px;
	}
	.gop-view-btn {
		width: 36px;
		padding: 9px 0;
	}
	.gop-select-btn svg,
	.gop-view-btn svg {
		width: 14px;
		height: 14px;
	}
}

/* احترام به ترجیح کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
	.gop-fab.gop-ready .gop-fab-gift,
	.gop-fab.gop-ready .gop-fab-pulse,
	.gop-select-btn.gop-selected .gop-btn-icon-heart,
	.gop-sc-bar::after,
	.gop-sc-open-btn {
		animation: none !important;
	}
}
