/* Main Styles for Rent vs Buy Calculator */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    width: 95%;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #2980b9;
    margin-bottom: 5px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1em;
}

h2 {
    color: #2980b9;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e0e0e0;
}

h3 {
    color: #3498db;
    margin-bottom: 10px;
}

h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

/* Calculator Container */
.calculator-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 30px;
}

/* Inputs Container */
.inputs-container {
    flex: 0 0 30%;
    min-width: 350px;
}

.input-section {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.input-group label {
    font-weight: 500;
    padding-right: 10px;
    display: inline-block;
}

.input-group .label-container {
    width: 50%;
    display: inline-block;
    vertical-align: top;
}

.input-group .input-container {
    width: 50%;
    display: inline-block;
    vertical-align: top;
}

.input-group input[type="number"],
.input-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

/* Right-align numeric inputs */
.input-group input[type="number"] {
    text-align: right;
}

/* Special case for checkbox which should not use the same layout */
.input-group input[type="checkbox"] {
    width: auto;
}

.input-group input[type="checkbox"] {
    margin-right: 5px;
}

.input-help {
    font-size: 0.85em;
    color: #7f8c8d;
    margin-top: 5px;
    display: block;
    margin-bottom: 10px;
}

/* Slider Styles */
.slider-container {
    margin-top: 10px;
    position: relative;
    width: 100%;
}

.slider-container input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #7f8c8d;
}

/* Party Inputs */
.party-inputs {
    border-left: 3px solid #3498db;
    padding-left: 15px;
    margin-bottom: 15px;
}

.income-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.income-group input {
    flex: 1;
    margin-right: 10px;
}

.tax-rate-display {
    background-color: #f8f9fa;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Results Container */
.results-container {
    flex: 1;
    min-width: 650px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#calculate-btn {
    background-color: #2980b9;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

#calculate-btn:hover {
    background-color: #3498db;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* Summary Table */
.summary-table-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 15px;
    margin-bottom: 20px;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table th, .summary-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.summary-table th:first-child, .summary-table td:first-child {
    width: 50%;
}

.buy-column {
    color: #2980b9;
    background-color: rgba(41, 128, 185, 0.05);
}

.rent-column {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.05);
}

/* Chart Container */
.chart-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    height: 450px;
}

.chart-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.chart-container canvas {
    max-height: 380px;
}

/* Detailed Results */
.detailed-results {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.9em;
    color: #7f8c8d;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #2980b9;
}

.tab-btn.active {
    color: #2980b9;
    border-bottom-color: #2980b9;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

/* Right-align numeric table cells and their headers */
td:not(:first-child),
th:not(:first-child) {
    text-align: right;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.category-header {
    background-color: #f8f9fa;
    font-weight: 600;
}

.subtotal, .total {
    font-weight: 600;
}

.total {
    background-color: #f8f9fa;
}

.positive-value {
    color: #27ae60;
}

.negative-value {
    color: #e74c3c;
}

/* Income & Expenditure Selector */
.income-expenditure-selector {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.income-expenditure-selector select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Sensitivity Analysis */
.sensitivity-controls {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sensitivity-controls select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    color: #7f8c8d;
    font-size: 0.9em;
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .calculator-container {
        flex-direction: column;
    }
    
    .inputs-container {
        flex: 1 0 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .input-section {
        flex: 1;
        min-width: 300px;
    }
    
    .results-container {
        flex: 1 0 100%;
    }
}

@media (max-width: 768px) {
    .calculator-container {
        flex-direction: column;
    }
    
    .inputs-container {
        flex-direction: column;
    }
    
    .summary-cards {
        flex-direction: column;
    }
    
    /* Adjust input groups for smaller screens */
    .input-group label {
        width: 100%;
        padding-right: 0;
        margin-bottom: 5px;
    }
    
    .input-group input[type="number"],
    .input-group input[type="text"] {
        width: 100%;
    }
    
    .slider-container,
    .input-help {
        margin-left: 0;
        padding-left: 0;
    }
    
    .chart-container {
        height: 300px;
    }
}

/* Chart with side info */
.chart-with-info {
    display: flex;
    height: 100%;
}

.chart-area {
    flex: 1;
    height: calc(100% - 15px); /* Account for the h3 margin-bottom */
}

/* Info Box Styles */
.info-box {
    background-color: #f8f9fa;
    border-left: 3px solid #3498db;
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 0 4px 4px 0;
}

.side-info {
    width: 20%;
    margin-left: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-height: 100%;
    overflow-y: auto;
}

.side-info h4 {
    margin-top: 0;
    color: #2980b9;
    font-size: 1em;
    margin-bottom: 10px;
}

.side-info p {
    margin-bottom: 5px;
    font-size: 0.9em;
}

.side-info p span {
    font-weight: bold;
    font-size: 1.2em;
    color: #2c3e50;
}

.info-box p {
    margin-bottom: 5px;
}

.info-box p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .chart-with-info {
        flex-direction: column;
    }
    
    .side-info {
        width: 100%;
        margin-left: 0;
        margin-top: 15px;
    }
}
