/* Import Google Font - Roboto */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

body {
    font-family: 'Roboto', Arial, Helvetica, sans-serif;
    font-size: 16px; /* Comfortable base font size */
    line-height: 1.6; /* Comfortable line height */
    margin: 0;
    padding: 0;
    background-color: #f0f2f5; /* Light grey background for the page */
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center main content block */
}

.main-container {
    width: 100%;
    max-width: 1200px; /* Max width for content on wide screens */
    padding: 20px;
    box-sizing: border-box;
}

h1 {
    color: #2c3e50; /* Darker blue for main heading */
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.5em; /* Larger main heading */
}

h2 {
    color: #34495e; /* Slightly lighter blue for section headings */
    border-bottom: 2px solid #bdc3c7; /* Subtler border */
    padding-bottom: 10px;
    margin-top: 50px; /* More space above section headings */
    margin-bottom: 30px;
    font-size: 1.8em;
}

h3 {
    color: #3498db; /* Blue for calculator sub-headings */
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.4em;
}

section {
    /* Sections are now logical groups, individual calculators are .calculator-section */
    margin-bottom: 30px;
}

.calculator-section {
    background-color: #ffffff; /* White background for calculator cards */
    border: 1px solid #e0e0e0; /* Light border */
    border-radius: 8px; /* Rounded corners */
    padding: 25px; /* Consistent padding */
    margin-bottom: 30px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05); /* Subtle box shadow */
    transition: box-shadow 0.3s ease;
}

.calculator-section:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); /* Slightly more pronounced shadow on hover */
}

.calculator-input {
    margin-bottom: 20px; /* More space between input groups */
}

.calculator-input label {
    display: block; /* Labels on their own line */
    margin-bottom: 8px; /* Space between label and input */
    font-weight: 500; /* Medium font weight for labels */
    color: #555;
}

input[type="text"],
input[type="number"],
select {
    width: 100%; /* Full width by default, will be adjusted by parent if needed */
    padding: 12px; /* More padding for easier interaction */
    margin-top: 0; /* Removed top margin as label has bottom margin */
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; 
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: #3498db; /* Blue border on focus */
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25); /* Subtle blue glow on focus */
    outline: none; /* Remove default outline */
}

button {
    background-color: #3498db; /* Primary blue color */
    color: white;
    padding: 12px 20px; /* More padding */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

button:hover {
    background-color: #2980b9; /* Darker blue on hover */
}

button:active {
    background-color: #2471a3; /* Even darker blue on active */
    transform: translateY(1px); /* Slight press effect */
}

.calculator-result {
    margin-top: 20px;
    padding: 15px;
    background-color: #e9f5ff; /* Light blue background for result area */
    border: 1px solid #b3d7ff; /* Blue border for result area */
    border-radius: 4px;
}

.calculator-result p {
    margin: 8px 0;
    font-size: 1.05em;
    color: #333;
}

.calculator-result span {
    font-weight: bold;
    color: #2c3e50; /* Darker color for result values */
}

/* Disclaimer and Notes Styling */
p[style*="font-size: 0.8em"], 
p[style*="font-size: 0.9em"] { /* Target existing inline styles for disclaimers */
    font-size: 0.9em !important; /* Standardize disclaimer font size */
    color: #6c757d !important; /* Muted color */
    font-style: italic;
    line-height: 1.4;
}

.info-section { /* For general informational text like in Insurance section */
    background-color: #f9f9f9;
    border-left: 4px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    border-radius: 0 4px 4px 0;
}

.info-section h3 {
    color: #3498db;
    margin-top: 0;
}

/* Table styling for Amortization */
#amortization_schedule_container table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#amortization_schedule_container th,
#amortization_schedule_container td {
    border: 1px solid #ddd;
    padding: 10px; /* More padding */
    text-align: left;
}

#amortization_schedule_container th {
    background-color: #3498db; /* Blue header for table */
    color: white;
    font-weight: 500;
}

#amortization_schedule_container tbody tr:nth-child(even) {
    background-color: #f9f9f9; /* Zebra striping for table rows */
}
#amortization_schedule_container tbody tr:hover {
    background-color: #f1f1f1;
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
    word-wrap: break-word; /* Ensure long formulas don't overflow */
}

/* Styling for Explanations and Formulas */
.calculator-explanation {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.formula-section {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.formula-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #34495e;
    font-size: 1.1em;
}

.formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap; /* To respect line breaks in formulas */
}


/* Responsive Design */
@media (max-width: 992px) { /* For tablets and smaller desktops */
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .formula-text {
        font-size: 0.85em; /* Slightly smaller for tablets */
    }
    .main-container {
        padding: 15px;
    }
    h1 {
        font-size: 2.2em;
    }
    h2 {
        font-size: 1.6em;
    }
    h3 {
        font-size: 1.3em;
    }
    .calculator-section {
        padding: 20px;
    }
}


/* For tablets */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }
    .main-container {
        padding: 10px;
    }
    h1 {
        font-size: 2em;
        margin-bottom: 30px;
    }
    h2 {
        font-size: 1.5em;
        margin-top: 40px;
        margin-bottom: 20px;
    }
     h3 {
        font-size: 1.2em;
    }
    .calculator-section {
        /* Already stacks by default due to block display */
    }
    input[type="text"],
    input[type="number"],
    select,
    button {
        font-size: 0.95em; /* Slightly smaller font for inputs on tablets */
    }
}

/* For mobile phones */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    h1 {
        font-size: 1.8em;
    }
    h2 {
        font-size: 1.3em;
    }
    h3 {
        font-size: 1.1em;
    }
    .calculator-section {
        padding: 15px;
        margin-bottom: 20px;
    }
    input[type="text"],
    input[type="number"],
    select,
    button {
        width: 100%;
        box-sizing: border-box;
        padding: 10px;
        font-size: 1em; /* Ensure font size is not too small for tapping */
    }
    .calculator-input label {
        margin-bottom: 6px;
    }
    .calculator-result {
        padding: 10px;
    }
    /* Specific adjustments for multi-column results if any, to stack */
    .calculator-result p {
        font-size: 1em;
    }
}
