.cfc-calculator-wrapper {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.cfc-calculator-wrapper.cfc-hidden {
    display: none;
}

.cfc-calculator {
    /* Container style with CSS variables for Elementor controls */
    --cfc-container-padding: 30px;
    --cfc-form-group-gap: 25px;
    --cfc-results-padding: 16px;
    --cfc-monthly-padding: 14px 16px;
    /* Slider vars */
    --cfc-slider-track-color: #ddd;
    --cfc-slider-track-height: 6px;
    --cfc-slider-thumb-color: #4CAF50;
    --cfc-slider-thumb-size: 18px;

    background: #fff;
    border-radius: 12px;
    padding: var(--cfc-container-padding, 30px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.cfc-title {
    text-align: center;
    color: #333;
    margin: 0 0 30px 0;
    font-size: 24px;
    font-weight: 600;
}

/* Inline CTA (monthly amount + button) */
.cfc-button-wrap .cfc-inline-cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
/* Explicit layout modes */
.cfc-button-wrap .cfc-inline-cta[data-layout="inline"] {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
}
.cfc-button-wrap .cfc-inline-cta[data-layout="stacked"] {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
/* Ensure button can sit next to amount when inline, even if Full Width was enabled */
.cfc-button-wrap .cfc-inline-cta[data-layout="inline"] .cfc-toggle-button {
    display: inline-block;
}
.cfc-inline-amount {
    display: inline-flex;
    align-items: baseline;
    background: #f2f2f2;
    color: #333;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
}

/* Toggle Button */
.cfc-toggle-button {
    display: inline-block;
    padding: var(--cfc-button-padding, 12px 30px);
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cfc-toggle-button:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.cfc-toggle-button.cfc-active {
    background: #f44336;
}

/* Modal overlay to prevent grid height jumps in loops */
body.cfc-lock-scroll { overflow: hidden; }
.cfc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.cfc-modal {
    width: min(900px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative;
}
.cfc-modal-close {
    /* Position close button absolutely at left:0 as requested */
    position: absolute;
    right: 0;
    top: 8px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    margin: 0;
}
.cfc-modal-body {
    padding: 24px;
    /* clear the float from the close button */
    overflow: auto;
}

/* Slider styling with CSS variables */
.cfc-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: var(--cfc-slider-track-height, 6px);
    background: var(--cfc-slider-track-color, #ddd);
    border-radius: 999px;
    outline: none;
}
.cfc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: var(--cfc-slider-thumb-size, 18px);
    height: var(--cfc-slider-thumb-size, 18px);
    background: var(--cfc-slider-thumb-color, #4CAF50);
    border-radius: 50%;
    border: 0;
    cursor: pointer;
}
.cfc-slider::-moz-range-track {
    height: var(--cfc-slider-track-height, 6px);
    background: var(--cfc-slider-track-color, #ddd);
    border: 0;
    border-radius: 999px;
}
.cfc-slider::-moz-range-thumb {
    width: var(--cfc-slider-thumb-size, 18px);
    height: var(--cfc-slider-thumb-size, 18px);
    background: var(--cfc-slider-thumb-color, #4CAF50);
    border-radius: 50%;
    border: 0;
    cursor: pointer;
}

.cfc-form {
    margin-bottom: 30px;
}

.cfc-form-group {
    margin-bottom: var(--cfc-form-group-gap, 25px);
}

.cfc-form-group label {
    display: block;
    margin-bottom: 10px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

.cfc-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: #f5f5f5;
    color: #333;
    box-sizing: border-box;
}

.cfc-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.cfc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cfc-slider::-webkit-slider-thumb:hover {
    background: #45a049;
    transform: scale(1.2);
}

.cfc-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.cfc-slider::-moz-range-thumb:hover {
    background: #45a049;
    transform: scale(1.2);
}

.cfc-value {
    margin-top: 8px;
    font-size: 14px;
    color: #4CAF50;
    font-weight: 600;
}

.cfc-results {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 25px;
}

.cfc-results h4 {
    text-align: center;
    color: #333;
    margin: 0 0 20px 0;
    font-size: 18px;
}

.cfc-monthly-payment {
    text-align: center;
    padding: 25px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cfc-monthly-payment .cfc-label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
    opacity: 0.9;
}

.cfc-monthly-payment .cfc-amount {
    display: block;
    font-size: 42px;
    font-weight: bold;
    line-height: 1;
}

.cfc-result-details {
    padding: 15px 0;
}

.cfc-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
    color: #555;
    font-size: 14px;
}

.cfc-detail-row:last-child {
    border-bottom: none;
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.cfc-disclaimer {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin: 15px 0 0 0;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .cfc-calculator {
        padding: 20px;
    }

    .cfc-title {
        font-size: 20px;
    }

    .cfc-monthly-payment .cfc-amount {
        font-size: 32px;
    }
}

/* Layout: two-column with results on the right (responsive) */
.cfc-calculator {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

/* Make the title span the full width of the grid */
.cfc-title {
    grid-column: 1 / -1;
}

@media (min-width: 768px) {
    .cfc-calculator {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
    /* Form on the left, Results on the right */
    .cfc-form { grid-column: 1; }
    .cfc-results { grid-column: 2; }
}

/* Responsive two-column layout for form/results within calculator */
@media (min-width: 768px) {
    .cfc-calculator {
        display: flex;
        flex-wrap: wrap;
        /* adjustable gap between columns/rows */
        --cfc-columns-gap: 24px;
        gap: var(--cfc-columns-gap, 24px);
    }
    .cfc-calculator .cfc-title {
        flex: 0 0 100%;
    }
    .cfc-calculator .cfc-form {
        /* 55% default; can be overridden via site CSS if needed */
        flex: 1 1 55%;
        min-width: 300px;
    }
    .cfc-calculator .cfc-results {
        /* 45% default */
        flex: 1 1 45%;
        min-width: 260px;
    }
}

