/* Mortgage Calculator Layout Fixes */

/* Main container fixes */
.calculator-page.mortgage-calculator-page {
    position: relative;
    overflow: visible;
}

/* Fix for overlapping content */
.calculator-section {
    background-color: transparent;
    position: relative;
    z-index: 2;
    width: 100%;
}

/* Ensure results section has proper background and spacing */
.results-section {
    background-color: transparent;
    padding: 0;
    margin: 30px 0;
    position: relative;
    z-index: 10;
    width: 100%;
    clear: both;
}

.results-card {
    background: white !important;
    position: relative;
    z-index: 11;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

/* Ensure pie chart doesn't overflow */
.payment-chart {
    background-color: #f9f9f9;
    border: none;
    overflow: hidden;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
}

#paymentPieChart {
    display: block;
    max-width: 200px !important;
    max-height: 200px !important;
    width: 200px;
    height: 200px;
}

/* Ensure proper separation between sections */
.amortization-section {
    background: white !important;
    margin-top: 20px;
    position: relative;
    z-index: 9;
}

/* Fix SEO content positioning */
.seo-content {
    margin-top: 100px !important;
    padding-top: 60px !important;
    position: relative;
    z-index: 1;
    background-color: #fff !important;
    clear: both;
    width: 100%;
}

/* Create separation between calculator and SEO content */
.calculator-container {
    padding-bottom: 50px;
    min-height: auto;
}

/* Ensure calculator container contains all floated elements */
.calculator-container::after {
    content: "";
    display: table;
    clear: both;
}

/* Fix for the content grid on smaller screens */
@media (max-width: 992px) {
    .content-grid {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: relative;
        top: auto;
        margin-top: 30px;
    }
}

/* Additional spacing for results elements */
.monthly-payment-display {
    background-color: #5cb85c !important;
    position: relative;
    z-index: 15;
}

.payment-breakdown,
.summary-table,
.latest-rates {
    position: relative;
    background-color: white;
    z-index: 5;
}

/* Ensure all text is readable */
.results-section * {
    color: inherit;
    position: relative;
}

/* Fix table backgrounds */
.breakdown-table {
    background-color: white;
}

.breakdown-table th {
    background-color: #f9f9f9 !important;
}

.breakdown-table td {
    background-color: white;
}

.mortgage-payment-row {
    background-color: #f0f7ff !important;
}

/* Fix the main content area to contain everything properly */
.calculator-page main {
    display: block;
    position: relative;
}

/* Ensure content grid contains floated elements */
.content-grid {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 50px;
}

/* Make sure calculator section takes proper space */
.calculator-section > div:last-child {
    margin-bottom: 0;
}

/* Add clear separator after results */
.results-section::after {
    content: "";
    display: block;
    height: 50px;
    clear: both;
}
