/* Simple Popup Ad — Frontend Styles v4.0 */

.popup{
  --lp-offset: 20px;
  --lp-radius: 16px;
  --lp-pad: 24px;
  --lp-close: 44px;
  --lp-accent: #2563eb;

  position: fixed;
  box-sizing: border-box;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15,15,20,.22), 0 4px 12px rgba(15,15,20,.08);
  z-index: 10000;
  border-radius: var(--lp-radius);
  overflow: hidden;
  max-width: 90vw;
  max-height: 85vh;
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color: #16181d;
  opacity: 0;
  pointer-events: none;
  transform: translateZ(0);
  transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .28s ease;
}
.popup.is-active{ opacity: 1; pointer-events: auto; }

@media (max-width: 768px){
  .popup{ --lp-offset: 12px; --lp-radius: 12px; --lp-pad: 16px; }
}

/* Image-only / bare mode: no chrome, transparent-PNG friendly */
.popup.popup--bare{ background: transparent!important; box-shadow: none!important; border-radius: 0!important; overflow: visible!important; }
.popup.popup--bare .popup-content{ padding: 0!important; overflow: visible; max-height: none; background: transparent; }
.popup.popup--bare .lp-ad-wrap--bare{ display: inline-block; line-height: 0; border-radius: 12px; overflow: hidden; }
.popup.popup--bare .lp-ad-wrap--bare img{ display: block; max-width: 100%; height: auto; border-radius: 12px; }
.popup.popup--bare .popup-close{ background: #fff; color: #16181d; top: -14px; right: -14px; }

.popup-overlay{
  position: fixed; inset: 0;
  background: rgba(12,12,16,.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity .28s ease;
}
.popup-overlay.is-active{ opacity: 1; pointer-events: auto; }

.popup-content{ overflow-y: auto; max-height: 85vh; -webkit-overflow-scrolling: touch; }

/* Close button — outside top-right corner, WCAG 2.5.5 44x44 touch target. */
.popup-close{
  position: absolute;
  top: -14px; right: -14px;
  width: var(--lp-close); height: var(--lp-close);
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; z-index: 20;
  background: #fff;
  color: #16181d;
  border-radius: 50%;
  font-size: 22px; line-height: 1;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  transition: transform .15s ease, background .15s ease;
}
.popup-close:hover{ background: #f5f5f5; transform: scale(1.08); }
.popup-close:focus-visible{ outline: 2px solid var(--lp-accent); outline-offset: 2px; }

.popup:not(.popup--fullscreen):not(.popup--bare){
  overflow: visible;
  margin: 14px;
}
.popup:not(.popup--fullscreen):not(.popup--bare) .popup-content{
  border-radius: inherit;
  overflow: hidden;
}

/* ---- Ad card markup ---- */
.lp-ad-wrap{ display: flex; flex-direction: column; text-align: center; }
.lp-ad-media{ position: relative; line-height: 0; background: #f1f2f4; }
.lp-ad-media img{ display: block; width: 100%; height: auto; }
.lp-ad-body{ padding: var(--lp-pad); }
.lp-ad-body > *:last-child{ margin-bottom: 0!important; }
/* When no title/desc/button, pad the image evenly on all sides */
.lp-ad-wrap--no-body{ padding: var(--lp-pad); }
.lp-ad-wrap--no-body .lp-ad-media{ background: transparent; }
.lp-ad-wrap--no-body .lp-ad-media img{ border-radius: calc(var(--lp-radius, 12px) - 4px); }
.lp-ad-title{ margin: 0 0 8px; font-size: 22px; line-height: 1.25; font-weight: 700; color: #16181d; }
.lp-ad-desc{ margin: 0 0 20px; font-size: 15px; line-height: 1.55; color: #5b6270; }
.lp-ad-btn{
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 28px;
  background: var(--lp-accent); color: #fff!important;
  text-decoration: none; border-radius: 999px;
  font-weight: 600; font-size: 15px; letter-spacing: .2px;
  box-shadow: 0 6px 16px rgba(37,99,235,.32);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.lp-ad-btn:hover{ transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 8px 20px rgba(37,99,235,.4); }
.lp-ad-btn:focus-visible{ outline: 2px solid var(--lp-accent); outline-offset: 3px; }

/* ---- Types ---- */
.popup--modal{ top: 50%; left: 50%; transform: translate(-50%,-50%) scale(.95); }
.popup--modal.is-active{ transform: translate(-50%,-50%) scale(1); }

/* ---- Bottom-only positions (floating & slide) ---- */
.popup--floating.popup--bottom-left,   .popup--slide.popup--bottom-left  { inset-block-end: var(--lp-offset); inset-inline-start: var(--lp-offset); }
.popup--floating.popup--bottom-center, .popup--slide.popup--bottom-center{ inset-block-end: var(--lp-offset); left: 50%; transform: translateX(-50%); }
.popup--floating.popup--bottom-right,  .popup--slide.popup--bottom-right { inset-block-end: var(--lp-offset); inset-inline-end: var(--lp-offset); }

/* Slide-in nudges from below */
.popup--slide.popup--bottom-left, .popup--slide.popup--bottom-right{ transform: translateY(24px); }
.popup--slide.popup--bottom-center{ transform: translate(-50%,24px); }
.popup--slide.popup--bottom-left.is-active, .popup--slide.popup--bottom-right.is-active{ transform: translateY(0); }
.popup--slide.popup--bottom-center.is-active{ transform: translate(-50%,0); }

/* ---- Sizes ---- */
.popup--xs{ width: clamp(200px, 20vw, 320px); }
.popup--small{ width: clamp(240px, 25vw, 380px); }
.popup--medium{ width: clamp(320px, 35vw, 560px); }
.popup--large{ width: clamp(400px, 50vw, 760px); }
.popup--xl{ width: clamp(480px, 70vw, 1100px); }
.popup--fullscreen{ width: 100%; height: 100%; inset: 0; max-width: 100vw; max-height: 100vh; border-radius: 0; transform: none; }
.popup--fullscreen .popup-content{ max-height: 100vh; height: 100%; }
.popup--auto{ width: auto; max-width: 90vw; }

@media (max-width: 480px){
  .popup:not(.popup--auto):not(.popup--bare):not(.popup--fullscreen){ width: 92vw!important; max-width: 400px; }
}

@media (prefers-reduced-motion: reduce){
  .popup, .popup-overlay, .popup-close, .lp-ad-btn{ transition: none!important; }
}
