/**
 * WP Minner Popup Manager — Scoped Frontend Stylesheet
 *
 * Strictly scoped to .wpm-popup-manager and body.wpm-popup-manager-open.
 * Supports 4 layouts, 5 animation presets, dynamic scoped CSS custom properties,
 * reduced-motion compliance, and full responsiveness (320px–1440px).
 *
 * @version 1.2.15
 */

.wpm-popup-manager {
    --wpm-pm-max-width: 480px;
    --wpm-pm-bg: #ffffff;
    --wpm-pm-heading-color: #202020;
    --wpm-pm-text-color: #555555;
    --wpm-pm-cta-bg: #f4b82c;
    --wpm-pm-cta-color: #202020;
    --wpm-pm-radius: 16px;
    --wpm-pm-open-ms: 400ms;
    --wpm-pm-close-ms: 300ms;
    --wpm-pm-easing: cubic-bezier(0.22, 1, 0.36, 1);
    --wpm-pm-img-fit: cover;
    --wpm-pm-img-pos: center center;
    --wpm-pm-font-heading: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --wpm-pm-font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    display: none;
    position: relative;
    z-index: 999990;
}

.wpm-popup-manager *,
.wpm-popup-manager *::before,
.wpm-popup-manager *::after {
    box-sizing: border-box;
}

body.wpm-popup-manager-open {
    overflow: hidden !important;
}

/* ==========================================================================
   BACKDROP & CONTAINER
   ========================================================================== */
.wpm-popup-manager__backdrop {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: rgba(18, 18, 18, 0.68) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999990 !important;
    opacity: 0;
    transition: opacity var(--wpm-pm-open-ms) var(--wpm-pm-easing);
}

.wpm-popup-manager__container {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 999991 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    pointer-events: none !important;
}

/* ==========================================================================
   DIALOG SURFACE & LAYOUTS
   ========================================================================== */
.wpm-popup-manager__dialog {
    pointer-events: auto !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: var(--wpm-pm-max-width) !important;
    max-height: calc(100dvh - 32px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: var(--wpm-pm-bg) !important;
    border: 1px solid #e5e2da !important;
    border-radius: var(--wpm-pm-radius) !important;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.24), 0 4px 14px rgba(0, 0, 0, 0.08) !important;
    padding: 0 !important;
    opacity: 0;
}

/* Split Layouts on Desktop/Tablet >= 640px */
@media (min-width: 640px) {
    .wpm-popup-manager.wpm-pm-layout-image-left .wpm-popup-manager__dialog {
        flex-direction: row !important;
        align-items: stretch !important;
    }

    .wpm-popup-manager.wpm-pm-layout-image-right .wpm-popup-manager__dialog {
        flex-direction: row-reverse !important;
        align-items: stretch !important;
    }

    .wpm-popup-manager.wpm-pm-layout-image-left .wpm-popup-manager__media,
    .wpm-popup-manager.wpm-pm-layout-image-right .wpm-popup-manager__media {
        width: 45% !important;
        flex-shrink: 0 !important;
        aspect-ratio: auto !important;
        min-height: 260px !important;
        border-bottom: none !important;
    }

    .wpm-popup-manager.wpm-pm-layout-image-left .wpm-popup-manager__content,
    .wpm-popup-manager.wpm-pm-layout-image-right .wpm-popup-manager__content {
        width: 55% !important;
        justify-content: center !important;
    }
}

/* ==========================================================================
   ANIMATION PRESETS (Transform + Opacity only)
   ========================================================================== */
.wpm-popup-manager.is-active {
    display: block !important;
}

.wpm-popup-manager.is-active .wpm-popup-manager__backdrop {
    opacity: 1 !important;
}

/* Slide Up */
.wpm-popup-manager.wpm-pm-anim-slide-up .wpm-popup-manager__dialog {
    transform: translateY(24px) scale(0.97);
    transition: transform var(--wpm-pm-open-ms) var(--wpm-pm-easing), opacity var(--wpm-pm-open-ms) var(--wpm-pm-easing);
}
.wpm-popup-manager.wpm-pm-anim-slide-up.is-active .wpm-popup-manager__dialog {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
}
.wpm-popup-manager.wpm-pm-anim-slide-up.is-closing .wpm-popup-manager__dialog {
    opacity: 0 !important;
    transform: translateY(16px) scale(0.97) !important;
    transition: transform var(--wpm-pm-close-ms) ease, opacity var(--wpm-pm-close-ms) ease !important;
}

/* Slide Down */
.wpm-popup-manager.wpm-pm-anim-slide-down .wpm-popup-manager__dialog {
    transform: translateY(-24px) scale(0.97);
    transition: transform var(--wpm-pm-open-ms) var(--wpm-pm-easing), opacity var(--wpm-pm-open-ms) var(--wpm-pm-easing);
}
.wpm-popup-manager.wpm-pm-anim-slide-down.is-active .wpm-popup-manager__dialog {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
}
.wpm-popup-manager.wpm-pm-anim-slide-down.is-closing .wpm-popup-manager__dialog {
    opacity: 0 !important;
    transform: translateY(-16px) scale(0.97) !important;
    transition: transform var(--wpm-pm-close-ms) ease, opacity var(--wpm-pm-close-ms) ease !important;
}

/* Fade In */
.wpm-popup-manager.wpm-pm-anim-fade .wpm-popup-manager__dialog {
    transform: none;
    transition: opacity var(--wpm-pm-open-ms) var(--wpm-pm-easing);
}
.wpm-popup-manager.wpm-pm-anim-fade.is-active .wpm-popup-manager__dialog {
    opacity: 1 !important;
}
.wpm-popup-manager.wpm-pm-anim-fade.is-closing .wpm-popup-manager__dialog {
    opacity: 0 !important;
    transition: opacity var(--wpm-pm-close-ms) ease !important;
}

/* Zoom In */
.wpm-popup-manager.wpm-pm-anim-zoom .wpm-popup-manager__dialog {
    transform: scale(0.91);
    transition: transform var(--wpm-pm-open-ms) var(--wpm-pm-easing), opacity var(--wpm-pm-open-ms) var(--wpm-pm-easing);
}
.wpm-popup-manager.wpm-pm-anim-zoom.is-active .wpm-popup-manager__dialog {
    opacity: 1 !important;
    transform: scale(1) !important;
}
.wpm-popup-manager.wpm-pm-anim-zoom.is-closing .wpm-popup-manager__dialog {
    opacity: 0 !important;
    transform: scale(0.94) !important;
    transition: transform var(--wpm-pm-close-ms) ease, opacity var(--wpm-pm-close-ms) ease !important;
}

/* No Animation */
.wpm-popup-manager.wpm-pm-anim-none .wpm-popup-manager__backdrop,
.wpm-popup-manager.wpm-pm-anim-none .wpm-popup-manager__dialog {
    transition: none !important;
    transform: none !important;
}
.wpm-popup-manager.wpm-pm-anim-none.is-active .wpm-popup-manager__dialog {
    opacity: 1 !important;
}

/* Closing Backdrop */
.wpm-popup-manager.is-closing .wpm-popup-manager__backdrop {
    opacity: 0 !important;
    transition: opacity var(--wpm-pm-close-ms) ease !important;
}

/* ==========================================================================
   CLOSE BUTTON
   ========================================================================== */
.wpm-popup-manager__close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.94) !important;
    border: 1px solid rgba(32, 32, 32, 0.14) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14) !important;
    color: #202020 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer !important;
    transition: background 0.16s ease, transform 0.16s ease, border-color 0.16s ease !important;
    z-index: 4 !important;
}

.wpm-popup-manager__close:hover {
    background: #ffffff !important;
    border-color: #202020 !important;
    transform: scale(1.06) !important;
}

.wpm-popup-manager__close:focus-visible {
    outline: 2px solid #f4b82c !important;
    outline-offset: 2px !important;
}

.wpm-popup-manager__close svg {
    display: block !important;
    pointer-events: none !important;
}

/* ==========================================================================
   FEATURED MEDIA CONTAINER
   ========================================================================== */
.wpm-popup-manager__media {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    background: #f8f7f3 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border-bottom: 1px solid #e5e2da !important;
}

.wpm-popup-manager__image {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: var(--wpm-pm-img-fit) !important;
    object-position: var(--wpm-pm-img-pos) !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ==========================================================================
   CONTENT, ALIGNMENT & PADDING PRESETS
   ========================================================================== */
.wpm-popup-manager__content {
    display: flex !important;
    flex-direction: column !important;
    padding: 26px 28px 30px !important;
}

.wpm-popup-manager.wpm-pm-pad-compact .wpm-popup-manager__content {
    padding: 20px 22px 22px !important;
}

.wpm-popup-manager.wpm-pm-pad-spacious .wpm-popup-manager__content {
    padding: 34px 36px 38px !important;
}

.wpm-popup-manager__dialog.has-no-image .wpm-popup-manager__content {
    padding-top: 52px !important;
}

.wpm-popup-manager.wpm-pm-align-center .wpm-popup-manager__content {
    align-items: center !important;
    text-align: center !important;
}

.wpm-popup-manager.wpm-pm-align-left .wpm-popup-manager__content {
    align-items: flex-start !important;
    text-align: left !important;
}

.wpm-popup-manager__title {
    font-family: var(--wpm-pm-font-heading) !important;
    font-size: 24px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    color: var(--wpm-pm-heading-color) !important;
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
    letter-spacing: -0.25px !important;
}

.wpm-popup-manager__tagline {
    font-family: var(--wpm-pm-font-body) !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 1.55 !important;
    color: var(--wpm-pm-text-color) !important;
    margin: 0 0 22px 0 !important;
    padding: 0 !important;
    max-width: 390px !important;
}

.wpm-popup-manager__subdesc {
    font-family: var(--wpm-pm-font-body) !important;
    font-size: 13.5px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: var(--wpm-pm-text-color) !important;
    margin: -10px 0 20px 0 !important;
    padding: 0 !important;
    max-width: 390px !important;
    opacity: 0.9;
}

/* ==========================================================================
   CTA BUTTON
   ========================================================================== */
.wpm-popup-manager__actions {
    display: flex !important;
    width: 100% !important;
}

.wpm-popup-manager.wpm-pm-align-center .wpm-popup-manager__actions {
    justify-content: center !important;
}

.wpm-popup-manager.wpm-pm-align-left .wpm-popup-manager__actions {
    justify-content: flex-start !important;
}

.wpm-popup-manager__cta-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 220px !important;
    max-width: 100% !important;
    min-height: 48px !important;
    padding: 13px 32px !important;
    background: var(--wpm-pm-cta-bg) !important;
    color: var(--wpm-pm-cta-color) !important;
    font-family: var(--wpm-pm-font-heading) !important;
    font-size: 15.5px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    text-decoration: none !important;
    border-radius: 10px !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
    transition: filter 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease !important;
}

.wpm-popup-manager__cta-btn:hover {
    filter: brightness(0.93) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16) !important;
    text-decoration: none !important;
}

.wpm-popup-manager__cta-btn:focus-visible {
    outline: 2px solid #202020 !important;
    outline-offset: 2px !important;
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .wpm-popup-manager__backdrop,
    .wpm-popup-manager__dialog,
    .wpm-popup-manager__cta-btn,
    .wpm-popup-manager__close {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
}

/* ==========================================================================
   MOBILE & ULTRA-NARROW RESPONSIVENESS
   ========================================================================== */
@media (max-width: 480px) {
    .wpm-popup-manager__container {
        padding: 12px !important;
    }

    .wpm-popup-manager__dialog {
        max-height: calc(100dvh - 24px) !important;
    }

    .wpm-popup-manager__close {
        top: 10px !important;
        right: 10px !important;
        width: 34px !important;
        height: 34px !important;
    }

    .wpm-popup-manager__content,
    .wpm-popup-manager.wpm-pm-pad-spacious .wpm-popup-manager__content {
        padding: 20px 18px 24px !important;
    }

    .wpm-popup-manager__dialog.has-no-image .wpm-popup-manager__content {
        padding-top: 46px !important;
    }

    .wpm-popup-manager__title {
        font-size: 20px !important;
        margin-bottom: 8px !important;
    }

    .wpm-popup-manager__tagline {
        font-size: 14px !important;
        margin-bottom: 18px !important;
    }

    .wpm-popup-manager__cta-btn {
        font-size: 14.5px !important;
        min-height: 46px !important;
        padding: 12px 26px !important;
    }
}

@media (max-width: 340px) {
    .wpm-popup-manager__container {
        padding: 8px !important;
    }

    .wpm-popup-manager__content {
        padding: 18px 14px 20px !important;
    }

    .wpm-popup-manager__title {
        font-size: 18px !important;
    }

    .wpm-popup-manager__tagline {
        font-size: 13px !important;
        margin-bottom: 16px !important;
    }

    .wpm-popup-manager__cta-btn {
        width: 100% !important;
        min-width: 0 !important;
        font-size: 14px !important;
        padding: 11px 18px !important;
    }
}
