/* Promotion Popup — storefront. Minimal, shadcn-inspired neutral design. */
.yayboost-promotion-popup {
  /* Design tokens (shadcn "zinc" light palette). */
  --ycp-background: #ffffff;
  --ycp-foreground: #09090b;
  --ycp-muted-foreground: #71717a;
  --ycp-border: #e4e4e7;
  --ycp-input: #e4e4e7;
  --ycp-ring: #18181b;
  --ycp-primary: #18181b;
  --ycp-primary-foreground: #fafafa;
  --ycp-primary-hover: #27272a;
  --ycp-destructive: #ef4444;
  --ycp-success: #16a34a;
  --ycp-radius: 8px;
  --ycp-radius-sm: 6px;

  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 16px;
  box-sizing: border-box;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ycp-foreground);
  -webkit-font-smoothing: antialiased;
}

.yayboost-promotion-popup *,
.yayboost-promotion-popup *::before,
.yayboost-promotion-popup *::after {
  box-sizing: border-box;
}

.yayboost-promotion-popup__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(9, 9, 11, 0.8);
}

/* Enter/exit animation. The popup starts hidden (overlay faded, card scaled
   down); JS toggles `.is-open` after the element is shown to play the enter
   transition, and removes it before display:none to play the exit. */
.yayboost-promotion-popup__overlay {
  opacity: 0;
  transition: opacity 0.22s ease;
}

.yayboost-promotion-popup__content {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.yayboost-promotion-popup.is-open .yayboost-promotion-popup__overlay {
  opacity: 1;
}

.yayboost-promotion-popup.is-open .yayboost-promotion-popup__content {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .yayboost-promotion-popup__overlay,
  .yayboost-promotion-popup__content {
    transition: none;
  }
}

.yayboost-promotion-popup__content {
  position: relative;
  z-index: 1;
  margin: auto;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  /* No padding: the builder's layout image sits flush to the card edges;
     content padding lives on .yayboost-cp-content. overflow clips the image to
     the rounded corners while still allowing tall content to scroll. */
  overflow: hidden auto;
  padding: 0;
  background: var(--ycp-background);
  border-radius: 12px;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.08),
    0 4px 6px -4px rgba(0, 0, 0, 0.08);
  text-align: left;
}

/* Circle popup: a true circle (equal width/height) with content centered and
   equal inset so it stays within the round edge. Content-only (no side image). */
.yayboost-promotion-popup__content[data-shape="circle"] {
  width: min(440px, 90vw);
  height: min(440px, 90vw);
  max-width: none;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yayboost-promotion-popup__content[data-shape="circle"] .yayboost-promotion-popup__builder,
.yayboost-promotion-popup__content[data-shape="circle"] .yayboost-cp-popup {
  width: 100%;
  height: 100%;
}

/* Content-only circle: inset the content to the inscribed square (nothing clips
   the curve) and center it. Circle + image keeps the standard content padding.
   Double class to outrank the base .yayboost-cp-content padding regardless of order. */
.yayboost-cp-content.yayboost-cp-content--circle {
  padding: 14% 16%;
  text-align: center;
}

/* ---- Visual builder output (renderer .yayboost-cp-* classes) ---- */

.yayboost-promotion-popup__builder {
  display: block;
  margin: 0;
}

/* Content column: consistent vertical rhythm + padding so text/fields sit away
   from the flush layout image and the card edges. */
.yayboost-cp-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
}

.yayboost-cp-block {
  margin: 0;
  min-width: 0;
}

.yayboost-promotion-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--ycp-muted-foreground);
  background: none;
  border: none;
  border-radius: var(--ycp-radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.yayboost-promotion-popup__close:hover {
  color: var(--ycp-foreground) !important;
  background-color: #f4f4f5 !important;
}

.yayboost-promotion-popup__close:focus-visible {
  outline: 2px solid var(--ycp-ring);
  outline-offset: 2px;
}

/* Error notification content rendered inside a shared toast card. The toast is
   in the toast-manager's DOM subtree (body level), outside the popup's variable
   scope, so use a literal colour rather than --ycp-destructive. */
/* shadcn "destructive" toast variant. `.yayboost-promotion-popup__toast` is
   added to the shared toast card (.yayboost-toast); it restyles the card and
   lays out the alert icon + message. Rendered outside the popup's variable
   scope, so colours are literal. */
.yayboost-toast.yayboost-promotion-popup__toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fef2f2; /* red-50 */
  border-color: #fecaca; /* red-200 */
  color: #b91c1c; /* red-700 */
}

.yayboost-promotion-popup__toast-icon {
  flex: none;
  color: #dc2626; /* red-600 */
}

.yayboost-promotion-popup__toast-msg {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.yayboost-cp-image-slot img {
  border-radius: 0;
}

@media (max-width: 640px) {
  /* Side-by-side layouts stack on small screens; keep the image on top. */
  .yayboost-cp-popup[data-content-layout="image_left"],
  .yayboost-cp-popup[data-content-layout="image_right"] {
    flex-direction: column !important;
  }

  .yayboost-cp-image-slot {
    flex: none !important;
    width: 100% !important;
    height: 170px !important;
    min-height: 0 !important;
  }

  .yayboost-cp-content {
    padding: 20px;
  }
}
