/* Global Styles */
:root {
    --primary-color: #546e7a; /* Neutral blue-gray */
    --secondary-color: #78909c; /* Lighter blue-gray */
    --accent-color: #26a69a; /* Teal accent color */
    --accent-hover: #2bbbad; /* Lighter teal for hover */
    --light-color: #f8f9fa;
    --dark-color: #37474f; /* Darker shade of primary */
    --gray-color: #78909c;
    --border-color: #eceff1;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --border-radius: 8px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f5f7fa;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23546e7a' fill-opacity='0.03' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E");
    padding: 0;
    margin: 0;
}

/* Add Inter font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px 20px;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--dark-color);
}

h1 {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

h2 {
    font-size: 1.4rem;
    color: var(--primary-color);
    position: relative;
    padding-left: 0.8rem;
    margin-bottom: 1.4rem;
    font-weight: 500;
    letter-spacing: 0;
    display: flex;
    align-items: center;
}

h2::before {
    content: '';
    position: absolute;
    left: 0;
    height: 1.4rem;
    width: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

h4 {
    font-size: 1.2rem;
}

/* Add space between sections for better visual separation */
section {
    margin-bottom: 2.5rem;
    padding-top: 0.5rem;
    position: relative;
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23546e7a' fill-opacity='0.03' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E");
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Special styling for metrics section */
#metrics-section {
    background: linear-gradient(to right, rgba(84, 110, 122, 0.08), rgba(38, 166, 154, 0.08));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23546e7a' fill-opacity='0.04' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E"), linear-gradient(to right, rgba(84, 110, 122, 0.08), rgba(38, 166, 154, 0.08));
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
    margin-top: 1rem;
}

.metric-tile {
    background-color: #f8fafc;
    border-radius: var(--border-radius);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border-bottom: 3px solid var(--accent-color);
}

.metric-tile h4 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-color);
    margin-bottom: 0.5rem;
}

.metric-tile p {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent-color);
    margin: 0;
}

.tile-icon-container {
    margin-bottom: 0.8rem;
}

section:last-child {
    margin-bottom: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(84, 110, 122, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    font-weight: 500;
}

.btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(38, 166, 154, 0.2);
}

.btn-primary {
    background-color: var(--accent-color);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

/* Tables */
/* Basic container for overflow */
.table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    border-radius: var(--border-radius);
    overflow: hidden;
}

thead {
    background-color: rgba(84, 110, 122, 0.05);
    color: var(--dark-color);
}

th {
    padding: 0.8rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

td {
    padding: 0.8rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: rgba(84, 110, 122, 0.03);
}

/* Schedule tabs styling */
.loan-selection-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.schedule-tab {
    padding: 0.6rem 1rem;
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--gray-color);
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.schedule-tab:hover {
    background-color: rgba(38, 166, 154, 0.05);
    border-color: rgba(38, 166, 154, 0.2);
    color: var(--accent-color);
}

.schedule-tab.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 2px 6px rgba(38, 166, 154, 0.2);
}

.schedule-tab-icon {
    margin-right: 0.5rem;
    display: inline-flex;
    align-items: center;
}

/* Monthly rows styling */
.monthly-detail-row {
    background-color: rgba(240, 245, 250, 0.5);
    font-size: 0.85rem;
}

.monthly-detail-row td {
    padding: 0.6rem 0.8rem;
    color: var(--gray-color);
}

.month-cell {
    padding-left: 1.5rem !important;
    font-weight: 500;
    color: var(--dark-color) !important;
}

/* Toggle buttons */
.btn-toggle-months {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-color);
    transition: all 0.2s ease;
}

.btn-toggle-months:hover {
    background-color: rgba(84, 110, 122, 0.1);
    color: var(--primary-color);
}

/* Error Message (Main page) */
.error-message {
    background-color: #ffeaea; /* Different background from modal version */
    border-left: 4px solid var(--accent-color);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    /* Ensure it's initially hidden via JS/HTML, not CSS */
}

.error-message h3 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}


/* Image Upload Styles (Used in Property Modal) */
.image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.image-preview {
    width: 100%;
    height: 180px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: #f8f9fa;
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-upload-controls {
    display: flex;
    gap: 0.8rem;
}

.file-input {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.file-label {
    background-color: var(--accent-color);
    color: white;
    display: inline-block;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    text-align: center;
    transition: var(--transition);
    flex: 1;
}

.file-label:hover {
    background-color: var(--accent-hover);
}

.btn-reset {
    background-color: var(--gray-color);
    font-size: 0.9rem;
    padding: 8px 16px;
    /* Inherits base .btn styles, override background */
}

.btn-reset:hover {
    background-color: #5a6268;
}

@media (min-width: 768px) {
    .image-upload-container {
        flex-direction: row;
        align-items: center;
    }

    .image-preview {
        width: 180px;
        flex-shrink: 0;
    }

    .image-upload-controls {
        flex: 1;
        flex-direction: column;
    }
}

/* --- Tab Pane Visibility --- */

/* Specific hover effect for monthly rows (lighter) */
.amortization-table tbody tr.monthly-detail-row:hover {
    background-color: #f0f3f5; /* Slightly lighter than the base #e9ecef for subtle hover */
}

/* Style the inserted monthly rows for visual distinction (Increased Specificity) */
.amortization-table tbody tr.monthly-detail-row {
  background-color: #e9ecef; /* Use a slightly more visible light grey */
  font-size: 0.9em;
}

/* Increased Specificity */
.amortization-table tbody tr.monthly-detail-row .month-cell {
  padding-left: 25px; /* Indent the month name */
  color: var(--gray-color); /* Keep the grey color */
}

/* Hide individual loan schedule panes by default */
#loans-schedules-container .loan-schedule {
  display: none;
}

/* Show the active individual loan schedule pane */
#loans-schedules-container .loan-schedule.active {
  display: block;
}

/* Checkbox group */
.checkbox-group input[type="checkbox"]:checked + label::before {
    border-color: var(--accent-color);
    background-color: var(--accent-color);
}
 
/* --- NEW: Toggle Switch Styles --- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 30px; /* Adjusted width */
    height: 16px; /* Target height */
    margin-right: 8px; /* Slightly less space */
    vertical-align: middle; /* Align with buttons */
}
 
.toggle-switch-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
}
 
.toggle-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc; /* Default off color */
    transition: .3s;
    border-radius: 24px; /* Fully rounded */
}
 
.toggle-switch-slider:before {
    position: absolute;
    content: "";
    height: 12px; /* Adjusted knob height */
    width: 12px; /* Adjusted knob width */
    left: 2px; /* Adjusted position */
    bottom: 2px; /* Adjusted position */
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
 
.toggle-switch-checkbox:checked + .toggle-switch-slider {
    background-color: var(--accent-color); /* Use accent color for 'on' */
}
 
.toggle-switch-checkbox:focus + .toggle-switch-slider {
    box-shadow: 0 0 1px var(--accent-color); /* Focus outline */
}
 
.toggle-switch-checkbox:checked + .toggle-switch-slider:before {
    transform: translateX(14px); /* Adjusted translation distance */
}
 
/* --- NEW: Disabled Strategy Tile Style --- */
.strategy-tile.strategy-disabled {
    opacity: 0.6;
    background-color: #f8f9fa; /* Slightly greyed out background */
    /* filter: grayscale(50%); Optional: Add grayscale effect */
}
 
.strategy-tile.strategy-disabled:hover {
    transform: none; /* Disable hover transform */
    box-shadow: var(--box-shadow); /* Reset hover shadow */
}