/* ═══════════════════════════════════════════════════════════════
   Newsletter Discount Banner v2 – Public Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables (overridden inline per campaign) ─────────────── */
:root {
  --ndb-bg:      #1a1a2e;
  --ndb-text:    #ffffff;
  --ndb-accent:  #e94560;
  --ndb-width:   380px;
  --ndb-radius:  14px;
  --ndb-z:       999999;
}

/* ── Utilities ───────────────────────────────────────────────────── */
.ndb-hidden { display: none !important; }

/* ── Overlay (center modal) ──────────────────────────────────────── */
.ndb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  z-index: calc(var(--ndb-z) - 1);
  animation: ndbFadeIn .3s ease forwards;
}

/* ═══════════════════════════════════
   POPUP / SLIDE-IN BANNER
   ═══════════════════════════════════ */
.ndb-banner {
  position: fixed;
  z-index: var(--ndb-z);
  width: var(--ndb-width);
  max-width: calc(100vw - 20px);
  background: var(--ndb-bg);
  color: var(--ndb-text);
  border-radius: var(--ndb-radius);
  box-shadow: 0 24px 64px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.2);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  transition: opacity .3s ease;
}

/* Positions */
.ndb-bottom-right  { bottom: 20px; right: 20px; }
.ndb-bottom-left   { bottom: 20px; left:  20px; }
.ndb-bottom-center { bottom: 20px; left: 50%; transform: translateX(-50%); }
.ndb-top-right     { top: 20px; right: 20px; }
.ndb-top-left      { top: 20px; left:  20px; }
.ndb-center {
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

/* ── Entry Animations ──────────────────────────────────────────── */
@keyframes ndbSlideUp   { from { opacity:0; transform:translateY(30px) } to { opacity:1; transform:translateY(0) } }
@keyframes ndbSlideDown { from { opacity:0; transform:translateY(-30px) } to { opacity:1; transform:translateY(0) } }
@keyframes ndbFadeIn    { from { opacity:0 } to { opacity:1 } }
@keyframes ndbPop       {
  from { opacity:0; transform:translate(-50%,-50%) scale(.85) }
  to   { opacity:1; transform:translate(-50%,-50%) scale(1) }
}
@keyframes ndbSpinAnim  { to { transform: rotate(360deg) } }

.ndb-visible.ndb-bottom-right,
.ndb-visible.ndb-bottom-left,
.ndb-visible.ndb-bottom-center { animation: ndbSlideUp .45s cubic-bezier(.175,.885,.32,1.275) forwards; }

.ndb-visible.ndb-top-right,
.ndb-visible.ndb-top-left      { animation: ndbSlideDown .45s cubic-bezier(.175,.885,.32,1.275) forwards; }

.ndb-visible.ndb-center        { animation: ndbPop .4s cubic-bezier(.175,.885,.32,1.275) forwards; }

/* ── Close button ─────────────────────────────────────────────── */
.ndb-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  background: rgba(255,255,255,.18);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
  z-index: 2;
}
.ndb-close:hover  { background: rgba(255,255,255,.32); }
.ndb-close:focus  { outline: 2px solid var(--ndb-accent); outline-offset: 2px; }

/* ── Image ────────────────────────────────────────────────────── */
.ndb-img-wrap img {
  width: 100%;
  max-height: 175px;
  object-fit: cover;
  display: block;
}

/* ── Body ─────────────────────────────────────────────────────── */
.ndb-body { padding: 26px 26px 20px; }

/* Badge */
.ndb-badge {
  display: inline-block;
  background: var(--ndb-accent);
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  padding: 4px 18px;
  border-radius: 40px;
  margin-bottom: 12px;
}

/* Title / Subtitle */
.ndb-title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ndb-text);
}
.ndb-subtitle {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.65;
  opacity: .85;
  color: var(--ndb-text);
}

/* Input */
.ndb-input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.25);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  box-sizing: border-box;
  margin-bottom: 10px;
  outline: none;
  transition: border-color .2s;
}
.ndb-input::placeholder { color: rgba(255,255,255,.45); }
.ndb-input:focus { border-color: var(--ndb-accent); }

/* GDPR checkbox */
.ndb-gdpr-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  cursor: pointer;
}
.ndb-gdpr-label input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--ndb-accent);
}
.ndb-gdpr-text {
  font-size: 11px;
  line-height: 1.5;
  opacity: .75;
  color: var(--ndb-text);
}
.ndb-gdpr-text a { color: var(--ndb-accent); }

/* CTA Button */
.ndb-btn {
  width: 100%;
  padding: 13px;
  background: var(--ndb-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter .2s, transform .15s;
}
.ndb-btn:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.ndb-btn:focus { outline: 2px solid rgba(255,255,255,.7); outline-offset: 2px; }
.ndb-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* Spinner */
.ndb-spinner {
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ndbSpinAnim .7s linear infinite;
}

/* Message */
.ndb-msg {
  font-size: 12.5px;
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 6px;
  text-align: center;
}
.ndb-msg.is-error   { background: rgba(255,70,70,.2);  color: #ff9090; }
.ndb-msg.is-success { background: rgba(60,220,100,.15); color: #7eff9e; }

/* Success state */
.ndb-success { text-align: center; padding: 8px 0 4px; }
.ndb-success-icon { font-size: 44px; margin-bottom: 10px; }
.ndb-success p { color: var(--ndb-text); font-size: 15px; line-height: 1.6; margin: 0; }

/* Privacy note */
.ndb-privacy {
  font-size: 11px;
  opacity: .45;
  text-align: center;
  margin: 14px 0 0;
  color: var(--ndb-text);
}

/* Urgency / Countdown */
.ndb-urgency {
  margin-top: 12px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ndb-accent);
  font-weight: 600;
  letter-spacing: .3px;
  min-height: 18px;
}

/* ═══════════════════════════════════
   TOP BAR
   ═══════════════════════════════════ */
.ndb-banner.ndb-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  width: 100%;
  max-width: 100%;
  border-radius: 0;
  z-index: var(--ndb-z);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

.ndb-topbar.ndb-visible {
  animation: ndbSlideDown .4s cubic-bezier(.175,.885,.32,1.275) forwards;
}

.ndb-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 10px 60px 10px 20px;
  min-height: 50px;
}

.ndb-topbar-badge {
  background: var(--ndb-accent);
  color: #fff;
  padding: 3px 14px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

.ndb-topbar-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ndb-text);
  white-space: nowrap;
}

.ndb-topbar-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ndb-input-topbar {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: border-color .2s;
}
.ndb-input-topbar::placeholder { color: rgba(255,255,255,.5); }
.ndb-input-topbar:focus { border-color: var(--ndb-accent); }

.ndb-btn-topbar {
  padding: 7px 18px;
  background: var(--ndb-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .2s;
}
.ndb-btn-topbar:hover { filter: brightness(1.1); }

.ndb-gdpr-inline {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ndb-text);
  opacity: .75;
  cursor: pointer;
}
.ndb-gdpr-inline input { accent-color: var(--ndb-accent); }

.ndb-topbar .ndb-close {
  position: absolute;
  top: 50%; right: 14px;
  transform: translateY(-50%);
}

.ndb-topbar .ndb-msg {
  width: 100%;
  text-align: center;
  padding: 4px 0;
  font-size: 12px;
  margin: 0;
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .ndb-banner:not(.ndb-topbar) {
    width: calc(100vw - 16px) !important;
    bottom: 8px !important;
    right: 8px !important;
    left: 8px !important;
    top: auto !important;
    transform: none !important;
  }
  .ndb-banner.ndb-visible.ndb-center {
    animation: ndbSlideUp .4s cubic-bezier(.175,.885,.32,1.275) forwards;
  }
  .ndb-topbar-inner { padding: 10px 50px 10px 12px; }
  .ndb-topbar-text  { display: none; }
  .ndb-input-topbar { width: 160px; }
}

/* ═══════════════════════════════════
   v3 ANIMATION VARIANTS
   ═══════════════════════════════════ */

/* Slide (default – overrides position-specific animations) */
.ndb-visible.ndb-anim-slide.ndb-bottom-right,
.ndb-visible.ndb-anim-slide.ndb-bottom-left,
.ndb-visible.ndb-anim-slide.ndb-bottom-center { animation: ndbSlideUp   .45s cubic-bezier(.175,.885,.32,1.275) forwards; }
.ndb-visible.ndb-anim-slide.ndb-top-right,
.ndb-visible.ndb-anim-slide.ndb-top-left       { animation: ndbSlideDown .45s cubic-bezier(.175,.885,.32,1.275) forwards; }
.ndb-visible.ndb-anim-slide.ndb-center         { animation: ndbPop .4s cubic-bezier(.175,.885,.32,1.275) forwards; }

/* Fade */
.ndb-visible.ndb-anim-fade { animation: ndbFadeIn .5s ease forwards !important; }

/* Bounce */
@keyframes ndbBounce {
  0%   { opacity:0; transform:scale(.3) }
  50%  { opacity:1; transform:scale(1.07) }
  70%  { transform:scale(.96) }
  100% { opacity:1; transform:scale(1) }
}
.ndb-visible.ndb-anim-bounce { animation: ndbBounce .6s ease forwards !important; }
.ndb-visible.ndb-anim-bounce.ndb-center {
  animation: ndbBounce .6s ease forwards !important;
  transform: translate(-50%,-50%) scale(1);
}

/* Zoom */
@keyframes ndbZoomIn {
  from { opacity:0; transform:scale(.6) }
  to   { opacity:1; transform:scale(1) }
}
@keyframes ndbZoomInCenter {
  from { opacity:0; transform:translate(-50%,-50%) scale(.6) }
  to   { opacity:1; transform:translate(-50%,-50%) scale(1) }
}
.ndb-visible.ndb-anim-zoom { animation: ndbZoomIn .4s cubic-bezier(.25,.46,.45,.94) forwards !important; }
.ndb-visible.ndb-anim-zoom.ndb-center { animation: ndbZoomInCenter .4s cubic-bezier(.25,.46,.45,.94) forwards !important; }
