/* Popup Module Styles */
.popup-module-wrapper {
    position: fixed;
    z-index: 20000;
    display: none;
    /* Toggled by JS */
}

/* Active State */
.popup-module-wrapper.active {
    display: flex;
    /* Or block depending on backdrop */
}

/* Backdrop Mode */
.popup-module-wrapper.has-backdrop {
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

/* No-Backdrop Mode */
.popup-module-wrapper:not(.has-backdrop) {
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    overflow: visible;
    pointer-events: none;
    /* Pass clicks through wrapper */
}

.popup-content {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    /* Responsive Width Logic: */
    width: 90%;
    /* Default to 90% of parent/screen on mobile */
    max-width: 800px;
    /* Increased default cap for desktop */

    /* Height Logic */
    max-height: 85vh;
    /* Ensure it fits in viewport */
    overflow-y: auto;
    /* Enable internal scrolling */

    pointer-events: auto;
    /* Enable clicks */

    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.popup-module-wrapper.active .popup-content {
    opacity: 1;
    transform: translateY(0);
}

/* Backdrop mode override to center content */
.popup-module-wrapper.has-backdrop.active .popup-content {
    transform: none;
}

/* Positioning for No-Backdrop Mode */
.popup-module-wrapper:not(.has-backdrop) .popup-pos-center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    /* Responsive base */
    max-width: 600px;
    /* Default cap if JS doesn't set one */
}

/* Improved Content Scaling */
.popup-image {
    max-width: 100%;
    max-height: 250px;
    /* Limit image height */
    width: auto;
    height: auto;
    object-fit: contain;
    /* Ensure image isn't cropped */
    border-radius: 4px;
    display: block;
    margin: 0 auto 1.5rem;
    /* Center and add space below */
}

/* Heading is direct child of popup-body */
.popup-body h2 {
    font-size: 1.8rem;
    /* Larger heading */
    margin-bottom: 1rem;
    color: #7CA7D9 !important;
    /* Force override */
}

.popup-text p {
    font-size: 1.1rem;
    /* Larger paragraph text */
    line-height: 1.6;
    margin-bottom: 1rem;
    color: #333;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .popup-content {
        padding: 1.5rem;
        width: 80% !important;
        /* Reduced from 85% to 80% */
        max-width: 80vw !important;
    }

    .popup-image {
        max-height: 200px;
        /* Slightly smaller on mobile */
    }

    .popup-text h2 {
        font-size: 1.5rem;
    }
}