/* DTB Popup Manager — Frontend Styles */

.dtb-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2147483000;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease;
	padding: 16px;
	box-sizing: border-box;
}

.dtb-popup-overlay.dtb-popup-visible {
	opacity: 1;
	visibility: visible;
}

.dtb-popup-card {
	position: relative;
	background: #ffffff;
	border-radius: 16px;
	max-width: 480px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	overflow-x: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	transform: translateY(16px) scale(0.97);
	transition: transform 0.28s ease;
	box-sizing: border-box;
}

.dtb-popup-overlay.dtb-popup-visible .dtb-popup-card {
	transform: translateY(0) scale(1);
}

.dtb-popup-close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 34px;
	height: 34px;
	border: none;
	background: #ffffff;
	color: #1a1a1a;
	font-size: 18px;
	line-height: 1;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	padding: 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dtb-popup-close:hover {
	background: #f5f5f5;
}

.dtb-popup-image-wrap {
	width: 100%;
	line-height: 0;
}

.dtb-popup-image {
	width: 100%;
	height: auto;
	display: block;
}

.dtb-popup-body {
	padding: 18px;
	box-sizing: border-box;
}

.dtb-popup-badge {
	position: absolute;
	left: 12px;
	top: 12px;
	z-index: 6;
	background: #facc15;
	color: #111111;
	font-size: 12px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 999px;
}

.dtb-popup-headline {
	margin: 0 0 10px;
	line-height: 1.3;
}

.dtb-popup-description {
	margin: 0 0 18px;
	line-height: 1.55;
	/* Justify (forced from JS) makes both edges flush; these two rules
	   stop a long/unbreakable word from overflowing or getting shoved
	   whole onto the next line — it will break and continue instead. */
	overflow-wrap: break-word;
	word-break: break-word;
	hyphens: auto;
	-webkit-hyphens: auto;
	-ms-hyphens: auto;
	/* Don't stretch-justify the final short line — that's what usually
	   looks broken with justified text (huge gaps on the last line). */
	text-align-last: left;
}

/* Coupon Code box — code on the left, Copy button on the right, shown
   between the description/text and the button row when a coupon_code is
   configured. Used by both the Homepage and Product popups. */
.dtb-popup-coupon {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin: 0 0 18px;
	padding: 10px 14px;
	border: 1px dashed #c3c4c7;
	border-radius: 8px;
	background: #f6f7f7;
}

.dtb-popup-coupon-code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .04em;
	color: #1d2327;
	word-break: break-all;
}

.dtb-popup-coupon-copy {
	flex: 0 0 auto;
	border: 1px solid #2271b1;
	background: #fff;
	color: #2271b1;
	font-size: 12px;
	font-weight: 600;
	padding: 6px 12px;
	border-radius: 6px;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color .15s ease, color .15s ease;
}

.dtb-popup-coupon-copy:hover {
	background: #2271b1;
	color: #fff;
}

.dtb-popup-coupon-copy.is-copied {
	border-color: #2a9d5c;
	background: #2a9d5c;
	color: #fff;
}

.dtb-popup-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 18px;
}

/* Exactly one button: take the full width of the popup. */
.dtb-popup-buttons-single .dtb-popup-btn {
	flex: 1 1 100%;
	width: 100%;
}

/* Exactly two buttons: sit side by side, splitting the width evenly and
   never wrapping onto separate lines. */
.dtb-popup-buttons-pair {
	flex-wrap: nowrap;
}

.dtb-popup-buttons-pair .dtb-popup-btn {
	flex: 1 1 0;
	min-width: 0;
}

.dtb-popup-btn {
	flex: 1 1 auto;
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	border: none;
	cursor: pointer;
	white-space: normal;
	word-break: break-word;
	transition: opacity 0.2s ease, transform 0.15s ease;
}

.dtb-popup-btn:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.dtb-popup-btn-secondary {
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* Slim progress/countdown strip pinned to the very top of the card,
   sitting above the image — matches the reference implementation. */
.dtb-popup-progress-wrap {
	width: 100%;
	height: 5px;
	background: rgba(0, 0, 0, 0.15);
	overflow: hidden;
}

.dtb-popup-progress-bar {
	height: 100%;
	width: 100%;
	transform-origin: left center;
}

/* Product popup: same card shell, narrower, extra top padding to make
   room for the floating pill-style close button. */
.dtb-product-popup-card {
	max-width: 420px;
	padding: 34px 22px 22px;
	overflow: visible;
}

.dtb-product-popup-card .dtb-popup-body {
	padding: 0;
}

.dtb-product-popup-close {
	position: absolute;
	left: 50%;
	top: -18px;
	right: auto;
	transform: translateX(-50%);
	width: auto;
	height: auto;
	border-radius: 999px;
	padding: 8px 22px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	background: rgba(17, 24, 39, 0.55);
	color: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.35);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.dtb-product-popup-close:hover {
	background: rgba(17, 24, 39, 0.7);
}

.dtb-product-popup-card .dtb-popup-btn {
	border-radius: 10px;
	display: block;
	width: 100%;
	margin-top: 18px;
}

@media (max-width: 480px) {
	.dtb-popup-card,
	.dtb-product-popup-card {
		max-width: 100%;
	}

	.dtb-popup-body {
		padding: 20px 18px 18px;
	}

	/* 3+ buttons: stack full-width, one per row, for readability on small
	   screens. Pair (2 buttons) and single (1 button) layouts are left
	   alone here — they're handled below so 2 buttons keep sitting side
	   by side even on mobile, no matter how long their text is. */
	.dtb-popup-buttons:not(.dtb-popup-buttons-pair) {
		flex-direction: column;
	}

	.dtb-popup-buttons:not(.dtb-popup-buttons-pair) .dtb-popup-btn {
		width: 100%;
	}

	/* Exactly 2 buttons: always side by side, even on mobile. Long text
	   wraps and shrinks inside each button rather than pushing the pair
	   onto separate lines. */
	.dtb-popup-buttons-pair {
		flex-wrap: nowrap;
	}

	.dtb-popup-buttons-pair .dtb-popup-btn {
		flex: 1 1 0;
		width: auto;
		min-width: 0;
		padding: 10px 8px;
		font-size: 13px;
	}

	/* Coupon box: stack code above the Copy button rather than squeezing
	   both onto one line on narrow screens. */
	.dtb-popup-coupon {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
	}

	.dtb-popup-coupon-copy {
		width: 100%;
	}
}
