.form-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.form-popup.is-active {
    display: flex;
}

/* Prevent body scroll when popup is active */
body.popup-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

.form-popup .popup-content {
    padding: 40px;
    border-radius: 8px;
    max-width: 1500px;
    width: 100%;
    max-height: 95vh;
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

/* Override base form styles for popup */
.form-popup .configurable-form-outer-wrapper {
    margin: 0;
    padding: 0;
    width: 100%;
    background-color: transparent;
    position: relative;
    height: auto;
    min-height: 0;
    overflow: visible;
}

.form-popup .configurable-form-container {
    margin: 0;
    padding: 0;
    width: 100%;
    position: relative;
    height: auto;
    min-height: 0;
}

.form-popup .configurable-form-content {
    width: 100%;
    max-width: none;
    padding: 120px 40px 45px;
    margin: 0;
    position: relative;
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--color-white);
    background-image: url('/wp-content/uploads/static/popup-bg-balloon.png');
    background-position: -150px 340px;
    background-repeat: no-repeat;
    background-size: contain;
}

/* Override text colors for popup form */
.form-popup .configurable-form-content,
.form-popup .configurable-form-content p:not(.input-field),
.form-popup .configurable-form-content label:not(.input-field),
.form-popup .configurable-form-content span:not(.input-field),
.form-popup .configurable-form-content div:not(.form-input) {
    color: var(--color-nav-gray) !important;
}

/* Ensure subheading matches new color scheme */
.form-popup .configurable-form-subheading {
    color: var(--color-nav-gray);
}

/* Keep form field text colors consistent and add borders */
.form-popup .configurable-form-content input:not(.pv-btn),
.form-popup .configurable-form-content select,
.form-popup .configurable-form-content textarea {
    color: var(--color-nav-gray) !important;
    border: 1px solid var(--color-nav-gray) !important;
}

/* Style focus states */
.form-popup .configurable-form-content input:not(.pv-btn):focus,
.form-popup .configurable-form-content select:focus,
.form-popup .configurable-form-content textarea:focus {
    border: 1px solid var(--color-blue) !important;
    box-shadow: 0 0 3px var(--color-blue) !important;
}

/* Style error states */
.form-popup .configurable-form-content input:not(.pv-btn).form-error,
.form-popup .configurable-form-content select.form-error,
.form-popup .configurable-form-content textarea.form-error {
    border: 1px solid var(--color-red) !important;
    box-shadow: 0 0 3px var(--color-red) !important;
}

/* Style checkboxes specifically */
.form-popup .configurable-form-content input[type="checkbox"],
.form-popup .configurable-form-content input.input-field.checkbox {
    border: 1px solid var(--color-nav-gray) !important;
}

.form-popup .configurable-form-content input[type="checkbox"]:focus,
.form-popup .configurable-form-content input.input-field.checkbox:focus {
    outline: 1px solid var(--color-nav-gray);
    outline-offset: 1px;
}

/* Maintain button styling */
.form-popup .configurable-form-content #form-col4 .form-input input.pv-btn.sf-button {
    background-color: var(--color-yellow);
    border: 2px solid var(--color-yellow);
    color: var(--color-nav-gray);
}

.form-popup .configurable-form-content #form-col4 .form-input input.pv-btn.sf-button:hover {
    background-color: var(--color-red);
    color: var(--color-yellow) !important;
}

/* Make the form container scrollable */
.form-popup .configurable-form-content #salesforce-form-container {
    width: 100%;
    max-width: 1080px;
    max-height: calc(95vh - 250px); /* Account for header and padding */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 40px;
    margin: 0 auto;
}

/* Hide scrollbar but keep functionality */
.form-popup .configurable-form-content #salesforce-form-container {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.form-popup .configurable-form-content #salesforce-form-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Ensure form fields have proper spacing */
.form-popup .salesforce-form .form-col {
    padding: 0;
}

/* Ensure buttons and inputs maintain proper width */
.form-popup .salesforce-form .form-col .sf-form-field .form-input {
    width: 100%;
}

.form-popup .configurable-form-category-headline {
    position: absolute;
    z-index: 3;
    transform: translateY(-50%);
    background-color: var(--color-red);
    color: var(--color-white);
    top: 15px;
}

.popup-close-button {
    position: absolute;
    top: 60px;
    right: 8%;
    width: 50px;
    height: 50px;
    padding: 7.5px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.popup-close-button:hover {
    opacity: 0.7;
}

.popup-close-button img {
    width: 30px;
    height: 30px;
    display: block;
}

.form-popup .configurable-form-content a.form-link {
    color: var(--color-nav-gray);
}

/* Responsive adjustments */
@media screen and (max-width: 1366px) {
    .form-popup .popup-content {
        max-width: 90%;
    }
}

@media screen and (max-width: 1024px) {
    .form-popup .configurable-form-content {
        background-position: -40px 450px;
    }
}

@media screen and (max-width: 768px) {
    .form-popup {
        padding: 0;
    }
    
    .form-popup .popup-content {
        padding: 10px;
        max-height: 90vh;
        height: 100%;
        overflow: visible;
        max-width: 100%;
    }

    .form-popup .configurable-form-content {
        padding: 120px 20px 45px;
        background-position: bottom left;
    }

    .form-popup .configurable-form-content #salesforce-form-container {
        max-height: calc(100vh - 200px);
        padding: 0 0 20px;
    }

    .form-popup .configurable-form-category-headline {
        top: -35px;
        transform: translateY(0); /* Reset transform on mobile */
        width: 80%;
        left: 50%;
        transform: translateX(-50%); /* Center horizontally */
    }

    .popup-close-button {
        width: 25px;
        height: 25px;
        top: 30px;
        right: 3%;
    }

    .popup-close-button img {
        width: 25px;
        height: 25px;
    }

    .form-popup .configurable-form-content .salesforce-form {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media screen and (max-width: 440px) {
    .form-popup .configurable-form-category-headline {
        width: 85%;
    }
}

/* Style form links in popup */
.form-popup .configurable-form-content .salesforce-form #form-col3 .legal-consent-container .sf-form-field p.pv-p.form-title a.form-link {
    color: var(--color-nav-gray);
    font-weight: bold;
    text-decoration: none;
}

.form-popup .configurable-form-content .salesforce-form #form-col3 .legal-consent-container .sf-form-field p.pv-p.form-title a.form-link:hover {
    color: var(--color-blue);
    text-decoration: underline;
}