/* ==========================================================================
   CGM Grid Call-To-Action Element
   ========================================================================== */

/* Main Wrapper: Gradient & Border Radius */
.cgm-grid-cta-wrapper {
    background: linear-gradient(180deg, #2972B9 1.86%, #193A80 100%);
    border-radius: 20px;
    position: relative;
    padding: 80px 40px; 
    overflow: hidden; 
    z-index: 1; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
}

/* The Grid Overlay: Generated using CSS Linear Gradients */
.cgm-grid-cta-wrapper::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(#2972B933 1px, transparent 1px),
        linear-gradient(90deg, #2972B933 1px, transparent 1px);
    background-size: 40px 40px; 
    background-position: center center;
    z-index: -1; 
}

/* ==========================================================================
   Global Typography Styling
   ========================================================================== */

.cgm-grid-cta-content h2 {
    color: #ffffff;
    font-size: 38px;
    font-weight: 700;
    line-height: 1.1 !important; 
    margin-bottom: 25px;
}

.cgm-grid-cta-content h2 br {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
}

.cgm-grid-cta-content h2 br + br {
    display: none !important; 
}

.cgm-grid-cta-content p {
    color: #ffffff;
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 0;
}


/* ==========================================================================
   Layout Style 1: Standard (Center Aligned)
   ========================================================================== */

.cgm-grid-cta-content.standard-layout {
    text-align: center;
}

.cgm-grid-cta-content.standard-layout h2 {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.cgm-grid-cta-content.standard-layout p {
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 40px;
}

/* Button Styling (Only applies to Standard Layout) */
.cgm-grid-cta-content.standard-layout .cgm-grid-cta-button {
    display: inline-block;
    background-color: #F89820; 
    color: #193A80 !important; 
    padding: 16px 35px;
    border-radius: 8px; 
    font-size: 18px;
    font-weight: 700;
    text-decoration: none !important;
    transition: transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.cgm-grid-cta-content.standard-layout .cgm-grid-cta-button:hover {
    background-color: var(--hover-bg) !important; 
    color: var(--hover-text) !important;
    transform: translateY(-3px); 
}


/* ==========================================================================
   Layout Style 2: Split Layout (Text Left, Form Right)
   ========================================================================== */

.cgm-grid-cta-content.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two equal columns */
    gap: 60px; /* Space between text and form */
    align-items: center; /* Vertically centers the text alongside the form */
    text-align: left;
}

/* Ensure the form takes up the full width of its column */
.cgm-grid-cta-content.split-layout .split-right {
    width: 100%;
}


/* ==========================================================================
   Layout Style 3: Stacked Layout (Text Above Form)
   ========================================================================== */

/* Force a single, stacked column */
.cgm-grid-cta-content.stacked-layout {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 40px;
    text-align: center; 
}

/* Center the text and restrict its maximum width */
.cgm-grid-cta-content.stacked-layout .split-left {
    max-width: 800px;
    margin: 0 auto; 
}

/* Restrict the form width so inputs don't stretch too wide on desktop */
.cgm-grid-cta-content.stacked-layout .split-right {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}


/* ==========================================================================
   Ninja Forms Placeholder Styling (Inside CTA Block)
   ========================================================================== */

/* Targets the placeholder text for both single-line inputs, multi-line textareas, and selects */
.cgm-grid-cta-wrapper .nf-form-content input::placeholder,
.cgm-grid-cta-wrapper .nf-form-content textarea::placeholder,
.cgm-grid-cta-wrapper .nf-form-content select {
    color: #193A80 !important; /* Your deep blue branding color */
    opacity: 1 !important; /* Important: Firefox lowers placeholder opacity to 50% by default, this forces it to be fully visible */
}

/* Fallbacks for older browsers */
.cgm-grid-cta-wrapper .nf-form-content input::-webkit-input-placeholder,
.cgm-grid-cta-wrapper .nf-form-content textarea::-webkit-input-placeholder {
    color: #193A80 !important;
}
.cgm-grid-cta-wrapper .nf-form-content input::-moz-placeholder,
.cgm-grid-cta-wrapper .nf-form-content textarea::-moz-placeholder {
    color: #193A80 !important;
    opacity: 1 !important;
}

/* Ninja Forms Textarea Height Control - Forces the paragraph text field to be shorter */
.cgm-grid-cta-wrapper .nf-form-content textarea.nf-element {
    height: 100px !important; /* Adjust this number to make it shorter or taller */
    min-height: 100px !important;
}

/* .nf-error-msg, .ninja-forms-req-symbol {
    color:#F89820 !important;
}

.nf-error .ninja-forms-field {
    border: 1px solid #F89820 !important;
}

.nf-form-fields-required {
    display: none !important;
} */

/* ==========================================================================
   Mobile Responsiveness & Overflow Resets
   ========================================================================== */

@media only screen and (max-width: 767px) {
    
    /* 1. Base Container Adjustments */
    .cgm-grid-cta-wrapper {
        padding: 50px 20px;
        overflow: hidden; 
    }
    
    .cgm-grid-cta-content h2 {
        font-size: 26px; 
    }
    
    .cgm-grid-cta-content h2 br {
        display: none !important;
    }
    
    .cgm-grid-cta-content p {
        font-size: 16px;
    }

    /* 2. Stack the Split Layout on Mobile */
    .cgm-grid-cta-content.split-layout {
        grid-template-columns: 1fr;
        gap: 40px; 
        text-align: center; 
    }

    /* 3. Advanced Overflow Fixes (Ninja Forms & Cloudflare) */
    
    /* Force the right column to trap overflowing elements in both form layouts */
    .cgm-grid-cta-content.split-layout .split-right,
    .cgm-grid-cta-content.stacked-layout .split-right {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important; 
    }

    /* Strip margin/padding across inputs and select dropdowns */
    .cgm-grid-cta-wrapper .nf-form-wrap,
    .cgm-grid-cta-wrapper .nf-form-content,
    .cgm-grid-cta-wrapper .nf-field-container,
    .cgm-grid-cta-wrapper .nf-form-layout,
    .cgm-grid-cta-wrapper .nf-form-content input,
    .cgm-grid-cta-wrapper .nf-form-content textarea,
    .cgm-grid-cta-wrapper .nf-form-content select {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Force Cloudflare Turnstile and other iframes to shrink to fit */
    .cgm-grid-cta-wrapper iframe,
    .cgm-grid-cta-wrapper .cf-turnstile {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}