/* CalcWise Calculator Page Styles */

/* Main content */
main {
    padding: 60px 0;
    min-height: calc(100vh - 88px);
}

.page-header {
    text-align: center;
    margin-bottom: 48px;
}

h1 {
    font-size: 42px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 12px;
    letter-spacing: -1.5px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    min-height: 52px;
}

.description {
    font-size: 17px;
    color: #64748b;
    margin-bottom: 48px;
    line-height: 1.7;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    min-height: 58px;
}

/* Calculator Section */
.calc-section {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    padding: 48px;
    margin-bottom: 48px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    min-height: 600px;
    contain: layout;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.input-group {
    margin-bottom: 0;
}

.input-full {
    grid-column: span 2;
}

label {
    display: block;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select {
    width: 100%;
    padding: 14px 16px;
    background: #fafbfc;
    border: 2px solid #e2e8f0;
    color: #0f172a;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s;
    min-height: 52px;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.button-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.calc-button {
    flex: 1;
    padding: 18px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.calc-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.25);
    will-change: transform;
}

.reset-button {
    flex: 0 0 auto;
    padding: 18px 32px;
    background: #ffffff;
    color: #64748b;
    border: 2px solid #e2e8f0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-button:hover {
    border-color: #cbd5e1;
    color: #475569;
}

/* Result Display */
.result-display {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    padding: 40px;
    text-align: center;
    margin-top: 32px;
    display: none;
}

.result-display.show {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Prevent animation-induced layout shifts */
.result-display.show,
.chart-section.show,
.breakdown-section.show,
.amortization-section.show {
    will-change: opacity, transform;
}

.result-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 12px;
    font-weight: 600;
}

.result-value {
    font-size: 56px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 12px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-description {
    font-size: 16px;
    opacity: 0.95;
}

/* Chart Section */
.chart-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 32px;
    margin-top: 32px;
    display: none;
}

.chart-section.show {
    display: block;
    animation: fadeIn 0.4s ease;
}

.chart-section h4 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    min-height: 300px;
}

#resultChart {
    max-height: 400px;
    width: 100% !important;
    height: auto !important;
}

canvas#resultChart {
    display: block;
    box-sizing: border-box;
}
    max-width: 600px;
    height: 500px;
    margin: 20px auto;
}

.chart-wrapper canvas {
    display: block !important;
}

@media (max-width: 768px) {
    .chart-wrapper {
        height: 480px;
        max-width: 100%;
        padding-bottom: 20px;
    }
}

/* Page Metadata Badge - Compact */
.page-metadata {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: #f8fafc;
    border-left: 3px solid var(--primary);
    margin-bottom: 16px;
    margin-top: 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
    font-size: 12px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    min-height: 44px;
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #64748b;
}

.metadata-item strong {
    color: #0f172a;
    font-weight: 600;
}

.metadata-item .icon {
    font-size: 14px;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    border-radius: 3px;
    font-weight: 600;
    font-size: 11px;
}

/* Checkbox Group Styling */
.checkbox-group {
    margin: 16px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
    margin: 0;
}

.checkbox-label span {
    font-size: 14px;
    font-weight: 500;
    color: #475569;
}

/* Summary Comparison Layout */
.summary-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.summary-column {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    padding: 20px;
    border-radius: 8px;
}

.summary-column h5 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 16px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.savings-column.has-savings {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #10b981;
}

.savings-column.has-savings h5 {
    color: #10b981;
}

.savings-column.has-savings .savings-value {
    color: #10b981 !important;
    font-size: 18px !important;
}

.savings-column.no-savings {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-color: #94a3b8;
}

.savings-column.no-savings h5 {
    color: #64748b;
}

.savings-column.no-savings .savings-value {
    color: #64748b !important;
    font-size: 18px !important;
}

/* Amortization Schedule */
.amortization-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 32px;
    margin-top: 32px;
    display: none;
}

.amortization-section.show {
    display: block;
    animation: fadeIn 0.4s ease;
}

.amortization-section h4 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
    text-align: center;
}

.schedule-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.schedule-btn {
    padding: 10px 20px;
    background: #ffffff;
    color: #64748b;
    border: 2px solid #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.schedule-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.schedule-btn:hover:not(.active) {
    border-color: var(--primary-light);
    color: var(--primary);
}

.amortization-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    margin-bottom: 20px;
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.amortization-table thead {
    position: sticky;
    top: 0;
    background: var(--primary);
    color: #ffffff;
    z-index: 10;
}

.amortization-table th {
    padding: 14px 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.amortization-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.amortization-table tbody tr:hover {
    background: #f8fafc;
}

.amortization-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.amortization-table tbody tr:nth-child(even):hover {
    background: #f8fafc;
}

.amortization-table td {
    padding: 12px;
    font-size: 14px;
    color: #475569;
    white-space: nowrap;
}

.amortization-table td:first-child {
    font-weight: 600;
    color: #0f172a;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .page-metadata {
        flex-wrap: wrap;
        gap: 8px;
        min-height: 64px;
    }
    
    .summary-comparison {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .amortization-table {
        font-size: 12px;
    }
    
    .amortization-table th,
    .amortization-table td {
        padding: 8px 6px;
    }
    
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
}

/* Breakdown Section */
.breakdown-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 32px;
    margin-top: 24px;
    display: none;
}

.breakdown-section.show {
    display: block;
    animation: fadeIn 0.4s ease;
}

.breakdown-section h4 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
    text-align: center;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.breakdown-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

.breakdown-label {
    font-size: 14px;
    color: #64748b;
    font-weight: 600;
}

.breakdown-value {
    font-size: 20px;
    color: #0f172a;
    font-weight: 700;
}

.breakdown-percent {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* PDF Download */
.pdf-download {
    display: none;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.pdf-download.show {
    display: flex;
}

.pdf-download p {
    margin: 0;
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.pdf-btn {
    padding: 10px 20px;
    background: #ef4444;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pdf-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    will-change: transform;
}

/* Content Sections */
.content-section {
    margin-bottom: 48px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.content-section h2 {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.content-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 28px;
    margin-bottom: 12px;
}

.content-section p {
    color: #475569;
    line-height: 1.8;
    margin-bottom: 16px;
}

.content-section ul, .content-section ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.content-section li {
    color: #475569;
    line-height: 1.8;
    margin-bottom: 8px;
}

.formula-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 32px;
    margin: 24px 0;
}

.formula {
    font-family: 'Courier New', monospace;
    font-size: 22px;
    color: var(--primary);
    font-weight: 700;
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    margin-bottom: 24px;
}

.tips-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}

.tip-card {
    background: #f8fafc;
    padding: 20px;
    border-left: 3px solid var(--primary);
}

.tip-card strong {
    color: #0f172a;
    display: block;
    margin-bottom: 8px;
}

.tip-card p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.disclaimer {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 20px;
    margin: 40px 0;
}

.disclaimer p {
    color: #92400e;
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
}

/* Amortization Table Styles */
.table-toggle-section {
    margin-top: 24px;
    text-align: center;
}

.toggle-table-btn {
    padding: 12px 24px;
    background: #7c3aed;
    color: #ffffff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.toggle-table-btn:hover {
    background: #6d28d9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.toggle-icon {
    font-size: 16px;
}

.amortization-table-wrapper {
    margin-top: 24px;
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    padding: 24px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 2000px;
        padding-top: 24px;
        padding-bottom: 24px;
    }
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 14px;
}

.amortization-table thead {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: #ffffff;
}

.amortization-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.amortization-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.amortization-table tbody tr:hover {
    background: #f8fafc;
}

.amortization-table .highlight-row {
    background: #fef3c7;
    font-weight: 600;
}

.amortization-table .highlight-row:hover {
    background: #fde68a;
}

.year-cell {
    font-weight: 700;
    color: #7c3aed;
}

.currency-cell {
    font-family: 'Courier New', monospace;
    text-align: right;
}

.balance-cell {
    font-weight: 600;
    color: #0f172a;
}

.table-note {
    margin-top: 16px;
    padding: 12px 16px;
    background: #dbeafe;
    border-left: 3px solid #3b82f6;
    font-size: 13px;
    color: #1e40af;
    line-height: 1.6;
}

/* Scenario Cards */
.scenario-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 32px 0;
}

.scenario-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    padding: 24px;
    transition: all 0.2s;
}

.scenario-card:hover {
    border-color: #7c3aed;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
    transform: translateY(-2px);
}

.scenario-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #7c3aed;
}

.scenario-details p {
    font-size: 14px;
    color: #475569;
    margin-bottom: 8px;
    line-height: 1.6;
}

.scenario-result {
    background: #f8fafc;
    padding: 16px;
    margin: 16px 0;
    border-left: 3px solid #7c3aed;
}

.scenario-result p {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 6px;
}

.scenario-insight {
    background: #dbeafe;
    padding: 12px;
    margin-top: 12px;
    font-size: 13px !important;
    color: #1e40af !important;
    line-height: 1.6 !important;
    border-left: 3px solid #3b82f6;
}

/* Comparison Table */
.rate-comparison-table {
    margin: 24px 0;
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.comparison-table th,
.comparison-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.comparison-table thead {
    background: #f8fafc;
}

.comparison-table th {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #0f172a;
}

.comparison-table tbody tr:hover {
    background: #f8fafc;
}

.comparison-table td:nth-child(3),
.comparison-table td:nth-child(4) {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* Cost Breakdown */
.cost-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin: 24px 0;
}

.cost-item {
    background: #f8fafc;
    padding: 20px;
    border-left: 3px solid #7c3aed;
}

.cost-item p {
    font-size: 14px;
    color: #475569;
    margin-bottom: 12px;
    line-height: 1.6;
}

.cost-item strong {
    color: #0f172a;
}

.cost-item ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.cost-item li {
    font-size: 13px;
    color: #64748b;
    padding: 4px 0;
}

/* Loan Type Comparison Table */
.loan-type-comparison-wrapper {
    overflow-x: auto;
    margin: 24px 0;
}

.loan-type-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    font-size: 14px;
}

.loan-type-table th,
.loan-type-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.loan-type-table thead {
    background: #f8fafc;
}

.loan-type-table th {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #0f172a;
}

.loan-type-table tbody tr:hover {
    background: #f8fafc;
}

.loan-type-table .best-for-row {
    background: #dbeafe;
    font-weight: 600;
}

.loan-type-table .best-for-row:hover {
    background: #bfdbfe;
}

.loan-type-notes {
    margin-top: 24px;
    background: #f8fafc;
    padding: 24px;
    border-left: 3px solid #7c3aed;
}

.loan-type-notes h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #0f172a;
}

.loan-type-notes ul {
    list-style: none;
    padding: 0;
}

.loan-type-notes li {
    padding: 8px 0;
    line-height: 1.6;
}

/* Mortgage Points Comparison */
.points-comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 24px 0;
}

.points-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    padding: 24px;
}

.points-card.highlight {
    border-color: #7c3aed;
    background: #faf5ff;
}

.points-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.points-card.highlight h3 {
    border-bottom-color: #7c3aed;
}

.points-details p {
    font-size: 14px;
    color: #475569;
    margin-bottom: 8px;
    line-height: 1.6;
}

.points-savings {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid #7c3aed;
}

.points-savings p {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 6px;
}

/* Rent vs Buy Comparison */
.rent-buy-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin: 32px 0;
}

.rent-buy-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    padding: 24px;
}

.rent-buy-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #7c3aed;
}

.cost-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cost-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: #475569;
}

.cost-item-row.total {
    border-top: 2px solid #e2e8f0;
    border-bottom: 2px solid #e2e8f0;
    padding: 12px 0;
    margin: 8px 0;
}

.cost-item-row.equity {
    color: #059669;
    font-weight: 600;
}

.cost-item-row.net {
    background: #f8fafc;
    padding: 12px;
    margin-top: 8px;
    font-size: 16px;
}

.cost-amount {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #0f172a;
}

.rent-buy-verdict {
    margin-top: 32px;
    background: #f8fafc;
    padding: 24px;
    border-left: 3px solid #7c3aed;
}

.rent-buy-verdict h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #0f172a;
}

.rent-buy-verdict h4 {
    font-size: 16px;
    margin: 20px 0 12px 0;
    color: #0f172a;
}

/* Warning Section */
.warning-section {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    padding: 32px;
    margin: 48px auto;
}

.warning-section h2 {
    color: #92400e;
}

.warning-section > p {
    color: #78350f;
    font-size: 16px;
    margin-bottom: 24px;
}

.warning-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 24px 0;
}

.warning-card {
    background: #ffffff;
    border: 2px solid #f59e0b;
    padding: 20px;
}

.warning-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: #dc2626;
    margin-bottom: 12px;
}

.warning-content p {
    font-size: 14px;
    color: #475569;
    margin-bottom: 10px;
    line-height: 1.6;
}

.warning-content strong {
    color: #0f172a;
}

.warning-summary {
    background: #ffffff;
    border: 2px solid #f59e0b;
    padding: 24px;
    margin-top: 24px;
}

.warning-summary h3 {
    font-size: 18px;
    color: #92400e;
    margin-bottom: 16px;
}

.warning-summary ul {
    list-style: none;
    padding: 0;
}

.warning-summary li {
    padding: 6px 0;
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
}

/* Affordability Calculator */
.affordability-section {
    background: #f0fdf4;
    border: 2px solid #10b981;
    padding: 32px;
}

.affordability-calculator-compact {
    background: #ffffff;
    border: 1px solid #d1fae5;
    padding: 24px;
    margin: 20px 0;
}

.affordability-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: end;
}

.input-group-compact label {
    display: block;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group-compact input {
    width: 100%;
    padding: 12px 14px;
    background: #fafbfc;
    border: 2px solid #e2e8f0;
    color: #0f172a;
    font-size: 16px;
    font-family: inherit;
}

.afford-calc-btn {
    padding: 12px 24px;
    background: #10b981;
    color: #ffffff;
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.afford-calc-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.affordability-results {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

.afford-result-card {
    background: #f0fdf4;
    border: 2px solid #10b981;
    padding: 16px;
    text-align: center;
}

.afford-label {
    font-size: 12px;
    font-weight: 600;
    color: #047857;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.afford-value {
    font-size: 24px;
    font-weight: 900;
    color: #065f46;
    font-family: 'Courier New', monospace;
}

.affordability-note {
    margin-top: 16px;
    padding: 12px;
    background: #d1fae5;
    border-left: 3px solid #10b981;
    font-size: 13px;
    color: #065f46;
    line-height: 1.6;
}

/* Sources and Methodology */
.sources-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 24px 0;
}

.source-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 20px;
}

.source-item h4 {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.source-item p {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.methodology-note {
    background: #dbeafe;
    border: 2px solid #3b82f6;
    padding: 20px;
    margin: 24px 0;
}

.methodology-note h4 {
    font-size: 16px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 12px;
}

.methodology-note p {
    font-size: 14px;
    color: #1e40af;
    line-height: 1.7;
    margin: 0;
}

.external-resources {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-top: 24px;
}

.external-resources h4 {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
}

.external-resources ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.external-resources li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.external-resources li:last-child {
    border-bottom: none;
}

.external-resources a {
    color: #7c3aed;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.external-resources a:hover {
    color: #6d28d9;
    text-decoration: underline;
}

.external-resources a::before {
    content: '→';
    margin-right: 8px;
    font-weight: 700;
}

/* Related Calculators */
.related-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 32px;
    margin: 48px 0;
}

.related-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.related-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.related-link:hover {
    background: #ffffff;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(4px);
    will-change: transform;
}

.related-link::before {
    content: '→';
    margin-right: 12px;
    font-weight: 700;
}

/* FAQ Section */
.faq-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 32px;
    margin: 48px 0;
}

.faq-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 24px;
}

.faq-item {
    border-bottom: 1px solid #e2e8f0;
    padding: 20px 0;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #0f172a;
    user-select: none;
    transition: color 0.2s;
}

.faq-question:hover {
    color: var(--primary);
}

.faq-toggle {
    font-size: 20px;
    color: var(--primary);
    transition: transform 0.3s;
    will-change: transform;
}

.faq-item.active .faq-toggle {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer-content {
    padding-top: 12px;
    color: #64748b;
    line-height: 1.8;
}

/* Share Bar */
.share-bar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.share-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.share-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.share-btn {
    padding: 6px 12px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    color: #475569;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.share-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    will-change: transform;
}

/* Rating System */
.rating-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating-score {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.rating-details {
    display: flex;
    flex-direction: column;
}

.rating-stars {
    font-size: 16px;
    color: #fbbf24;
    letter-spacing: 2px;
}

.rating-count {
    font-size: 11px;
    color: #64748b;
}

.rating-prompt {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating-prompt p {
    font-size: 12px;
    color: #475569;
    font-weight: 600;
    margin: 0;
}

.star-rating {
    display: flex;
    gap: 4px;
}

.star {
    font-size: 20px;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
}

.star:hover,
.star.active {
    color: #fbbf24;
    transform: scale(1.1);
    will-change: transform;
}

.rating-thanks {
    display: none;
    padding: 6px 12px;
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
    font-weight: 600;
    font-size: 12px;
}

.rating-thanks.show {
    display: block;
}

/* Mobile responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 32px;
        min-height: 40px;
    }

    .calc-section {
        padding: 24px;
        min-height: 800px;
    }
    
    .description {
        min-height: 80px;
    }
    
    .breadcrumb {
        min-height: 32px;
    }

    .input-grid {
        grid-template-columns: 1fr;
    }

    .input-full {
        grid-column: span 1;
    }

    .button-row {
        flex-direction: column;
    }

    .result-value {
        font-size: 42px;
    }

    .tips-grid, .related-grid {
        grid-template-columns: 1fr;
    }

    .share-bar {
        padding: 10px 12px;
        gap: 8px;
    }

    .share-label {
        font-size: 12px;
    }

    .share-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .rating-section {
        padding: 10px 12px;
        gap: 12px;
    }

    .rating-score {
        font-size: 24px;
    }

    .rating-stars {
        font-size: 14px;
    }

    .star {
        font-size: 18px;
    }
    
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
    
    .pdf-download {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .pdf-btn {
        width: 100%;
    }
    
    /* Make chart larger on mobile for readability */
    .chart-wrapper {
        min-height: 500px !important;
        height: 500px !important;
    }
    
    #resultChart {
        max-height: none !important;
        height: 500px !important;
    }
    
    .chart-section {
        padding: 24px 16px !important;
    }
    
    /* New Mortgage Calculator Elements - Mobile */
    .scenario-grid {
        grid-template-columns: 1fr;
    }
    
    .scenario-card {
        padding: 20px;
    }
    
    .scenario-card h3 {
        font-size: 16px;
    }
    
    .comparison-table {
        font-size: 11px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 8px 6px;
    }
    
    .cost-breakdown {
        grid-template-columns: 1fr;
    }
    
    .amortization-table {
        font-size: 11px;
    }
    
    .amortization-table th,
    .amortization-table td {
        padding: 8px 6px;
    }
    
    .toggle-table-btn {
        font-size: 12px;
        padding: 10px 16px;
    }
    
    .amortization-table-wrapper {
        padding: 16px;
    }
    
    /* New Features - Mobile */
    .loan-type-table {
        font-size: 11px;
    }
    
    .loan-type-table th,
    .loan-type-table td {
        padding: 8px 6px;
    }
    
    .points-comparison-grid {
        grid-template-columns: 1fr;
    }
    
    .rent-buy-comparison {
        grid-template-columns: 1fr;
    }
    
    .warning-grid {
        grid-template-columns: 1fr;
    }
    
    .warning-card {
        padding: 16px;
    }
    
    .warning-section {
        padding: 20px;
    }
    
    /* Affordability Calculator - Mobile */
    .affordability-inputs {
        grid-template-columns: 1fr;
    }
    
    /* Sources Section - Mobile */
    .sources-grid {
        grid-template-columns: 1fr;
    }
    
    .afford-calc-btn {
        width: 100%;
    }
    
    .affordability-results {
        grid-template-columns: 1fr;
    }
    
    .afford-value {
        font-size: 20px;
    }
}

/* Extra small screens - Chart must be visible */
@media (max-width: 480px) {
    .chart-wrapper {
        min-height: 450px !important;
        height: 450px !important;
        width: 100% !important;
        overflow: visible !important;
    }
    
    #resultChart {
        min-height: 450px !important;
        height: 450px !important;
        width: 100% !important;
    }
    
    canvas#resultChart {
        min-height: 450px !important;
        height: 450px !important;
        width: 100% !important;
    }
}

/* BMI Calculator Specific Styles */
.health-metrics {
    margin-top: 24px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.health-metrics h4 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 16px;
    text-align: center;
}

/* BMI Chart Styles */
.bmi-chart-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 0;
}

.bmi-chart {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 30px;
}

.bmi-range {
    display: flex;
    align-items: center;
    position: relative;
    height: 60px;
}

.bmi-range-bar {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: relative;
    transition: all 0.3s ease;
}

.bmi-range-bar.underweight {
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
}

.bmi-range-bar.normal {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.bmi-range-bar.overweight {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.bmi-range-bar.obese {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
}

.bmi-range-label {
    font-weight: 700;
    font-size: 14px;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.bmi-range-values {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

/* BMI Marker */
.bmi-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: none;
}

.bmi-marker.show {
    display: block;
    animation: markerPop 0.5s ease;
}

@keyframes markerPop {
    0% { transform: translate(-50%, -50%) scale(0); }
    60% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.bmi-marker-dot {
    width: 24px;
    height: 24px;
    background: #ffffff;
    border: 4px solid #0f172a;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bmi-marker-label {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.bmi-marker-label::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #0f172a;
}

/* BMI Legend */
.bmi-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.bmi-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 4px;
}

.bmi-legend-color {
    width: 32px;
    height: 24px;
    border-radius: 2px;
    flex-shrink: 0;
}

.bmi-legend-text {
    font-size: 13px;
    color: #475569;
}

.bmi-legend-text strong {
    display: block;
    color: #0f172a;
    font-size: 14px;
}

/* Mobile BMI adjustments */
@media (max-width: 768px) {
    .bmi-legend {
        grid-template-columns: 1fr;
    }

    .bmi-range {
        height: 50px;
    }

    .bmi-range-label {
        font-size: 12px;
    }

    .bmi-range-values {
        font-size: 10px;
    }
    
    .bmi-marker-label {
        font-size: 12px;
        padding: 4px 8px;
    }
}

/* Loan Calculator Specific Styles */
.breakdown-compact{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;padding:16px;background:#f8fafc;border-radius:8px;margin-bottom:16px}
.breakdown-item-compact{display:flex;flex-direction:column;gap:6px;align-items:center;text-align:center}
.breakdown-label-compact{font-size:12px;color:#64748b;font-weight:600;text-transform:uppercase;letter-spacing:.5px}
.breakdown-value-compact{font-size:20px;font-weight:700;color:#0f172a}
.savings-highlight{background:linear-gradient(135deg,#10b981,#059669);color:#fff;padding:20px;border-radius:8px;margin-top:16px}
.savings-content{display:flex;align-items:center;gap:16px}
.savings-icon{font-size:36px;flex-shrink:0}
.savings-text{flex:1}
.savings-amount{font-size:24px;font-weight:700;margin-bottom:4px}
.savings-time{font-size:14px;opacity:.9}
.quick-fill-buttons{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap}
.quick-fill-btn{padding:6px 12px;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:4px;font-size:13px;cursor:pointer;color:#64748b;font-weight:500}
.quick-fill-btn:hover{background:#e2e8f0;border-color:#cbd5e1}
.try-example-btn{width:100%;margin-top:12px;padding:10px;background:#7c3aed;color:#fff;border:none;border-radius:6px;font-weight:600;cursor:pointer;transition:all .2s}
.try-example-btn:hover{background:#6d28d9;transform:translateY(-2px);box-shadow:0 4px 12px rgba(124,58,237,.3)}
.section-divider{height:1px;background:linear-gradient(90deg,transparent,#e2e8f0 50%,transparent);margin:60px 0}
.jump-nav{background:#fff;border:2px solid #e2e8f0;border-radius:8px;padding:24px;margin:48px auto;max-width:fit-content}
.jump-nav h3{margin:0 0 16px;font-size:18px;color:#0f172a;text-align:center}
.jump-nav-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.jump-link{padding:10px 16px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:6px;text-decoration:none;color:#475569;font-size:14px;font-weight:500;transition:all .2s;display:flex;align-items:center;justify-content:center;text-align:center;min-height:44px}
.jump-link:hover{background:#f0f9ff;border-color:#0ea5e9;color:#0c4a6e}
.collapsible-section{margin:48px 0;display:flex;flex-direction:column;align-items:center}
.collapsible-header{display:flex;justify-content:space-between;align-items:center;cursor:pointer;user-select:none;padding:16px 20px;background:#fff;border:2px solid #e2e8f0;border-radius:8px;transition:all .2s;box-shadow:0 2px 8px rgba(0,0,0,.05);width:600px;max-width:100%}
.collapsible-header:hover{background:#fafbfc;border-color:#cbd5e1;box-shadow:0 4px 12px rgba(0,0,0,.08)}
.collapsible-header h2{font-size:20px}
.collapsible-content{margin-top:16px;overflow:hidden;transition:max-height .3s ease;background:#fff;border:2px solid #e2e8f0;border-top:none;border-radius:0 0 8px 8px;padding:0 20px;width:600px;max-width:100%}
.back-to-top{position:fixed;bottom:30px;right:30px;width:50px;height:50px;background:var(--primary);color:#fff;border:none;border-radius:50%;font-size:24px;cursor:pointer;display:none;align-items:center;justify-content:center;box-shadow:0 4px 12px rgba(124,58,237,.4);transition:all .3s;z-index:999}
.back-to-top:hover{background:var(--primary-dark);transform:translateY(-3px);box-shadow:0 6px 16px rgba(124,58,237,.5)}
.back-to-top.show{display:flex}
.how-to-use-section{background:#f8fafc;border:2px solid #e2e8f0;padding:32px;margin:48px auto;max-width:900px}
.term-toggle{padding:6px 12px;border:none;border-radius:4px;font-size:13px;font-weight:600;cursor:pointer;transition:all .2s}
.term-toggle.active{background:#7c3aed;color:#fff}

@media(max-width:768px){
.breakdown-compact{grid-template-columns:1fr;gap:12px;padding:16px}
.breakdown-value-compact{font-size:18px}
.savings-amount{font-size:18px}
.quick-fill-buttons{justify-content:space-between}
.quick-fill-btn{flex:1;min-width:60px}
.amortization-table-wrapper{margin-left:-24px;margin-right:-24px;overflow-x:auto}
.amortization-section{padding-left:12px!important;padding-right:12px!important}
.jump-nav{max-width:100%}
.jump-nav-grid{grid-template-columns:repeat(2,1fr)}
.jump-link{font-size:13px;padding:8px 12px}
.collapsible-title{font-size:16px!important;line-height:1.3}
.back-to-top{bottom:20px;right:20px;width:45px;height:45px;font-size:20px}
.section-divider{margin:40px 0}
}

/* Print styles for PDF */
@media print {
    header, footer, .share-bar, .rating-section, .pdf-download, nav {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .calc-section, .result-display, .breakdown-section, .chart-section {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .result-display {
        background: #7c3aed !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    h1 {
        margin-top: 0;
    }
    
    .button-row {
        display: none;
    }
}
