#modern-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none; /* JS will change this to flex */
    align-items: center;
    justify-content: center;
    z-index: 9999999;
    opacity: 0;
    backdrop-filter: blur(5px);
}

#modern-popup-container {
    background: #fff;
    width: 90%;
    max-width: 850px;
    position: relative;
    display: flex;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

#close-popup {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #000;
    z-index: 10;
}

.popup-flex { display: flex; width: 100%; }
.popup-image { flex: 1; background-size: cover; background-position: center; min-height: 450px; }
.popup-content { flex: 1; padding: 50px 40px; display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: center; }
.popup-logo { max-width: 130px; margin-bottom: 20px; }
.popup-content h2 { font-size: 26px; font-weight: 700; margin: 0 0 15px; text-transform: uppercase; }
.popup-content p { font-size: 15px; color: #444; margin-bottom: 20px; line-height: 1.6; }
.popup-form { width: 100%; }

@media (max-width: 768px) {
    .popup-flex { flex-direction: column; }
    .popup-image { height: 200px; min-height: 200px; }
    .popup-content { padding: 30px 20px; }
}

/* Final aesthetic touch for CF7 button */
.popup-form input[type="submit"] {
    background: #000 !important;
    color: #fff !important;
    border: none !important;
    padding: 15px 30px !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    letter-spacing: 2px !important;
    width: 100% !important;
    margin-top: 10px !important;
    cursor: pointer !important;
}

.popup-form input[type="email"] {
    text-align: center !important;
    border: 1px solid #e1e1e1 !important;
    padding: 12px !important;
}



#modern-popup-container {
    border-radius: 20px !important;
    overflow: hidden !important;
}

/* Optional: Slight rounding for the input field to match */
.popup-form input[type="email"], 
.popup-form input[type="text"] {
    border-radius: 4px !important;
}










/* --- AGENCY MOBILE RESPONSIVE FIX --- */
@media (max-width: 768px) {
    /* 1. Reset the form container to be perfectly centered */
    .popup-form {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    /* 2. Target the internal wrappers used by MailPoet/CF7 */
    .popup-form div, 
    .popup-form form,
    .popup-form .mailpoet_form {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }

    /* 3. Ensure the inputs stay inside the white box */
    .popup-form input[type="email"],
    .popup-form input[type="text"],
    .popup-form input[type="submit"],
    .popup-form .mailpoet_text,
    .popup-form .mailpoet_submit {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important; /* The 'Magic' line: keeps padding inside the width */
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}





















/* --- MOBILE HEIGHT & CENTERING FIX --- */
@media (max-width: 768px) {
    #modern-popup-container {
        max-height: 90vh; /* Prevents popup from being taller than the screen */
        overflow-y: auto !important; /* Adds a scrollbar inside the popup if content is too long */
        margin: 20px; /* Gives it some breathing room from the screen edges */
    }

    .popup-image {
        height: 140px !important; /* Reduced from 200px to save space */
        min-height: 140px !important;
    }

    .popup-content {
        padding: 20px 25px !important; /* Tighter padding so it's not so tall */
    }

    .popup-content h2 {
        font-size: 20px !important; /* Smaller heading on mobile */
        margin-bottom: 10px !important;
    }

    .popup-content p {
        font-size: 14px !important;
        margin-bottom: 15px !important;
    }

    .popup-logo {
        max-width: 100px !important; /* Smaller logo on mobile */
        margin-bottom: 10px !important;
    }
}