/* BF Popup - front-end. All colors come from CSS variables printed by PHP on #bfp. */

html.bfp-lock,
html.bfp-lock body { overflow: hidden !important; }

#bfp, #bfp * { box-sizing: border-box; }

#bfp {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px 12px;
	font-family: var(--bfp-font-body);
	-webkit-font-smoothing: antialiased;
	-webkit-text-size-adjust: 100%;
}
#bfp.is-open { display: flex; }

#bfp .bfp__overlay {
	position: absolute;
	inset: 0;
	background: var(--bfp-overlay);
	animation: bfp-fade .25s ease both;
}
#bfp.is-closing .bfp__overlay { animation: bfp-fade .18s ease reverse both; }

/* ---------------------------------------------------------------- Modal shell */
#bfp .bfp__modal {
	position: relative;
	display: none;
	width: 100%;
	max-width: 350px;
}
#bfp .bfp__modal.is-active { display: block; animation: bfp-in .28s cubic-bezier(.2,.8,.2,1) both; }
#bfp.is-closing .bfp__modal.is-active { animation: bfp-out .18s ease both; }

#bfp .bfp__modal:focus { outline: none; }
#bfp.bfp--desktop .bfp__modal--detail { max-width: 720px; }

#bfp .bfp__scroll {
	background: var(--bfp-popup-bg);
	border-radius: 24px;
	max-height: calc(100vh - 48px);
	max-height: calc(100dvh - 48px);
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

#bfp .bfp__close {
	position: absolute;
	z-index: 3;
	top: -17px;
	right: 40px;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--bfp-close-border);
	border-radius: 10px;
	background: var(--bfp-close-bg);
	cursor: pointer;
	transition: background .15s ease, transform .1s ease;
	-webkit-tap-highlight-color: transparent;
}
#bfp .bfp__close:hover { background: var(--bfp-close-bg-hover); }
#bfp .bfp__close:active { transform: scale(.94); }
#bfp .bfp__close:focus-visible { outline: 2px solid var(--bfp-input-border-focus); outline-offset: 2px; }
#bfp .bfp__close-img { width: 24px; height: 24px; display: block; object-fit: contain; }

/* ------------------------------------------------------------- Popup 1: form */
#bfp .bfp__form-wrap { padding: 24px 33px 28px; }
#bfp .bfp__hero { display: block; width: 100%; height: auto; margin: 0 0 12px; }
#bfp .bfp__form { margin: 0; padding: 0; }
#bfp .bfp__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

#bfp .bfp__field {
	display: flex;
	align-items: center;
	gap: 12px;
	height: 40px;
	margin: 0 0 8px;
	padding: 0 16px;
	background: var(--bfp-input-bg);
	border: 1px solid var(--bfp-input-border);
	border-radius: 12px;
	cursor: text;
	transition: border-color .15s ease, box-shadow .15s ease;
}
#bfp .bfp__field:focus-within { border-color: var(--bfp-input-border-focus); }
#bfp .bfp__field.is-error { border-color: var(--bfp-input-border-error); }

#bfp .bfp__icon { flex: 0 0 24px; width: 24px; height: 24px; display: block; object-fit: contain; }
#bfp .bfp__icon { transition: filter .15s ease; }
/* Clicked / typing (not on hover): the input icon turns black. */
#bfp .bfp__field:focus-within .bfp__icon--normal { filter: brightness(0); }
#bfp .bfp__icon--active { display: none; }
#bfp .bfp__field.has-active:focus-within .bfp__icon--normal { display: none; }
#bfp .bfp__field.has-active:focus-within .bfp__icon--active { display: block; }

#bfp input.bfp__input {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	outline: 0;
	box-shadow: none;
	background: transparent;
	color: var(--bfp-input-text);
	font: 400 16px/24px var(--bfp-font-body);
	-webkit-appearance: none;
	appearance: none;
}
#bfp input.bfp__input::placeholder { color: var(--bfp-input-placeholder); opacity: 1; }

#bfp .bfp__error {
	display: none;
	margin: 0 0 8px;
	color: var(--bfp-error-text);
	font: 400 13px/18px var(--bfp-font-body);
}
#bfp .bfp__error.is-visible { display: block; }

/* ------------------------------------------------------------------ Buttons */
#bfp .bfp__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: 100%;
	height: 40px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid transparent;
	border-radius: 12px;
	background: var(--bfp-btn-bg);
	color: var(--bfp-btn-text);
	font: 400 16px/24px var(--bfp-font-body);
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background .15s ease, transform .1s ease, opacity .15s ease;
	-webkit-tap-highlight-color: transparent;
}
#bfp .bfp__btn:hover { background: var(--bfp-btn-bg-hover); color: var(--bfp-btn-text); }
#bfp .bfp__btn:active { background: var(--bfp-btn-bg-active); transform: scale(.985); }
#bfp .bfp__btn:focus-visible { outline: 2px solid var(--bfp-text-main); outline-offset: 2px; }
#bfp .bfp__btn.is-loading { opacity: .7; pointer-events: none; }
#bfp .bfp__btn-icon { width: 24px; height: 24px; display: block; object-fit: contain; flex: 0 0 24px; }

#bfp .bfp__btn--secondary {
	display: none;
	background: var(--bfp-btn2-bg);
	color: var(--bfp-btn2-text);
	border-color: var(--bfp-btn2-border);
}
#bfp .bfp__btn--secondary:hover { background: var(--bfp-btn2-bg-hover); color: var(--bfp-btn2-text); }
#bfp .bfp__btn--secondary:active { background: var(--bfp-btn2-bg-active); }
#bfp.bfp--desktop .bfp__btn--secondary { display: flex; }

/* ----------------------------------------------------------------- Consent */
#bfp .bfp__consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 16px 0 0;
	cursor: pointer;
	color: var(--bfp-text-main);
	font: 400 12px/14px var(--bfp-font-body);
	position: relative;
}
#bfp .bfp__check {
	position: absolute;
	opacity: 0;
	width: 18px;
	height: 18px;
	margin: 0;
	pointer-events: none;
}
#bfp .bfp__box {
	position: relative;
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	background: var(--bfp-check-bg);
	border: 1px solid var(--bfp-check-border);
	border-radius: 5px;
	transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
#bfp .bfp__box::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 10px;
	border: solid var(--bfp-check-mark);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) scale(0);
	transition: transform .15s ease;
}
#bfp .bfp__consent:hover .bfp__box { border-color: var(--bfp-check-border-hover); }
#bfp .bfp__check:checked + .bfp__box { background: var(--bfp-check-bg-checked); border-color: var(--bfp-check-bg-checked); }
#bfp .bfp__check:checked + .bfp__box::after { transform: rotate(45deg) scale(1); }
#bfp .bfp__check:focus-visible + .bfp__box { box-shadow: 0 0 0 2px var(--bfp-input-border-focus); }
#bfp .bfp__consent.is-error .bfp__box { border-color: var(--bfp-input-border-error); box-shadow: 0 0 0 2px var(--bfp-input-border-error); }
#bfp .bfp__consent a,
#bfp .bfp__link-plain { color: var(--bfp-link); text-decoration: none; }
#bfp .bfp__consent a:hover { color: var(--bfp-link-hover); }

/* ----------------------------------------------------------- Popup 2: coupon */
#bfp .bfp__detail-wrap { padding: 24px 16px; }
#bfp .bfp__grid { display: flex; flex-direction: column; gap: 24px; }
#bfp .bfp__col { display: contents; }
#bfp .bfp__card    { order: 1; }
#bfp .bfp__howto   { order: 2; }
#bfp .bfp__terms   { order: 3; }
#bfp .bfp__actions { order: 4; }

#bfp .bfp__card {
	padding: 20px 12px 22px;
	text-align: center;
	background: var(--bfp-card-bg);
	border: 1px solid var(--bfp-card-border);
	border-radius: 16px;
}
#bfp .bfp__offer { display: flex; align-items: stretch; justify-content: center; gap: 6px; }
#bfp .bfp__num {
	color: var(--bfp-percent);
	font: 600 118px/96px var(--bfp-font-heading);
	letter-spacing: -.02em;
	height: 96px;
}
#bfp .bfp__side {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: space-between;
	padding: 4px 0 0;
}
#bfp .bfp__sign { color: var(--bfp-percent); font: 700 54px/40px var(--bfp-font-heading); }
#bfp .bfp__off  { color: var(--bfp-text-main); font: 700 30px/30px var(--bfp-font-heading); }
#bfp .bfp__offer--img { display: block; }
#bfp .bfp__offer-img { display: block; width: 176px; max-width: 70%; height: auto; margin: 0 auto; }
#bfp.bfp--desktop .bfp__offer-img { width: 200px; }
#bfp .bfp__title {
	margin: 10px 0 0;
	padding: 0;
	color: var(--bfp-text-main);
	font: 700 28px/34px var(--bfp-font-heading);
	letter-spacing: -.01em;
}
#bfp .bfp__date { margin: 6px 0 0; color: var(--bfp-text-muted); font: 400 16px/24px var(--bfp-font-body); }
#bfp .bfp__pill {
	display: inline-block;
	margin-top: 12px;
	padding: 7px 16px;
	border-radius: 10px;
	background: var(--bfp-pill-bg);
	color: var(--bfp-pill-text);
	font: 600 15px/18px var(--bfp-font-body);
}

#bfp .bfp__h {
	margin: 0 0 12px;
	padding: 0;
	color: var(--bfp-text-main);
	font: 700 20px/26px var(--bfp-font-heading);
	letter-spacing: -.01em;
}
#bfp .bfp__step { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; }
#bfp .bfp__step:last-child { margin-bottom: 0; }
#bfp .bfp__step-icon {
	flex: 0 0 36px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--bfp-step-circle-bg);
}
#bfp .bfp__step-img { width: 24px; height: 24px; display: block; object-fit: contain; }
#bfp .bfp__step-body { display: flex; flex-direction: column; min-width: 0; }
#bfp .bfp__step-title { color: var(--bfp-text-main); font: 400 16px/22px var(--bfp-font-body); }
#bfp .bfp__step-text  { color: var(--bfp-text-muted); font: 400 14px/22px var(--bfp-font-body); }
#bfp .bfp__terms-text { margin: 0; color: var(--bfp-text-muted); font: 400 12px/16px var(--bfp-font-body); }

#bfp .bfp__actions { display: flex; gap: 8px; }
#bfp .bfp__actions .bfp__btn { flex: 1 1 0; width: auto; }

/* Desktop: horizontal coupon popup */
#bfp.bfp--desktop .bfp__detail-wrap { padding: 24px; }
#bfp.bfp--desktop .bfp__grid { flex-direction: row; align-items: stretch; gap: 24px; }
#bfp.bfp--desktop .bfp__col { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; }
#bfp.bfp--desktop .bfp__col--left { justify-content: space-between; gap: 16px; }
#bfp.bfp--desktop .bfp__col--right { gap: 24px; }
#bfp.bfp--desktop .bfp__card,
#bfp.bfp--desktop .bfp__howto,
#bfp.bfp--desktop .bfp__terms,
#bfp.bfp--desktop .bfp__actions { order: 0; }
#bfp.bfp--desktop .bfp__close { right: 24px; }

/* Mobile coupon popup: compact so everything incl. Download fits on one screen without scrolling */
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__detail-wrap { padding: 14px 14px 16px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__grid { gap: 12px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__card { padding: 12px 10px 14px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__offer-img { width: 132px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__title { margin-top: 4px; font-size: 24px; line-height: 28px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__date { margin-top: 2px; font-size: 14px; line-height: 20px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__pill { margin-top: 8px; padding: 5px 14px; font-size: 14px; line-height: 18px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__h { margin-bottom: 8px; font-size: 18px; line-height: 22px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__step { gap: 8px; margin-bottom: 8px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__step-icon { flex-basis: 32px; width: 32px; height: 32px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__step-img { width: 20px; height: 20px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__step-title { font-size: 15px; line-height: 19px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__step-text { font-size: 13px; line-height: 17px; }
#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__terms-text { font-size: 11px; line-height: 14px; }

/* Short phones: squeeze a little more */
@media (max-height: 720px) {
	#bfp { padding: 16px 12px; }
	#bfp .bfp__scroll { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__detail-wrap { padding: 10px 12px 12px; }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__grid { gap: 8px; }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__card { padding: 8px 8px 10px; }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__offer-img { width: 104px; }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__title { font-size: 21px; line-height: 24px; }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__pill { margin-top: 6px; padding: 4px 12px; }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__h { margin-bottom: 6px; font-size: 16px; line-height: 20px; }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__step { margin-bottom: 6px; }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__step-text { font-size: 12px; line-height: 15px; }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__terms-text { font-size: 10px; line-height: 12px; }
	#bfp:not(.bfp--desktop) .bfp__modal--detail .bfp__btn { height: 36px; }
}

/* Hide the whole popup from print */
@media print { #bfp { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
	#bfp .bfp__overlay,
	#bfp .bfp__modal.is-active { animation: none; }
}

@keyframes bfp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bfp-in   { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes bfp-out  { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ----------------------------------------------------------------- Confetti */
#bfp .bfp__confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; display: block; }
