/* ==========================================
   پاپ‌آپ تخفیف رندوم — Blackwacker
   طراحی: شیشه‌ای/سایبری، تیره، RTL
========================================== */

:root {
	--bwdp-neon: #22d3ee;
	--bwdp-neon-2: #a855f7;
	--bwdp-accent: #f97316;
	--bwdp-bg: #0b0f19;
	--bwdp-bg-2: #131a2b;
	--bwdp-text: #e5e7eb;
	--bwdp-muted: #94a3b8;
	--bwdp-danger: #f87171;
	--bwdp-success: #34d399;
	--bwdp-edge: 22px;
}

#bwd-popup-root {
	direction: rtl;
	font-family: 'Vazirmatn', Tahoma, sans-serif;
}

#bwd-popup-root * {
	box-sizing: border-box;
}

/* ==========================================
   کارت اصلی پاپ‌آپ
========================================== */

.bwdp-card {
	position: fixed;
	bottom: var(--bwdp-edge);
	left: var(--bwdp-edge);
	width: 372px;
	max-width: calc(100vw - (var(--bwdp-edge) * 2));
	z-index: 999999;
	border-radius: 22px;
	padding: 2px;
	background: linear-gradient(135deg, var(--bwdp-neon), var(--bwdp-neon-2) 55%, var(--bwdp-accent));
	box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
	animation: bwdp-glow 3.2s ease-in-out infinite;
	transform: translateY(140%) scale(0.96);
	opacity: 0;
	pointer-events: none;
	transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.15), opacity 0.35s ease;
	will-change: transform, opacity;
}

.bwdp-card.is-visible {
	transform: translateY(0) scale(1);
	opacity: 1;
	pointer-events: auto;
}

@keyframes bwdp-glow {
	0%, 100% { box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.6), 0 0 18px -4px rgba(34, 211, 238, 0.35); }
	50% { box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.6), 0 0 30px -2px rgba(168, 85, 247, 0.45); }
}

.bwdp-inner {
	background: radial-gradient(circle at 15% 0%, var(--bwdp-bg-2), var(--bwdp-bg) 70%);
	border-radius: 20px;
	padding: 22px 20px 18px;
	color: var(--bwdp-text);
	position: relative;
	overflow: hidden;
}

.bwdp-inner::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
	background-size: 22px 22px;
	pointer-events: none;
	opacity: 0.5;
}

/* دکمه‌ی بستن — بیرون از خود باکس، کمی بالاتر از لبه، سمت چپ */
.bwdp-close {
	position: absolute;
	top: -14px;
	left: -14px;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--bwdp-bg-2);
	border: 1px solid rgba(255, 255, 255, 0.14);
	color: var(--bwdp-text);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	z-index: 5;
	box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.65), 0 0 0 4px var(--bwdp-bg);
	transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.bwdp-close svg {
	display: block;
}

.bwdp-close:hover {
	background: var(--bwdp-danger);
	color: #1a0900;
	transform: scale(1.08) rotate(90deg);
}

.bwdp-close:active {
	transform: scale(0.95) rotate(90deg);
}

.bwdp-badge-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	position: relative;
	z-index: 2;
	margin-bottom: 12px;
}

.bwdp-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: linear-gradient(90deg, var(--bwdp-neon-2), var(--bwdp-neon));
	color: #05070d;
	font-weight: 800;
	font-size: 11.5px;
	padding: 5px 10px;
	border-radius: 999px;
	letter-spacing: 0.2px;
	white-space: nowrap;
}

.bwdp-percent-pill {
	font-weight: 900;
	font-size: 15px;
	background: var(--bwdp-accent);
	color: #1a0900;
	padding: 4px 12px;
	border-radius: 999px;
	box-shadow: 0 0 14px -2px rgba(249, 115, 22, 0.7);
	white-space: nowrap;
}

.bwdp-title {
	font-size: 14.5px;
	font-weight: 800;
	margin: 0 0 4px;
	position: relative;
	z-index: 2;
	line-height: 1.7;
}

.bwdp-sub {
	font-size: 12px;
	color: var(--bwdp-muted);
	margin: 0 0 12px;
	position: relative;
	z-index: 2;
	line-height: 1.8;
}

.bwdp-product {
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: 14px;
	padding: 10px;
	margin-bottom: 12px;
	position: relative;
	z-index: 2;
}

.bwdp-product img {
	width: 52px;
	height: 52px;
	object-fit: cover;
	border-radius: 10px;
	flex: 0 0 auto;
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.bwdp-product-info {
	min-width: 0;
}

.bwdp-product-name {
	font-size: 12.5px;
	font-weight: 700;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin: 0 0 5px;
}

.bwdp-price-row {
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-size: 12px;
	flex-wrap: wrap;
}

.bwdp-price-old {
	color: var(--bwdp-muted);
	text-decoration: line-through;
	font-size: 11.5px;
}

.bwdp-price-new {
	color: var(--bwdp-success);
	font-weight: 800;
	font-size: 14px;
}

.bwdp-timer-wrap {
	position: relative;
	z-index: 2;
	margin-bottom: 12px;
}

.bwdp-timer-label {
	display: flex;
	justify-content: space-between;
	font-size: 11px;
	color: var(--bwdp-muted);
	margin-bottom: 6px;
}

.bwdp-timer-clock {
	font-weight: 800;
	color: var(--bwdp-danger);
	direction: ltr;
	font-variant-numeric: tabular-nums;
}

.bwdp-timer-bar {
	width: 100%;
	height: 7px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	overflow: hidden;
}

.bwdp-timer-fill {
	height: 100%;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--bwdp-danger), var(--bwdp-accent));
	width: 100%;
	transition: width 1s linear;
}

.bwdp-warning {
	font-size: 11px;
	color: var(--bwdp-danger);
	background: rgba(248, 113, 113, 0.08);
	border: 1px dashed rgba(248, 113, 113, 0.35);
	border-radius: 10px;
	padding: 7px 9px;
	margin-bottom: 12px;
	line-height: 1.8;
	position: relative;
	z-index: 2;
}

.bwdp-cta {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	border: none;
	cursor: pointer;
	padding: 13px 14px;
	border-radius: 12px;
	font-family: inherit;
	font-weight: 800;
	font-size: 13.5px;
	color: #05070d;
	background: linear-gradient(90deg, var(--bwdp-neon), var(--bwdp-neon-2));
	box-shadow: 0 10px 24px -8px rgba(34, 211, 238, 0.55);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bwdp-cta:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 28px -8px rgba(168, 85, 247, 0.6);
}

.bwdp-cta:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.bwdp-cta .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.bwdp-expired {
	text-align: center;
	padding: 6px 4px 2px;
	position: relative;
	z-index: 2;
}

.bwdp-expired-icon {
	font-size: 26px;
	margin-bottom: 6px;
}

.bwdp-expired-title {
	font-weight: 800;
	font-size: 13.5px;
	margin: 0 0 4px;
}

.bwdp-expired-sub {
	font-size: 11.5px;
	color: var(--bwdp-muted);
	margin: 0;
}

/* ==========================================
   دایره‌ی کوچک بازگشایی مجدد (بعد از بستن با ضربدر)
========================================== */

.bwdp-mini {
	position: fixed;
	bottom: var(--bwdp-edge);
	left: var(--bwdp-edge);
	z-index: 999998;
	width: 66px;
	height: 66px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1px;
	padding: 0;
	background: linear-gradient(135deg, var(--bwdp-neon), var(--bwdp-neon-2) 55%, var(--bwdp-accent));
	color: #05070d;
	font-family: inherit;
	box-shadow: 0 12px 26px -8px rgba(0, 0, 0, 0.6);
	transform: scale(0);
	opacity: 0;
	pointer-events: none;
	transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.bwdp-mini.is-visible {
	transform: scale(1);
	opacity: 1;
	pointer-events: auto;
	animation: bwdp-mini-pulse 2.4s ease-in-out infinite;
}

.bwdp-mini:hover {
	filter: brightness(1.08);
}

.bwdp-mini-percent {
	font-weight: 900;
	font-size: 14px;
	line-height: 1;
	direction: ltr;
}

.bwdp-mini-label {
	font-weight: 700;
	font-size: 9.5px;
	line-height: 1;
}

@keyframes bwdp-mini-pulse {
	0%, 100% { box-shadow: 0 12px 26px -8px rgba(0, 0, 0, 0.6), 0 0 0 0 rgba(34, 211, 238, 0.55); }
	50% { box-shadow: 0 12px 26px -8px rgba(0, 0, 0, 0.6), 0 0 0 10px rgba(34, 211, 238, 0); }
}

/* ==========================================
   ریسپانسیو
========================================== */

@media (max-width: 480px) {
	:root {
		--bwdp-edge: 14px;
	}

	.bwdp-card {
		width: auto;
		max-width: calc(100vw - 28px);
	}

	.bwdp-inner {
		padding: 20px 16px 16px;
	}

	.bwdp-close {
		top: -12px;
		left: -12px;
		width: 28px;
		height: 28px;
	}

	.bwdp-mini {
		width: 56px;
		height: 56px;
	}

	.bwdp-mini-percent {
		font-size: 12.5px;
	}

	.bwdp-mini-label {
		font-size: 8.5px;
	}
}

@media (max-width: 360px) {
	.bwdp-badge {
		font-size: 10.5px;
		padding: 4px 8px;
	}

	.bwdp-percent-pill {
		font-size: 13px;
		padding: 3px 10px;
	}

	.bwdp-title {
		font-size: 13.5px;
	}
}
