.text-form__contact {
    padding: 41px 30px;
    background: #AEBFCF;
    box-shadow: 0px 4px 18.4px rgba(15, 48, 80, 0.4);
    border-radius: 5px;
}

.text-form__content ul {
    margin: 0 0 35px 0;
}

.text-form__content {
    margin: 0 0 56px;
    position: relative;
}

.text-form__contact {
    margin: 0 -8px;
}

.bg-navy.text-form h2 {
    color: #E4EFFA;
}

.text-form__content ul:last-child {
    margin: 0;
}

.text-form-arrow {
    display: block;
    margin: 20px 0 30px;
}

.text-form__content:has(.text-form-arrow) h2 {
    padding-left: 0;
    margin: 0 0 0;
    letter-spacing: 0.03em;
}

/* Mobile/Tablet: Arrow to the left of h2 at the top */
@media(max-width: 1199px) {
    .text-form__content:has(.text-form-arrow) {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 0 15px;
        align-items: start;
    }

    /* H2 and arrow at the top - first row */
    .text-form__content:has(.text-form-arrow) > h2 {
        grid-column: 2;
        grid-row: 1;
        margin: 0 0 30px 0;
    }

    /* All arrow images in first column, first row (same row as h2, at the top) */
    .text-form__content:has(.text-form-arrow) > .text-form-arrow {
        grid-column: 1;
        grid-row: 1;
        margin: 0;
        align-self: start;
    }

    /* Subheading spans full width, second row (below h2/arrow) */
    .text-form__content:has(.text-form-arrow) > .sub-heading {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    /* Content (WYSIWYG and other elements) spans full width below */
    .text-form__content:has(.text-form-arrow) > *:not(.sub-heading):not(h2):not(.text-form-arrow) {
        grid-column: 1 / -1;
    }
}

.text-form--contact p {
    margin: 0 0 10px;
}

.text-form--contact p:last-child {
    margin-bottom: 0;
}

.text-form--contact .text-form__content {
    margin: 0 0 40px;
}

@media(min-width: 768px) {
    .text-form__contact {
        margin: 0 -10px;
    }

    .text-form__contact .row {
        --bs-gutter-x: 43px;
    }

    .text-form__content:has(.text-form-arrow) h2 {
        padding-left: 0;
        font-size: 60px;
        text-transform: capitalize;
    }

    .text-form-arrow {
        margin: 25px 0 35px;
    }

    /* Override arrow and h2 margins when in grid layout */
    /*
    .text-form__content:has(.text-form-arrow) > .text-form-arrow {
        margin: 0;
    }
    */

    .text-form__content:has(.text-form-arrow) > h2 {
        margin: 0 0 30px 0;
    }

    .text-form--contact .text-form__content p {
        font-size: 18px;
    }

    .text-form--contact .text-form__content {
        margin: 0 0 50px;
        max-width: 530px;
    }

    .text-form--contact .text-form__contact {
        box-shadow: none;
    }
}


@media(min-width: 1200px) {
    .text-form__wrapper {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .text-form__content {
        margin: 0;
        width: calc(45% - 27px);
    }

    .text-form__contact {
        margin: 0;
        width: 55%;
        padding: 35px 38px;
    }

    .text-form {
        position: relative;
        z-index: 1;
    }

    .text-form:after {
        content: "";
        position: absolute;
        right: 0;
        top: 50%;
        transform: translate(0, -50%);
        clip-path: polygon(60% 0, 100% 0, 100% 100%, 60% 99%, 0 50%);
        width: 235px;
        height: 487px;
        background: #1B5186;
        z-index: -1;
    }

    .bg-navy.text-form:after {
        background: #0F3050;
    }

    .text-form-arrow {
        margin: 20px 0 40px;
    }

    .text-form__content:has(.text-form-arrow) h2 {
        padding-left: 0;
        font-size: 62px;
        margin: 0 0 0;
    }

    .text-form--contact .text-form__contact {
        margin: 0;
    }

    .text-form--contact .text-form__content {
        margin: 0;
        max-width: 500px;
    }

    .text-form--contact.text-form:after {
        display: none;
    }

    /* Show arrow shape when enabled */
    .text-form--contact.text-form.show-arrow-shape:after {
        display: block;
    }
}

@media(min-width: 1600px) {
    .text-form__contact {
        margin: 0 -40px 0 0;
    }
}

/* Gravity Forms Styles */
.text-form__contact .gform_wrapper {
    margin: 0;
}

.text-form__contact .gform_wrapper form {
    margin: 0;
}

/* Form Submission Error Message */
.text-form__contact .gform_submission_error {
    margin: 0 0 20px;
    padding: 15px 20px;
    background: rgba(129, 0, 0, 0.1);
    border-left: 4px solid #810000;
    border-radius: 4px;
    color: #810000;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
}

.text-form__contact .gform_submission_error.hide_summary {
    display: none;
}

.text-form__contact .gform_submission_error .gform-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: inline-block;
}

.text-form__contact .gform_submission_error .gform-icon--circle-error::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z' fill='%23810000'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.text-form__contact .gform_fields {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.text-form__contact .gfield {
    margin: 0;
    padding: 0;
}

.text-form__contact .gfield--width-full {
    width: 100%;
}

.text-form__contact .gfield--width-half {
    width: 100%;
}

.text-form__contact .gfield_label {
    display: block;
    margin: 0 0 10px;
    font-weight: 600;
    color: #0F3050;
    font-size: 17px;
    font-family: 'Inter', sans-serif;
}

.text-form__contact .gfield_required {
    color: #0F3050;
    margin-left: 2px;
}

.text-form__contact .ginput_container input[type="text"],
.text-form__contact .ginput_container input[type="email"] {
    width: 100%;
    padding: 15px;
    border: 2px solid transparent;
    border-radius: 4px;
    background: #fff;
    font-size: 16px;
    color: #565656;
    transition: all 0.3s ease;
    position: relative;
}

.text-form__contact .ginput_container input[type="text"]:focus,
.text-form__contact .ginput_container input[type="email"]:focus {
    outline: none;
    border-color: #0F3050;
    box-shadow: inset 4px 0 0 0 #0F3050;
}

/* Error State */
.text-form__contact .gfield_error .ginput_container {
    position: relative;
}

.text-form__contact .gfield_error .ginput_container input[type="text"],
.text-form__contact .gfield_error .ginput_container input[type="email"] {
    border: 1px solid #810000;
    box-shadow: inset 4px 0 0 0 #810000;
    padding-right: 50px;
}

.text-form__contact .gfield_error .ginput_container::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 10px;
    width: 32px;
    height: 32px;
    background-image: url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 2C8.268 2 2 8.268 2 16s6.268 14 14 14 14-6.268 14-14S23.732 2 16 2zm1.5 21h-3v-3h3v3zm0-5h-3V9h3v9z' fill='%23810000'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
}

/* Phone field specific positioning */
.text-form__contact .gfield_error .ginput_container:has(input[type="tel"])::after {
    top: 10px;
}

.text-form__contact .gfield_error .validation_message {
    margin: 5px 0 0 5px;
    padding: 0;
    background: transparent;
    border: none;
    color: #0F3050;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
}

/* Dropdown/Select Error State */
.text-form__contact .gfield_error .ginput_container select,
.text-form__contact .gfield_error .ginput_container .choices__inner {
    border: 1px solid #810000;
    box-shadow: inset 4px 0 0 0 #810000;
    padding-right: 95px;
}

.text-form__contact .gfield_error .ginput_container:has(select)::after,
.text-form__contact .gfield_error .ginput_container:has(.choices)::after {
    right: 55px;
    top: 10px;
}

.text-form__contact .gfield_error .ginput_container .choices {
    position: relative;
}

/* Ensure dropdown maintains proper styling in error state */
.text-form__contact .ginput_container select,
.text-form__contact .ginput_container .choices__inner {
    width: 100%;
    padding: 15px;
    border: 2px solid transparent;
    border-radius: 4px;
    background: #fff;
    font-size: 16px;
    color: #565656;
    transition: all 0.3s ease;
}

.text-form__contact .ginput_container select:focus,
.text-form__contact .ginput_container .choices.is-focused .choices__inner {
    outline: none;
    border-color: #0F3050;
    box-shadow: inset 4px 0 0 0 #0F3050;
}

.text-form__contact .gfield_html {
    width: 100%;
}

.text-form__contact .gfield_html p {
    margin: 0 !important;
    font-size: 16px;
    color: #0F3050;
    text-align: center;
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
}

.text-form__contact .gfield_html a {
    color: #0F3050;
    text-decoration: none;
    font-weight: 600;
}

.text-form__contact .gfield_html a:hover {
    text-decoration: underline;
}

.text-form__contact .gform_footer {
    margin: 20px 0 0;
    padding: 0;
    text-align: center;
}

.text-form__contact .gform_button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 15px 31px;
    background: #0F3050;
    color: #FFFFFF;
    border: none;
    border-radius: 0;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    line-height: 1.195;
    cursor: pointer;
    transition: all ease-in-out 0.3s;
    text-transform: capitalize;
    text-decoration: none;
    position: relative;
    z-index: 1;
}

.text-form__contact .gform_button::after {
    content: '\e905';
    font-family: var(--font-family-icon, 'perritt-icon');
    font-weight: normal;
    font-size: 12px;
    flex-shrink: 0;
}

.text-form__contact .gform_button:hover {
    background: #1B5186;
    color: #FFFFFF;
}

@media(min-width: 768px) {
    .text-form__contact .gfield--width-half {
        width: calc(50% - 10px);
    }

    .text-form__contact .gform_fields {
        gap: 10px 20px;
    }
}