/* =========================================================
   KP Top Bar — front-end styles
   Every color and size comes from CSS variables set per banner.
   ========================================================= */
.kptb {
	display: none;
	position: relative;
	z-index: 99990;
	width: 100%;
	box-sizing: border-box;
	color: var(--kptb-text, #fff);
	font-family: inherit;
	font-size: var(--kptb-fs, 15px);
	line-height: 1.4;
	text-align: left;
}
.kptb *,
.kptb *::before,
.kptb *::after { box-sizing: border-box; }
.kptb-preview-wrap .kptb { display: block; }

.kptb__inner {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 10px 16px;
	padding: var(--kptb-pad, 10px) max(52px, calc((100% - var(--kptb-maxw, 1200px)) / 2)) var(--kptb-pad, 10px) max(20px, calc((100% - var(--kptb-maxw, 1200px)) / 2));
	background: var(--kptb-bg, #111);
	border-bottom: var(--kptb-bw, 0) solid var(--kptb-border, transparent);
	border-radius: var(--kptb-radius, 0);
	overflow: hidden;
}

/* ---------- Card layout (notice box with space around) ---------- */
.kptb--card { padding: 14px 16px; background: transparent; }
.kptb--card .kptb__inner {
	max-width: var(--kptb-maxw, 1200px);
	margin: 0 auto;
	padding: var(--kptb-pad, 14px) 52px var(--kptb-pad, 14px) 20px;
	border: var(--kptb-bw, 1px) solid var(--kptb-border, transparent);
}

/* ---------- Shadows ---------- */
.kptb--sh-soft .kptb__inner { box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.kptb--sh-strong .kptb__inner { box-shadow: 0 12px 32px rgba(0, 0, 0, .2); }

/* ---------- Alignment ---------- */
.kptb__main {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px 12px;
	min-width: 0;
	text-align: center;
}
.kptb--al-left .kptb__inner { justify-content: flex-start; }
.kptb--al-left .kptb__main { justify-content: flex-start; text-align: left; }
.kptb--al-split .kptb__inner { justify-content: space-between; flex-wrap: nowrap; }
.kptb--al-split .kptb__main { flex: 1 1 auto; justify-content: flex-start; text-align: left; flex-wrap: nowrap; }

/* ---------- Content parts ---------- */
.kptb__icon {
	display: inline-flex;
	flex: none;
	align-items: center;
	color: var(--kptb-accent, #ff6a00);
}
.kptb__icon--emoji { font-size: 1.35em; line-height: 1; }
.kptb__icon img { display: block; width: 24px; height: 24px; object-fit: contain; }

.kptb__badge {
	display: inline-block;
	flex: none;
	padding: 3px 8px;
	background: var(--kptb-accent, #ff6a00);
	color: var(--kptb-on-accent, #fff);
	border-radius: min(var(--kptb-radius, 0px), 4px);
	font-size: .78em;
	font-weight: 800;
	letter-spacing: .08em;
	text-transform: uppercase;
	white-space: nowrap;
}
.kptb__text { min-width: 0; }
.kptb__title { font-weight: 700; }
.kptb__text strong, .kptb__text b { font-weight: 700; }

/* ---------- Countdown ---------- */
.kptb__timer { flex: none; font-size: .9em; white-space: nowrap; }
.kptb__timer[hidden] { display: none !important; }
.kptb__clock { font-weight: 700; color: var(--kptb-accent, #ff6a00); font-variant-numeric: tabular-nums; }
.kptb__timer--boxes { display: inline-flex; align-items: center; gap: 8px; }
.kptb__timer--boxes .kptb__clock { display: inline-flex; gap: 4px; color: inherit; }
.kptb__unit {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	min-width: 36px;
	padding: 3px 4px;
	background: rgba(0, 0, 0, .22);
	border-radius: min(var(--kptb-radius, 0px), 4px);
	line-height: 1.1;
}
.kptb__unit b { font-size: 1.05em; color: var(--kptb-text, #fff); }
.kptb__unit i { font-size: .6em; font-style: normal; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Actions: coupon + button ---------- */
.kptb__actions { display: flex; flex: none; align-items: center; gap: 10px; }
.kptb__actions:empty { display: none; }

.kptb__coupon {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: .35em .75em;
	background: transparent;
	color: inherit;
	border: 1.5px dashed var(--kptb-accent, #ff6a00);
	border-radius: min(var(--kptb-radius, 0px), 6px);
	font: inherit;
	font-size: .88em;
	line-height: 1.2;
	cursor: pointer;
	white-space: nowrap;
	box-shadow: none;
}
.kptb__coupon b { color: var(--kptb-accent, #ff6a00); letter-spacing: .06em; }
.kptb__cpy { font-size: .78em; font-weight: 700; text-transform: uppercase; opacity: .85; }
.kptb__coupon:hover { background: rgba(127, 127, 127, .12); }
.kptb__coupon.is-copied .kptb__cpy { opacity: 1; color: var(--kptb-accent, #ff6a00); }

.kptb .kptb__cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: .5em 1.05em;
	background: var(--kptb-btn-bg, #ff6a00);
	color: var(--kptb-btn-text, #fff) !important;
	border: 2px solid var(--kptb-btn-bg, #ff6a00);
	border-radius: min(var(--kptb-radius, 0px), 6px);
	font-size: .93em;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none !important;
	white-space: nowrap;
	box-shadow: none !important;
	transition: transform .15s ease, filter .15s ease;
}
.kptb--btn-pill .kptb__cta { border-radius: 999px; }
.kptb--btn-outline .kptb__cta { background: transparent; border-color: var(--kptb-btn-text, #fff); }
.kptb--btn-link .kptb__cta { padding: 0; background: none; border: 0; text-decoration: underline !important; text-underline-offset: 3px; }
.kptb .kptb__cta:hover,
.kptb--clickall .kptb__inner:hover .kptb__cta { filter: brightness(1.08); transform: translateX(2px); }
.kptb .kptb__cta:focus-visible { outline: 2px solid var(--kptb-accent, #ff6a00); outline-offset: 2px; }

/* Whole banner clickable: an invisible link layer covers the banner. */
.kptb__overlay { position: absolute; inset: 0; z-index: 1; display: block; }
.kptb__overlay:focus-visible { outline: 2px solid var(--kptb-accent, #ff6a00); outline-offset: -3px; }
.kptb .kptb__cta { position: relative; z-index: 2; }
.kptb--clickall .kptb__inner:hover .kptb__text { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---------- Close button ---------- */
.kptb__close {
	position: absolute;
	z-index: 3;
	top: 50%;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	transform: translateY(-50%);
	background: transparent;
	color: var(--kptb-close, currentColor);
	border: 0;
	border-radius: min(var(--kptb-radius, 0px), 6px);
	cursor: pointer;
	opacity: .75;
	box-shadow: none;
}
.kptb__close:hover,
.kptb__close:focus-visible { opacity: 1; background: rgba(127, 127, 127, .18); }

/* ---------- Image banner ---------- */
.kptb--image .kptb__inner { display: block; padding: 0; background: none; border: 0; }
.kptb--image.kptb--card .kptb__inner { overflow: hidden; }
.kptb__imglink { position: static; display: block; line-height: 0; }
.kptb__img { display: block; width: 100%; height: auto; margin: 0 auto; }
.kptb--image .kptb__close { top: 8px; transform: none; background: rgba(0, 0, 0, .5); color: #fff; opacity: .9; }

/* ---------- Positions ---------- */
.kptb--pos-sticky { position: sticky; top: 0; }
.admin-bar .kptb--pos-sticky { top: 32px; }
@media (max-width: 782px) { .admin-bar .kptb--pos-sticky { top: 46px; } }
@media (max-width: 600px) { .admin-bar .kptb--pos-sticky { top: 0; } }
.kptb--pos-bottom { position: fixed; left: 0; right: 0; bottom: 0; }
.kptb--pos-bottom.kptb--card { padding-bottom: 16px; }
.kptb--pos-bottom.kptb--bar .kptb__inner { border-bottom: 0; border-top: var(--kptb-bw, 0) solid var(--kptb-border, transparent); }
.kptb-wait { visibility: hidden; opacity: 0; pointer-events: none; }
.kptb--pos-bottom { transition: opacity .3s ease; }

/* Admin preview + gallery: always in the normal flow. */
.kptb-preview-wrap .kptb { position: relative !important; top: auto !important; bottom: auto !important; z-index: 1; }

/* ---------- Admin "preview" tag ---------- */
.kptb__tag {
	display: none;
	position: absolute;
	z-index: 4;
	left: 8px;
	bottom: -20px;
	padding: 2px 8px;
	background: #fff3cd;
	color: #664d03;
	font-size: 11px;
	font-weight: 600;
	line-height: 16px;
}

/* ---------- Show animations ---------- */
.kptb--anim-slide .kptb__inner { animation: kptbSlideDown .45s ease both; }
.kptb--pos-bottom.kptb--anim-slide .kptb__inner { animation-name: kptbSlideUp; }
.kptb--anim-fade .kptb__inner { animation: kptbFade .5s ease both; }
@keyframes kptbSlideDown { from { transform: translateY(-100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes kptbSlideUp { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes kptbFade { from { opacity: 0; } to { opacity: 1; } }

.kptb--pulse .kptb__cta { animation: kptbPulse 2.2s ease-in-out infinite; }
@keyframes kptbPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ---------- Celebration effects ---------- */
.kptb__fx { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.kptb__p {
	position: absolute;
	top: -24px;
	display: block;
	will-change: transform;
	animation: kptbFall linear infinite;
}
.kptb__p--confetti { width: 6px; height: 10px; }
.kptb__p--snow { width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: .85; }
.kptb__p--emoji { font-size: 15px; line-height: 1; }
.kptb__p--spark {
	top: auto;
	width: 10px;
	height: 10px;
	background: var(--kptb-accent, #ffd700);
	clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
	animation-name: kptbTwinkle;
	animation-timing-function: ease-in-out;
}
@keyframes kptbFall {
	from { transform: translate3d(0, 0, 0) rotate(0deg); }
	to { transform: translate3d(var(--dx, 20px), 220px, 0) rotate(var(--rot, 360deg)); }
}
@keyframes kptbTwinkle {
	0%, 100% { transform: scale(0) rotate(0deg); opacity: 0; }
	50% { transform: scale(1) rotate(90deg); opacity: 1; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.kptb { font-size: calc(var(--kptb-fs, 15px) - 1px); }
	.kptb__inner { gap: 6px 10px; padding: 8px 44px 8px 12px; }
	.kptb--card { padding: 10px 10px; }
	.kptb--card .kptb__inner { padding: 10px 44px 10px 12px; }
	.kptb--al-split .kptb__inner { flex-wrap: wrap; justify-content: flex-start; }
	.kptb--al-split .kptb__main { flex-wrap: wrap; }
	.kptb__main { gap: 6px 8px; }
	.kptb--al-split .kptb__text,
	.kptb--al-left .kptb__text { flex: 1 1 200px; }
	.kptb--al-split .kptb__timer,
	.kptb--al-left .kptb__timer { flex-basis: 100%; }
	.kptb__badge { font-size: .7em; padding: 2px 6px; }
	.kptb__close { right: 4px; }
	.kptb--image .kptb__inner { padding: 0; }
}

/* Less motion for people who ask for it. */
@media (prefers-reduced-motion: reduce) {
	.kptb__fx { display: none; }
	.kptb .kptb__inner,
	.kptb .kptb__cta { animation: none !important; transition: none !important; }
}

@media print { .kptb { display: none !important; } }
