/*
 * Blog AI Scroll Popup
 * Heading is AI-generated per post (from that post's AI summary) — see the
 * ranosys-blog-ai-summary plugin. Two-column design (dark "Talk to our
 * experts" intro panel + white form panel). The form panel used to be a
 * cross-origin Pardot iframe (uneditable from here); it's now a native form
 * (see includes/blog-popup.php) using that same form's real field
 * names/action URL, so it can actually be laid out and styled. Loaded only
 * on single posts that have a generated heading.
 */
#blog-ai-popup.popup {
    position: fixed;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.6);
    width: 100%;
    height: 100%;
    /* Must beat the blog sidebar's `position: sticky` contact box (its own
       stacking context — sticky/fixed elements always create one per spec,
       regardless of z-index), which otherwise bleeds through on top of this
       overlay once "stuck". Highest known z-index elsewhere in the theme is
       9999 (sticky header) — this needs a wide safety margin above that. */
    z-index: 999999;
    display: none;
    overflow-y: auto;
}

#blog-ai-popup.popup.is-visible {
    display: block;
}

#blog-ai-popup .popup-content {
    display: flex;
    align-items: stretch;
    background: #fff;
    max-width: 936px; /* was 780px, +20% per request */
    margin: 5.75rem auto;
    position: relative;
    border-radius: 8px; /* was 16px, reduced per request */
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}

#blog-ai-popup .popup-content .close {
    position: absolute;
    right: 19px;
    top: 19px;
    z-index: 2;
    margin: 0;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, .9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    border-radius: 50%;
    border: 1px solid #d8d8d8;
    box-shadow: none;
    line-height: 1;
    font-size: 20px;
    font-weight: 400;
    cursor: pointer;
}

#blog-ai-popup .popup-content .close:hover {
    color: #1a1a1a;
    border-color: #1a1a1a;
}

#blog-ai-popup .blog-ai-popup-intro {
    flex: 0 0 38%;
    box-sizing: border-box;
    background-color: #1a1a1a;
    background-repeat: no-repeat;
    background-position: left bottom;
    background-size: 100% auto;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

#blog-ai-popup .blog-ai-popup-eyebrow {
    display: block;
    color: #fe5907;
    font-family: Poppins, sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 18px;
}

#blog-ai-popup .blog-ai-popup-intro h3 {
    padding: 0;
    border: 0;
    font-size: 34px;
    line-height: 1.25;
    text-align: left;
    position: relative;
    margin: 0;
    color: #fff;
    font-family: Poppins, sans-serif;
    font-weight: 600;
}

#blog-ai-popup .blog-ai-popup-form {
    flex: 1 1 62%;
    /* Flex items default to min-width:auto (i.e. their content's natural
       min-content width), which can silently override the 62% basis above
       and push the whole two-column card past its max-width — happened
       once already here from a `white-space: nowrap` child. min-width:0
       makes this panel actually respect the 62% basis regardless of what
       gets added inside it later. */
    min-width: 0;
    box-sizing: border-box;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 28px;
}

#blog-ai-popup .blog-ai-popup-form-heading {
    margin: 0 0 5px;
    text-align: left;
    font-family: Poppins, sans-serif;
    font-size: 32px;
    font-weight: 600;
    color: #1a1a1a;
}

#blog-ai-popup .blog-ai-popup-form-subheading {
    font-family: "source-sans-pro", sans-serif;
    color: #424242;
    font-size: 18px;
    line-height: 24px;
    margin: 0 0 24px 0;
    text-align: left;
}

#blog-ai-popup .blog-ai-popup-pardot-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#blog-ai-popup .blog-ai-popup-form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
}

#blog-ai-popup .blog-ai-popup-pardot-form .form-field {
    margin: 0;
}

#blog-ai-popup .blog-ai-popup-pardot-form input[type="text"],
#blog-ai-popup .blog-ai-popup-pardot-form textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d8d8d8;
    border-radius: 4px;
    padding: 12px 14px;
    font-family: "Source Sans 3", sans-serif;
    font-size: 14px;
    color: #333;
}

#blog-ai-popup .blog-ai-popup-pardot-form input[type="text"]:focus,
#blog-ai-popup .blog-ai-popup-pardot-form textarea:focus {
    outline: none;
    border-color: #fe5907;
}

#blog-ai-popup .blog-ai-popup-pardot-form textarea {
    resize: vertical;
    min-height: 46px;
}

/* Pardot's own spam-trap field — must stay visually hidden and off-screen,
   exactly like the original form, so bots that auto-fill every field still
   get caught; real visitors never see or interact with it. */
#blog-ai-popup .blog-ai-popup-honeypot {
    position: absolute;
    width: 190px;
    left: -9999px;
    top: -9999px;
    visibility: hidden;
    margin: 0;
}

#blog-ai-popup .blog-ai-popup-submit {
    margin: 4px 0 0;
    text-align: right;
}

#blog-ai-popup .blog-ai-popup-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Fixed width (percentage + min-width, not content-based auto sizing) is
       what keeps this stable when the loading spinner swaps in for the text
       below — the button's box never depends on which child is visible. */
    width: 35%;
    min-width: 240px; /* was 180px — too narrow for the longer "Talk to Our Experts" label, which would otherwise wrap to 2 lines */
    white-space: nowrap;
    padding: 14px 24px;
    background: #fe5907;
    color: #fff;
    border: 0;
    border-radius: 999px;
    font-family: Poppins, sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    cursor: pointer;
}

#blog-ai-popup .blog-ai-popup-submit-btn:hover {
    background: #e04e06;
}

#blog-ai-popup .blog-ai-popup-submit-btn:disabled {
    cursor: default;
    opacity: .85;
}

#blog-ai-popup .blog-ai-popup-submit-btn-loader {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rano-blog-ai-popup-spin .7s linear infinite;
}

#blog-ai-popup .blog-ai-popup-submit-btn.is-loading .blog-ai-popup-submit-btn-text {
    display: none;
}

#blog-ai-popup .blog-ai-popup-submit-btn.is-loading .blog-ai-popup-submit-btn-loader {
    display: inline-block;
}

@keyframes rano-blog-ai-popup-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Submission target — never shown; the form posts into it so the visitor
   never leaves this popup/page (the previous iframe-embedded form had the
   same "stay on page" behavior). */
#blog-ai-popup .blog-ai-popup-submit-frame {
    display: none;
}

#blog-ai-popup .blog-ai-popup-thanks {
    text-align: center;
    font-family: Poppins, sans-serif;
    font-size: 16px;
    color: #1a1a1a;
    margin: 4px 0 0;
}

@media only screen and (max-width: 768px) {
    #blog-ai-popup .popup-content {
        max-width: 620px; /* was 540px, +~15% to track the desktop increase without overflowing tablet widths */
        margin: 4.75rem auto;
        flex-direction: column;
        border-radius: 8px;
    }

    #blog-ai-popup .blog-ai-popup-intro {
        flex-basis: auto;
        background-size: auto 100%;
        background-position: right bottom;
    }

    #blog-ai-popup .blog-ai-popup-intro h3 {
        font-size: 25px;
    }

    #blog-ai-popup .blog-ai-popup-form {
        flex-basis: auto;
    }
}

@media only screen and (max-width: 475px) {
    #blog-ai-popup.popup {
        overflow-x: hidden;
    }

    #blog-ai-popup .popup-content {
        max-width: 350px;
        margin: 3.25rem auto;
    }

    #blog-ai-popup .blog-ai-popup-intro,
    #blog-ai-popup .blog-ai-popup-form {
        padding: 20px;
    }

    #blog-ai-popup .blog-ai-popup-form-row {
        grid-template-columns: 1fr;
    }

    #blog-ai-popup .blog-ai-popup-submit-btn {
        width: 100%;
    }
}

@media only screen and (max-width: 376px) {
    #blog-ai-popup .popup-content {
        max-width: 310px;
    }
}
