/**
 * Smart Popup Notice Pro v3.1 - Contrast-Safe & Theme-Font Inherited Stylesheet
 * Zero external font files loaded - 100% inherits active WordPress theme typography
 */

.pnp-overlay,
.pnp-overlay *,
.pnp-modal-card,
.pnp-title,
.pnp-subtitle,
.pnp-modal-body,
.pnp-checkbox-text,
.pnp-btn-primary,
.pnp-btn-secondary {
  font-family: inherit !important;
  box-sizing: border-box;
}

html.pnp-scroll-lock,
html.pnp-scroll-lock body {
  overflow: hidden !important;
}

.pnp-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: rgba(8, 12, 22, var(--pnp-overlay-opacity, 0.7));
  backdrop-filter: blur(var(--pnp-blur, 12px));
  -webkit-backdrop-filter: blur(var(--pnp-blur, 12px));
  opacity: 0;
  visibility: hidden;
  /* visibility flips only after the fade-out ends... */
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.3s;
}

/* `display:flex` above would otherwise override the [hidden] attribute */
.pnp-overlay[hidden] {
  display: none !important;
}

.pnp-overlay.pnp-visible {
  opacity: 1;
  visibility: visible;
  /* ...but instantly on open, so focus can move into the dialog right away */
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
}

/* ---------- Positions ---------- */

/* Corner toasts: no dark backdrop, the page stays usable behind them */
.pnp-overlay.pnp-pos-bottom-right,
.pnp-overlay.pnp-pos-bottom-left {
  align-items: flex-end;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

.pnp-overlay.pnp-pos-bottom-right .pnp-modal-card,
.pnp-overlay.pnp-pos-bottom-left .pnp-modal-card {
  pointer-events: auto;
  max-width: min(var(--pnp-width, 540px), 420px);
}

/* dir="rtl": flex-start = right edge */
.pnp-overlay.pnp-pos-bottom-right {
  justify-content: flex-start;
}

.pnp-overlay.pnp-pos-bottom-left {
  justify-content: flex-end;
}

.pnp-overlay.pnp-pos-bottom-sheet {
  align-items: flex-end;
  padding: 0;
}

.pnp-overlay.pnp-pos-bottom-sheet .pnp-modal-card {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  transform: translateY(40px);
}

/* ---------- Card ---------- */

.pnp-modal-card {
  position: relative;
  width: 100%;
  max-width: var(--pnp-width, 540px);
  /* Always fits the viewport so the accept button can never be pushed off-screen */
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  background-color: var(--pnp-bg, #ffffff);
  color: var(--pnp-text, #0f172a);
  border-radius: var(--pnp-radius, 20px);
  padding: 26px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(148, 163, 184, 0.22);
  transform: scale(0.94) translateY(14px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  outline: none;
}

.pnp-overlay.pnp-pos-bottom-sheet .pnp-modal-card {
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
}

.pnp-overlay.pnp-visible .pnp-modal-card {
  transform: scale(1) translateY(0);
}

.pnp-modal-card > * {
  flex-shrink: 0;
}

.pnp-preset-woo-checkout .pnp-modal-card {
  border-top: 5px solid var(--pnp-primary, #7c3aed);
}

.pnp-preset-luxury-dark .pnp-modal-card {
  border: 1px solid rgba(234, 179, 8, 0.45);
}

.pnp-preset-cyber-neon .pnp-modal-card {
  border: 1.5px solid var(--pnp-primary, #10b981);
}

.pnp-preview-ribbon {
  margin: -26px -26px 16px -26px;
  padding: 7px 14px;
  background: repeating-linear-gradient(45deg, #fde68a, #fde68a 10px, #fcd34d 10px, #fcd34d 20px);
  color: #78350f;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.pnp-close-x {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.12);
  color: var(--pnp-text, #0f172a);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.pnp-close-x:hover {
  background: rgba(148, 163, 184, 0.25);
}

.pnp-banner-wrap {
  margin: -26px -26px 20px -26px;
  max-height: 185px;
  overflow: hidden;
  flex-shrink: 1;
  min-height: 0;
}

.pnp-preview-ribbon + .pnp-banner-wrap,
.pnp-preview-ribbon + .pnp-close-x + .pnp-banner-wrap {
  margin-top: -16px;
}

.pnp-banner-img {
  width: 100%;
  height: 185px;
  object-fit: cover;
  display: block;
}

.pnp-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

/* Keep long titles clear of the ✕ button */
.pnp-has-close .pnp-modal-header {
  padding-left: 36px;
}

.pnp-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: var(--pnp-check-bg, rgba(37, 99, 235, 0.1));
  border: 1px solid var(--pnp-body-border, rgba(37, 99, 235, 0.25));
}

.pnp-header-texts {
  flex: 1;
  min-width: 0;
}

.pnp-kicker-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--pnp-accent, #2563eb);
  margin-bottom: 4px;
}

.pnp-title {
  margin: 0 0 6px 0 !important;
  padding: 0 !important;
  font-size: 19px !important;
  font-weight: 800 !important;
  line-height: 1.45 !important;
  color: var(--pnp-text, #0f172a) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.pnp-subtitle {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
  color: var(--pnp-subtitle, #475569) !important;
}

.pnp-modal-body {
  flex: 0 1 auto;
  min-height: 60px;
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px;
  border-radius: 14px;
  background-color: var(--pnp-body-bg, #f8fafc);
  color: var(--pnp-body-text, #1e293b);
  border: 1px solid var(--pnp-body-border, #e2e8f0);
  font-size: 14px;
  line-height: 1.85;
  margin-bottom: 18px;
}

.pnp-modal-body p {
  margin: 0 0 10px 0;
  color: inherit !important;
}

.pnp-modal-body p:last-child {
  margin-bottom: 0;
}

.pnp-modal-body ul,
.pnp-modal-body ol {
  padding-right: 20px;
  padding-left: 0;
  margin: 8px 0;
  color: inherit !important;
}

.pnp-modal-body a {
  color: var(--pnp-primary, #2563eb);
  text-decoration: underline;
}

.pnp-modal-body img {
  max-width: 100%;
  height: auto;
}

.pnp-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 12px;
  background-color: var(--pnp-check-bg, #eff6ff);
  color: var(--pnp-check-text, #0f172a);
  border: 1px solid var(--pnp-body-border, #bfdbfe);
  cursor: pointer;
  user-select: none;
  margin: 0 0 14px 0;
  transition: border-color 0.2s ease;
}

.pnp-checkbox-row:hover,
.pnp-checkbox-row:focus-within {
  border-color: var(--pnp-primary, #2563eb);
}

.pnp-checkbox-input {
  width: 19px !important;
  height: 19px !important;
  margin: 3px 0 0 0 !important;
  accent-color: var(--pnp-primary, #2563eb);
  cursor: pointer;
  flex-shrink: 0;
}

.pnp-checkbox-text {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--pnp-check-text, #0f172a) !important;
}

.pnp-error-msg {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 12px;
}

/* Readable error on dark presets */
.pnp-preset-glassmorphism .pnp-error-msg,
.pnp-preset-luxury-dark .pnp-error-msg,
.pnp-preset-cyber-neon .pnp-error-msg {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
}

.pnp-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.pnp-btn-primary {
  flex: 1;
  min-height: 46px;
  background-color: var(--pnp-primary, #2563eb) !important;
  color: var(--pnp-btn-text, #ffffff) !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 13px 20px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1.4 !important;
  text-transform: none !important;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease, filter 0.2s ease;
}

.pnp-btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.pnp-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.pnp-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--pnp-body-border, #cbd5e1);
  color: var(--pnp-text, #0f172a) !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 700;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.pnp-btn-secondary:hover {
  border-color: var(--pnp-primary, #2563eb);
  background-color: rgba(148, 163, 184, 0.1);
}

/* Keyboard focus rings */
.pnp-overlay button:focus-visible,
.pnp-overlay a:focus-visible,
.pnp-overlay input:focus-visible,
.pnp-modal-body:focus-visible {
  outline: 3px solid var(--pnp-primary, #2563eb) !important;
  outline-offset: 2px;
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
  .pnp-overlay {
    padding: 12px;
  }

  .pnp-overlay.pnp-pos-bottom-right,
  .pnp-overlay.pnp-pos-bottom-left {
    justify-content: center;
  }

  .pnp-modal-card {
    padding: 20px 18px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .pnp-preview-ribbon,
  .pnp-banner-wrap {
    margin-left: -18px;
    margin-right: -18px;
  }

  .pnp-preview-ribbon {
    margin-top: -20px;
  }

  .pnp-banner-wrap {
    margin-top: -20px;
  }

  .pnp-banner-img {
    height: 140px;
  }

  .pnp-icon-box {
    width: 42px;
    height: 42px;
  }

  .pnp-title {
    font-size: 17px !important;
  }

  .pnp-modal-body {
    font-size: 13.5px;
    padding: 14px;
  }

  .pnp-actions-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pnp-btn-secondary {
    width: 100%;
  }
}

/* ---------- Motion ---------- */

@keyframes pnpShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

.pnp-shake {
  animation: pnpShake 0.45s ease both !important;
}

@media (prefers-reduced-motion: reduce) {
  .pnp-overlay,
  .pnp-modal-card,
  .pnp-btn-primary {
    transition: none !important;
  }

  .pnp-modal-card,
  .pnp-overlay.pnp-pos-bottom-sheet .pnp-modal-card {
    transform: none !important;
  }

  .pnp-shake {
    animation: none !important;
    outline: 3px solid #dc2626 !important;
  }
}
