/* ============================================================
   Better Promotion — Exit popup
   Colours come from the banner's design tokens (banner.css);
   Halloween Night has its own scene below.
   ============================================================ */

.pbp {
  --pbp-cta-text: #120a2e;
  --pbp-radius: 20px;
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 16px; overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
  font-family: "Inter","Segoe UI",Arial,sans-serif;
  line-height: 1.3;
}
.pbp[hidden] { display: none; }
.pbp [hidden] { display: none !important; }
.pbp *, .pbp *::before, .pbp *::after { box-sizing: border-box; }
.pbp.pbp-is-open { opacity: 1; visibility: visible; transition: opacity .25s ease; }

.pbp-overlay {
  position: fixed; inset: 0;
  background: rgba(8,4,24,.68);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}

.pbp-dialog {
  position: relative; overflow: hidden;
  width: 100%; max-width: 480px; margin: auto; /* centred, but scrolls from the top on short screens */
  border-radius: var(--pbp-radius);
  background: var(--pb-bg);
  color: var(--pb-text);
  box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.08) inset, 0 0 60px var(--pb-glow);
  transform: translateY(16px) scale(.96);
  transition: transform .3s cubic-bezier(.2,.9,.3,1.2);
  outline: none;
}
.pbp.pbp-is-open .pbp-dialog { transform: none; }
.pbp-dialog::before {
  content: ""; position: absolute; inset: 0 auto auto 0; width: 180px; height: 180px; pointer-events: none;
  background-image: radial-gradient(circle, var(--pb-dots) 1.2px, transparent 1.2px);
  background-size: 13px 13px;
  -webkit-mask: radial-gradient(circle at 0 0, #000, transparent 70%); mask: radial-gradient(circle at 0 0, #000, transparent 70%);
}
.pbp-dialog::after {
  content: ""; position: absolute; left: 10%; right: 10%; top: -120px; height: 240px; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, var(--pb-glow), transparent 70%);
}

/* --- Decoration (four standard designs) --- */
.pbp-deco { position: absolute; inset: 0; pointer-events: none; }
.pbp-badge {
  position: absolute; top: 18px; right: 58px; width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  transform: rotate(12deg); opacity: .95;
}
.pbp-badge .pb-icon-svg { width: 44px; height: 48px; filter: drop-shadow(0 0 10px var(--pb-icon-glow)); }

/* --- Close --- */
.pbp-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 32px; height: 32px; margin: 0; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.45);
  color: var(--pb-text); cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.pbp-close:hover, .pbp-close:focus-visible { background: rgba(255,255,255,.18); border-color: #fff; transform: scale(1.08); }
.pbp-close svg { width: 12px; height: 12px; }

/* --- Body --- */
.pbp-body {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 14px; padding: 30px 28px 22px;
}

.pbp-product {
  display: inline-flex; align-items: center; gap: 10px;
  max-width: 100%; margin-top: 46px; /* centred, below the corner icon */
  align-self: center;
  padding: 6px 14px 6px 6px; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
}
.pbp-product-icon { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,.92); padding: 3px; }
.pbp-product-name { min-width: 0; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbp-product-name:empty { display: none; }
.pbp-product:has(.pbp-product-name:empty) { padding-right: 6px; }

.pbp-title { margin: 6px 0 0; font-size: 26px; font-weight: 800; line-height: 1.15; color: var(--pb-text); letter-spacing: -.01em; }
.pbp-text  { margin: -6px 0 0; font-size: 15px; color: var(--pb-muted); }
.pbp-title:empty, .pbp-text:empty { display: none; }
/* No product line: start below the corner icon / moon instead of beside it. */
.pbp-product[hidden] + .pbp-title { margin-top: 54px; }
.pbp[data-design="halloween_night"] .pbp-product[hidden] + .pbp-title { margin-top: 64px; }

.pbp-offer { font-size: 26px; font-weight: 700; line-height: 1.05; white-space: nowrap; }
.pbp-hl {
  display: inline-block; margin: 0 .12em;
  font-size: 58px; font-weight: 900; letter-spacing: -.02em; color: var(--pb-accent);
  text-shadow: 0 0 24px var(--pb-icon-glow);
}

.pbp-save {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 6px 16px; border-radius: 999px;
  border: 1.5px dashed var(--pb-box-border);
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--pb-muted);
}
.pbp-save strong { font-size: 20px; font-weight: 900; letter-spacing: 0; color: var(--pb-accent); }

/* --- Coupons --- */
.pbp-coupons { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.pbp-coupons-lbl { font-size: 13px; font-weight: 600; color: var(--pb-muted); }
.pbp-coupons-lbl:empty { display: none; }
.pbp-codes { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.pbp-code-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pbp-code-tag { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pb-accent); }
.pbp-code-tag:empty { display: none; }
.pbp-code {
  display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 10px 16px; border-radius: 10px;
  background: var(--pb-box-bg); border: 1.5px dashed var(--pb-box-border);
  color: var(--pb-text); font: inherit; font-size: 18px; font-weight: 800; letter-spacing: .14em;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 0 16px var(--pb-box-glow);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pbp-code:hover, .pbp-code:focus-visible { border-style: solid; box-shadow: 0 0 24px var(--pb-box-glow); outline: none; }
.pbp-code:active { transform: scale(.97); }
.pbp-code svg { color: var(--pb-copy); flex-shrink: 0; }
.pbp-ic-check { display: none; }
.pbp-code.pb-copied { border-color: rgba(124,252,158,.9); border-style: solid; }
.pbp-code.pb-copied .pbp-ic-copy { display: none; }
.pbp-code.pb-copied .pbp-ic-check { display: block; color: #7CFC9E; }

/* --- Countdown --- */
.pbp-timer { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pbp-timer-lbl { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pb-muted); }
.pbp-timer-lbl:empty { display: none; }
.pbp-countdown { display: flex; gap: 8px; }
.pbp-unit {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 62px; height: 62px; border-radius: 12px;
  background: var(--pb-num-bg); border: 1.5px solid var(--pb-box-border);
}
.pbp-num { font-size: 24px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.pbp-unit-lbl { margin-top: 5px; font-size: 9px; font-weight: 700; letter-spacing: .12em; color: var(--pb-muted); }

/* --- Buttons --- */
.pbp-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; margin-top: 4px; padding: 0 24px; border-radius: 12px;
  background: var(--pb-accent); color: var(--pbp-cta-text);
  font-size: 17px; font-weight: 800; text-decoration: none;
  box-shadow: 0 0 26px var(--pb-icon-glow), inset 0 -3px 0 rgba(0,0,0,.18);
  transition: transform .15s, filter .15s;
}
.pbp-cta:hover, .pbp-cta:focus-visible { color: var(--pbp-cta-text); transform: translateY(-1px); filter: brightness(1.06); }
.pbp-close:focus-visible, .pbp-cta:focus-visible, .pbp-code:focus-visible { outline: 2px solid var(--pb-accent); outline-offset: 3px; }

/* --- Per-design touches --- */
.pbp[data-design="black_friday"] .pbp-title { text-transform: uppercase; letter-spacing: .04em; }
.pbp[data-design="black_friday"] { --pbp-cta-text: #0b0b0b; }
.pbp[data-design="cyber_monday"] { --pbp-cta-text: #04102e; }
.pbp[data-design="cyber_monday"] .pbp-hl { color: transparent; background: linear-gradient(90deg, #22d3ee, #e879f9); -webkit-background-clip: text; background-clip: text; text-shadow: none; filter: drop-shadow(0 0 14px rgba(34,211,238,.5)); }
.pbp[data-design="halloween"] { --pbp-cta-text: #1f0730; }

/* ============================================================
   Halloween Night
   ============================================================ */
.pbp[data-design="halloween_night"] {
  --pb-bg:
    radial-gradient(ellipse 320px 200px at 50% 112%, rgba(249,115,22,.34), rgba(249,115,22,0) 72%),
    radial-gradient(ellipse 280px 200px at 50% -20%, rgba(167,105,255,.28), rgba(167,105,255,0) 70%),
    linear-gradient(180deg, #160728 0%, #2A0D4E 45%, #36105C 75%, #1C0833 100%);
  --pb-text: #F5EEFF;
  --pb-muted: #D9C8F5;
  --pb-accent: #FFB547;
  --pb-icon-glow: rgba(255,150,40,.55);
  --pb-glow: rgba(167,105,255,.3);
  --pb-dots: transparent;
  --pb-box-bg: linear-gradient(180deg, rgba(42,12,72,.85), rgba(20,6,36,.85));
  --pb-box-border: #F97316;
  --pb-box-glow: rgba(249,115,22,.35);
  --pb-num-bg: linear-gradient(180deg, rgba(64,22,108,.92) 0%, rgba(44,14,78,.92) 50%, rgba(22,6,40,.94) 50%, rgba(14,4,26,.94) 100%);
  --pb-copy: #FFB547;
  --pbp-cta-text: #1B0933;
  font-family: "Sora", system-ui, sans-serif;
}
.pbp[data-design="halloween_night"] .pbp-dialog { border: 1px solid rgba(216,194,255,.22); }
.pbp[data-design="halloween_night"] .pbp-product { margin-top: 56px; /* below the moon */ }
.pbp-night { position: absolute; inset: 0; pointer-events: none; }
.pbp-moon {
  position: absolute; top: 20px; right: 62px; width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #FFF1DA 0%, #FBC89A 42%, #E9A0B8 74%, #B88AE6 100%);
  box-shadow: 0 0 34px rgba(255,190,140,.55), 0 0 80px rgba(200,140,255,.25);
}
.pbp-moon i { position: absolute; border-radius: 50%; background: rgba(180,110,120,.17); }
.pbp-moon i:nth-child(1) { left: 14px; top: 34px; width: 10px; height: 10px; }
.pbp-moon i:nth-child(2) { left: 40px; top: 16px; width: 8px; height: 8px; }
.pbp-moon i:nth-child(3) { left: 40px; top: 40px; width: 13px; height: 13px; }
.pbp-bat--1 { top: 30px; right: 140px; width: 24px; height: 12px; animation: pbnBat 1.6s ease-in-out infinite; }
.pbp-bat--2 { top: 64px; right: 32px; width: 16px; height: 8px; animation: pbnBat 1.2s ease-in-out infinite; }
.pbp-bat--3 { top: 96px; left: 26px; width: 18px; height: 9px; animation: pbnBat 1.4s ease-in-out infinite; }
.pbp-ground { position: absolute; left: 0; bottom: 0; width: 100%; height: 40px; fill: #120419; opacity: .75; }
.pbp[data-design="halloween_night"] .pbp-body { padding-bottom: 40px; }
.pbp[data-design="halloween_night"] .pbp-title,
.pbp[data-design="halloween_night"] .pbp-offer {
  font-family: "Creepster", cursive; font-weight: 400; letter-spacing: .04em;
  text-shadow: 0 0 16px rgba(214,190,255,.45), 0 2px 0 rgba(42,11,71,.6);
}
.pbp[data-design="halloween_night"] .pbp-title { font-size: 34px; margin-top: 14px; }
.pbp[data-design="halloween_night"] .pbp-offer { font-size: 30px; }
.pbp[data-design="halloween_night"] .pbp-hl {
  font-size: 64px; font-weight: 400;
  background: linear-gradient(180deg, #FFF0A8 0%, #FFC23D 45%, #FF8A1F 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 0 10px rgba(255,150,40,.6));
}
.pbp[data-design="halloween_night"] .pbp-save { border-color: rgba(255,181,71,.65); background: linear-gradient(180deg, rgba(255,167,51,.16), rgba(249,115,22,.06)); }
.pbp[data-design="halloween_night"] .pbp-code { border-style: solid; }
.pbp[data-design="halloween_night"] .pbp-cta {
  border-radius: 999px;
  background: linear-gradient(180deg, #FFDA6B 0%, #FFB03B 55%, #FF9324 100%);
  box-shadow: 0 0 24px rgba(255,167,51,.6), inset 0 -3px 0 rgba(154,52,18,.3), inset 0 1px 0 rgba(255,255,255,.6);
}

/* --- Dashboard preview: inline, always open --- */
.pbp[data-preview] {
  position: relative; inset: auto; z-index: auto;
  opacity: 1; visibility: visible; transition: none;
  padding: 0 20px 24px;
}
.pbp[data-preview] .pbp-overlay { display: none; }
.pbp[data-preview] { overflow: visible; }
.pbp[data-preview] .pbp-dialog { transform: none; transition: none; }

/* --- Small screens --- */
@media (max-width: 480px) {
  .pbp { padding: 12px; }
  .pbp-body { padding: 24px 18px 18px; gap: 12px; }
  .pbp-title { font-size: 22px; }
  .pbp-text { font-size: 14px; }
  .pbp-offer { font-size: 21px; }
  .pbp-hl { font-size: 46px; }
  .pbp-badge { right: 50px; top: 14px; transform: rotate(12deg) scale(.8); }
  .pbp-code { font-size: 15px; padding: 9px 12px; letter-spacing: .1em; }
  .pbp-unit { width: 52px; height: 54px; }
  .pbp-num { font-size: 20px; }
  .pbp[data-design="halloween_night"] .pbp-title { font-size: 28px; }
  .pbp[data-design="halloween_night"] .pbp-hl { font-size: 52px; }
  .pbp-moon { right: 52px; width: 50px; height: 50px; }
  .pbp-moon i { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pbp, .pbp-dialog { transition: none !important; }
  .pbp *, .pbp *::after { animation: none !important; }
}
