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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background-color: #f8f9fa;
}

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

.analyzer-page .container {
    max-width: 1400px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    background: linear-gradient(135deg, #4a90e2 0%, #5ca0f2 100%);
    color: white;
    border-radius: 10px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Form Styles */
.calculator-form {
    background: white;
    padding: 50px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4a90e2;
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 0.875rem;
    color: #718096;
}

.btn-calculate {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #4a90e2 0%, #5ca0f2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 144, 226, 0.3);
}

/* Info Section */
.info-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.info-section h3 {
    margin-bottom: 20px;
    color: #4a5568;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 10px 0;
    padding-left: 25px;
    position: relative;
}

.info-section li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4a90e2;
    font-weight: bold;
}

/* Results Page */
.results-summary {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.results-summary h2 {
    margin-bottom: 30px;
    color: #2d3748;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.summary-item {
    padding: 25px;
    background: #f7fafc;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 75px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
    gap: 15px;
}

.summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.summary-item.highlight {
    background: linear-gradient(135deg, #4a90e2 0%, #5ca0f2 100%);
    color: white;
}

.summary-item.highlight .label,
.summary-item.highlight .value {
    color: white;
}

.summary-item .label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.95rem;
    letter-spacing: 0.025em;
    flex: 1;
    text-align: left;
}

.summary-item .value {
    font-weight: 700;
    font-size: 1.2rem;
    color: #2d3748;
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

.summary-item .value.negative {
    color: #dc3545;
}

.total-cost {
    margin-top: 40px;
    padding: 30px;
    background: #f7fafc;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
}

.total-cost h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

.cost-breakdown {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.cost-item.total {
    border-top: 2px solid #cbd5e0;
    padding-top: 20px;
    font-size: 1.2rem;
}

.cost-item .value.negative {
    color: #dc3545;
}

.btn-back {
    display: block;
    margin: 40px auto 0;
    padding: 15px 30px;
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    font-weight: 600;
    max-width: 300px;
}

.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-analyzer {
    display: block;
    margin: 0 auto 20px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    font-weight: 600;
    max-width: 300px;
}

.btn-analyzer:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

/* Amortization Table */
.amortization-section {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.amortization-section h2 {
    margin-bottom: 10px;
    color: #2d3748;
}

.schedule-note {
    margin-bottom: 30px;
    color: #718096;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.amortization-table th {
    background: #495057;
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.amortization-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.amortization-table tr:hover {
    background: #f7fafc;
}

.amortization-table tr.year-end {
    border-bottom: 2px solid #cbd5e0;
}

/* Navigation */
.nav-links {
    text-align: center;
    margin-bottom: 30px;
}

.analyzer-link {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.analyzer-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

/* Analyzer Styles */
.analyzer-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.analyzer-header {
    margin-bottom: 30px;
}

.analyzer-header h2 {
    color: #2d3748;
    margin-bottom: 10px;
}

.analyzer-header p {
    color: #718096;
    margin-bottom: 20px;
}

.analyzer-form {
    margin-bottom: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 25px;
}

.chart-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    height: 400px;
}

.chart-container h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

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

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.comparison-table th {
    background: #495057;
    color: white;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
}

.comparison-table td {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;
}

.comparison-table tr:hover {
    background: #f7fafc;
}

.comparison-table .highlight-row {
    background: #e3f2fd;
}

.comparison-table .has-pmi {
    color: #dc3545;
}

.comparison-table .positive-benefit {
    color: #28a745;
    font-weight: 600;
}

.comparison-table .negative-benefit {
    color: #dc3545;
    font-weight: 600;
}

.scenarios-table {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow-x: auto;
}

.scenarios-table h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

.insights {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.insights h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

.insight-card {
    background: #f7fafc;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 5px solid #4a90e2;
    transition: transform 0.2s, box-shadow 0.2s;
}

.insight-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.insight-card h4 {
    margin-bottom: 10px;
    color: #2d3748;
}

.insight-card p {
    color: #4a5568;
    line-height: 1.6;
}

/* Calculation Breakdown Styles */
.calculation-breakdown {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.calculation-breakdown h3 {
    margin-bottom: 20px;
    color: #2d3748;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-help {
    padding: 8px 16px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.toggle-help:hover {
    background: #357abd;
}

.help-content {
    margin-top: 20px;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.help-card {
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
}

.help-card h4 {
    margin-bottom: 10px;
    color: #2d3748;
    font-size: 1.1rem;
}

.help-card p {
    margin-bottom: 8px;
    color: #4a5568;
    line-height: 1.6;
}

.help-card p strong {
    color: #2d3748;
}

.example-calculation {
    background: #e6f3ff;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #4a90e2;
}

.example-calculation h4 {
    margin-bottom: 15px;
    color: #2d3748;
}

.example-calculation ul {
    list-style: none;
    padding-left: 0;
}

.example-calculation li {
    padding: 5px 0;
    color: #4a5568;
}

.example-calculation li strong {
    color: #2d3748;
    font-size: 1.1rem;
}

/* Simplified Comparison Styles */
.comparison-overview {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.comparison-overview h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2d3748;
}

.scenarios-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.scenario-card {
    background: #f7fafc;
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 400px;
}

.scenario-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.scenario-card h3 {
    margin-bottom: 20px;
    color: #2d3748;
    text-align: center;
    font-size: 1.3rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
    min-height: 45px;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-item .label {
    font-weight: 500;
    color: #4a5568;
}

.detail-item .value {
    font-weight: 600;
    color: #2d3748;
}

.detail-item .value.highlight {
    color: #4a90e2;
    font-size: 1.1rem;
}

.detail-item .value.pmi {
    color: #dc3545;
}

.investment-analysis {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.investment-analysis h2 {
    margin-bottom: 25px;
    color: #2d3748;
    text-align: center;
}

.investment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.investment-item {
    background: #f7fafc;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid #e2e8f0;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.investment-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.investment-item.net-benefit {
    border: 2px solid #4a90e2;
    background: #e6f3ff;
}

.investment-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.investment-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #2d3748;
}

.investment-note {
    font-size: 0.75rem;
    color: #718096;
    line-height: 1.4;
}

.recommendation-box {
    background: linear-gradient(135deg, #4a90e2 0%, #5ca0f2 100%);
    color: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
}

.recommendation-box h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.recommendation-box p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.recommendation-box .calculation-summary {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 60px;
    padding: 20px 0;
    color: #718096;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .calculator-form,
    .results-summary,
    .amortization-section {
        padding: 25px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .scenarios-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .scenario-card {
        min-height: auto;
        padding: 25px;
    }
    
    .investment-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .amortization-table {
        font-size: 0.875rem;
    }
    
    .amortization-table th,
    .amortization-table td {
        padding: 8px;
    }
}

/* Detailed Analysis Box - Added for rent vs buy analysis */
.detailed-analysis-box {
    margin-top: 40px;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.detailed-analysis-box h3 {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 25px;
    text-align: center;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
}

.analysis-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
}

.analysis-section h4 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.warning-box {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
    color: #742a2a;
}

.info-box {
    background: #ebf8ff;
    border: 1px solid #90cdf4;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
    color: #2a4e7c;
}

.comparison-table {
    overflow-x: auto;
    margin-top: 15px;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th {
    background: #4a90e2;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.comparison-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.comparison-table tr:hover {
    background: #f7fafc;
}

.comparison-table tr.highlight-row {
    background: #ebf8ff;
    font-weight: bold;
}

.comparison-table tr.highlight-row td {
    border-top: 2px solid #4a90e2;
}

.extreme-rent-warning {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    border-radius: 8px;
}

.extreme-rent-warning h4 {
    color: #dc2626;
}

.warning-text {
    color: #dc2626;
    font-weight: 600;
}

.success-text {
    color: #059669;
    font-weight: 600;
}

/* Scenario Summary - Beginner-friendly presentation */
.scenario-summary {
    background: #f7fafc;
    padding: 35px;
    border-radius: 12px;
    margin-top: 30px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.scenario-summary h3 {
    color: #2d3748;
    font-size: 1.4rem;
    margin-bottom: 15px;
    text-align: center;
}

.scenario-intro {
    text-align: center;
    color: #4a5568;
    margin-bottom: 25px;
    font-size: 1.05rem;
}

.path-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.path-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.buying-path {
    border-top: 4px solid #4a90e2;
}

.renting-path {
    border-top: 4px solid #28a745;
}

.path-section h4 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.buying-path h4 {
    color: #4a90e2;
}

.renting-path h4 {
    color: #28a745;
}

.path-section ul {
    list-style: none;
    padding: 0;
}

.path-section li {
    padding: 12px 0;
    line-height: 1.8;
    color: #2d3748;
    border-bottom: 1px solid #f1f5f9;
}

.path-section li:last-child {
    border-bottom: none;
}

.path-section li strong {
    color: #1a202c;
    font-size: 0.95rem;
}

.explanation {
    display: block;
    font-size: 0.85rem;
    color: #718096;
    margin-top: 4px;
    font-style: italic;
}

.final-amount {
    display: block;
    font-size: 1.15rem;
    font-weight: bold;
    margin-top: 8px;
    padding: 10px;
    background: #ebf8ff;
    border-radius: 6px;
    color: #2b6cb0;
}

.final-amount.negative-amount {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.result-summary {
    text-align: center;
}

.winner-box {
    background: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.winner-box.buying {
    border: 2px solid #4a90e2;
}

.winner-box.renting {
    border: 2px solid #28a745;
}

.winner-box h4 {
    margin-bottom: 12px;
    font-size: 1.2rem;
    color: #2d3748;
}

.winner-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #2d3748;
}

.simple-note {
    background: #fffbeb;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #4a5568;
}

@media (max-width: 768px) {
    .path-comparison {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}
