/**
 * Giao diện mô-đun mã giảm giá dùng chung.
 * Mục tiêu V5:
 * - Popup nhỏ gọn, desktop lộ gần 3 mã.
 * - Tablet/mobile tự co gọn và vuốt cuộn mượt.
 * - "Điều kiện & hạn dùng" nằm liền trong từng mã.
 */
.v247-coupon-card {
	position: relative;
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr);
	gap: 12px;
	width: 100%;
	padding: 14px 14px 10px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
	text-align: left;
}

.v247-coupon-card::before {
	content: "";
	position: absolute;
	top: 10px;
	bottom: 10px;
	left: -1px;
	width: 8px;
	background: radial-gradient(circle at 0 6px, transparent 0 3px, #e5e7eb 3.5px 4.5px, #fff 5px) 0 0 / 8px 12px repeat-y;
}

.v247-coupon-card__icon {
	display: grid;
	width: 44px;
	height: 44px;
	place-items: center;
	align-self: start;
	border-radius: 50%;
	background: #ecfdf5;
	color: #159968;
	font-size: 25px;
	line-height: 1;
}

.v247-coupon-card__body {
	min-width: 0;
}

.v247-coupon-card__label {
	display: block;
	margin-bottom: 2px;
	color: #8a8f98;
	font-size: 12px;
	line-height: 1.3;
}

.v247-coupon-card__code {
	display: block;
	overflow-wrap: anywhere;
	color: #111827;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.35;
}

.v247-coupon-card__benefit,
.v247-coupon-card__usage {
	margin: 5px 0 0;
	font-size: 13px;
	line-height: 1.45;
}

.v247-coupon-card__benefit {
	color: #047857;
	font-weight: 600;
}

.v247-coupon-card__usage {
	color: #6b7280;
}

.v247-coupon-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.v247-coupon-copy,
.v247-coupon-product-panel__trigger {
	min-height: 34px;
	padding: 7px 16px;
	border: 0;
	border-radius: 18px;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}

.v247-coupon-copy {
	background: #159968;
	color: #fff;
}

.v247-coupon-copy:hover,
.v247-coupon-copy:focus-visible,
.v247-coupon-copy.is-saved {
	background: #087a50;
	color: #fff;
}

.v247-coupon-product-panel__trigger {
	padding: 0;
	border-radius: 0;
	background: transparent;
	color: #2563eb;
	text-decoration: underline;
}

.v247-coupon-product-panel__icon {
	display: inline-grid;
	width: 42px;
	height: 42px;
	place-items: center;
	flex: 0 0 42px;
	border-radius: 50%;
	background: #159968;
	color: #fff;
	font-size: 20px;
	font-weight: 700;
}

.v247-coupon-product-panel .fundiin_promotion__panel-inner {
	display: flex;
	align-items: center;
	gap: 10px;
}

#manh-float-btn {
	position: fixed;
	top: 60%;
	right: 0;
	z-index: 9999;
	display: flex;
	min-width: 38px;
	flex-direction: column;
	align-items: center;
	padding: 10px 5px;
	transform: translateY(-50%);
	border: 0;
	border-radius: 8px 0 0 8px;
	background: #e11d1d;
	box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.24);
	color: #fff;
	cursor: pointer;
	font-size: 10px;
	font-weight: 700;
	line-height: 1.15;
	text-align: center;
}

#manh-float-btn:hover,
#manh-float-btn:focus-visible {
	background: #b91c1c;
	color: #fff;
}

.v247-coupon-floating__symbol {
	margin-bottom: 3px;
	font-size: 17px;
}

.manh-pulse-ring {
	position: absolute;
	inset: 0;
	border-radius: 8px 0 0 8px;
	background: rgba(225, 29, 29, 0.35);
	animation: v247CouponPulse 2s infinite;
	pointer-events: none;
}

@keyframes v247CouponPulse {
	0% { transform: scale(1); opacity: 0.9; }
	100% { transform: scale(1.35, 1.18); opacity: 0; }
}

.v247-coupon-dialog[hidden] {
	display: none !important;
}

.v247-coupon-dialog {
	position: fixed;
	inset: 0;
	z-index: 1000000;
	display: grid;
	place-items: center;
	padding: 18px;
}

.v247-coupon-dialog__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(9, 26, 39, 0.72);
}

.v247-coupon-dialog__panel {
	position: relative;
	z-index: 1;
	display: flex;
	width: min(100%, 540px);
	max-height: min(calc(100vh - 36px), 690px);
	max-height: min(calc(100dvh - 36px), 690px);
	min-height: 0;
	flex-direction: column;
	overflow: hidden;
	padding: 22px 18px 16px;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 22px 70px rgba(15, 23, 42, 0.32);
	outline: none;
}

.v247-coupon-dialog__close {
	position: absolute;
	top: 10px;
	right: 12px;
	z-index: 2;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #4b5563;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.v247-coupon-dialog__close:hover,
.v247-coupon-dialog__close:focus-visible {
	background: #f3f4f6;
	color: #111827;
}

.v247-coupon-dialog__header {
	padding-right: 32px;
	text-align: center;
}

.v247-coupon-dialog__header h2 {
	margin: 0;
	color: #ef4444;
	font-size: 19px;
	line-height: 1.25;
	font-weight: 700;
}

.v247-coupon-dialog__header p {
	margin: 6px 0 14px;
	color: #047857;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.45;
}

.v247-coupon-dialog__list {
	display: grid;
	min-height: 0;
	flex: 1 1 auto;
	gap: 12px;
	max-height: 442px;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 2px 10px 2px 2px;
	overscroll-behavior: contain;
	scrollbar-color: #16a34a #d9dee5;
	scrollbar-gutter: stable;
	scrollbar-width: auto;
	touch-action: pan-y;
	-webkit-overflow-scrolling: touch;
}

.v247-coupon-dialog__list::-webkit-scrollbar {
	width: 10px;
}

.v247-coupon-dialog__list::-webkit-scrollbar-track {
	border-radius: 999px;
	background: #e5e7eb;
}

.v247-coupon-dialog__list::-webkit-scrollbar-thumb {
	min-height: 48px;
	border: 2px solid #e5e7eb;
	border-radius: 999px;
	background: #16a34a;
}

.v247-coupon-dialog__list::-webkit-scrollbar-thumb:hover {
	background: #087a50;
}

.v247-coupon-dialog__item {
	min-width: 0;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
	overflow: hidden;
}

.v247-coupon-dialog__item > .v247-coupon-card {
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.v247-coupon-dialog__empty {
	padding: 24px 18px;
	border: 1px dashed #d1d5db;
	border-radius: 10px;
	background: #f9fafb;
	color: #374151;
	text-align: center;
}

.v247-coupon-dialog__empty strong {
	display: block;
	color: #111827;
	font-size: 16px;
}

.v247-coupon-dialog__empty p {
	margin: 6px 0 0;
	font-size: 14px;
}

.v247-coupon-dialog__details {
	border-top: 1px solid #edf2f7;
	background: linear-gradient(180deg, #fcfffe 0%, #f8fbff 100%);
	color: #4b5563;
	font-size: 13px;
	line-height: 1.55;
}

.v247-coupon-dialog__details summary {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 11px 38px 11px 14px;
	list-style: none;
	cursor: pointer;
}

.v247-coupon-dialog__details summary::-webkit-details-marker {
	display: none;
}

.v247-coupon-dialog__details summary::after {
	content: "▾";
	position: absolute;
	top: 50%;
	right: 14px;
	transform: translateY(-50%);
	color: #16a34a;
	font-size: 14px;
	transition: transform 0.2s ease;
}

.v247-coupon-dialog__details[open] summary::after {
	transform: translateY(-50%) rotate(180deg);
}

.v247-coupon-dialog__summary-label {
	color: #1d4ed8;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
}

.v247-coupon-dialog__summary-meta {
	color: #6b7280;
	font-size: 12px;
	line-height: 1.45;
}

.v247-coupon-dialog__description {
	padding: 0 14px 12px;
}

.v247-coupon-dialog__facts {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 4px;
}

.v247-coupon-dialog__facts li {
	margin: 0;
	color: #374151;
}

.v247-coupon-dialog__description-content {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px dashed #dbe4f0;
}

.v247-coupon-dialog__description-content p {
	margin: 0 0 7px;
}

.v247-coupon-dialog-open {
	overflow: hidden;
}

.v247-coupon-toast {
	position: fixed;
	top: 24px;
	left: 50%;
	z-index: 1000001;
	display: grid;
	gap: 3px;
	width: min(calc(100% - 30px), 420px);
	padding: 14px 18px;
	transform: translate(-50%, -12px);
	border-radius: 10px;
	background: rgba(17, 24, 39, 0.96);
	box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
	color: #fff;
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.v247-coupon-toast.is-visible {
	transform: translate(-50%, 0);
	opacity: 1;
}

.v247-coupon-toast span {
	font-size: 13px;
}

@media (max-width: 991px) {
	.v247-coupon-dialog__panel {
		width: min(100%, 500px);
		max-height: calc(100vh - 28px);
		max-height: calc(100dvh - 28px);
		padding: 20px 16px 14px;
	}

	.v247-coupon-dialog__list {
		max-height: calc(100vh - 190px);
		max-height: calc(100dvh - 190px);
	}
}

@media (max-width: 767px) {
	#manh-float-btn {
		top: auto;
		bottom: 104px;
		transform: none;
	}

	.v247-coupon-dialog {
		padding: 20px;
	}

	.v247-coupon-dialog__panel {
		width: min(100%, 318px);
		max-height: calc(100vh - 110px);
		max-height: calc(100dvh - 110px);
		padding: 14px 9px 9px;
		border-radius: 16px;
	}

	.v247-coupon-dialog__close {
		top: 8px;
		right: 8px;
		width: 32px;
		height: 32px;
		font-size: 24px;
	}

	.v247-coupon-dialog__header {
		padding-right: 22px;
	}

	.v247-coupon-dialog__header h2 {
		font-size: 17px;
	}

	.v247-coupon-dialog__header p {
		font-size: 12px;
		margin: 5px 0 10px;
	}

	.v247-coupon-dialog__list {
		gap: 9px;
		max-height: calc(100vh - 250px);
		max-height: calc(100dvh - 250px);
		padding-right: 5px;
	}

	.v247-coupon-dialog__list::-webkit-scrollbar {
		width: 5px;
	}

	.v247-coupon-card {
		grid-template-columns: 38px minmax(0, 1fr);
		gap: 8px;
		padding: 10px 8px 8px 8px;
	}

	.v247-coupon-card__icon {
		width: 36px;
		height: 36px;
		font-size: 20px;
	}

	.v247-coupon-card__label {
		font-size: 11px;
	}

	.v247-coupon-card__code {
		font-size: 13px;
	}

	.v247-coupon-card__actions {
		margin-top: 8px;
	}

	.v247-coupon-copy {
		min-height: 32px;
		padding: 6px 15px;
		font-size: 12px;
	}

	.v247-coupon-card__benefit,
	.v247-coupon-card__usage,
	.v247-coupon-dialog__summary-meta,
	.v247-coupon-dialog__facts li,
	.v247-coupon-dialog__description-content p {
		font-size: 11px;
	}

	.v247-coupon-dialog__summary-label {
		font-size: 12px;
	}

	.v247-coupon-dialog__details summary {
		padding: 8px 30px 8px 10px;
	}
}

@media (max-width: 420px) {
	.v247-coupon-dialog {
		padding: 22px;
	}

	.v247-coupon-dialog__panel {
		width: min(100%, 312px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.manh-pulse-ring,
	.v247-coupon-toast,
	.v247-coupon-dialog__details summary::after {
		animation: none !important;
		transition: none !important;
	}
}

/* QA cuối: nút mã giảm nổi mobile có thể kéo dọc, nhưng tap vẫn mở hộp mã. */
@media (max-width: 767px) {
	#manh-float-btn {
		touch-action: none;
		user-select: none;
		-webkit-user-select: none;
	}

	/* QA-09B: ký hiệu nhỏ cho biết nút có thể kéo theo chiều dọc trên mobile. */
	#manh-float-btn::after {
		content: "↕";
		position: absolute;
		top: 50%;
		left: -12px;
		z-index: 2;
		display: grid;
		width: 15px;
		height: 22px;
		place-items: center;
		transform: translateY(-50%);
		border-radius: 7px 0 0 7px;
		background: rgba(17, 24, 39, 0.72);
		color: #fff;
		font-size: 10px;
		font-weight: 600;
		line-height: 1;
		pointer-events: none;
	}

	#manh-float-btn.is-dragging {
		cursor: grabbing;
		transition: none !important;
	}
}
