/* --- Brand Colors (shared with MBA Calculator) --- */
:root {
    --primary: #1a365d;
    --primary-light: #2b6cb0;
    --accent: #e53e3e;
    --accent-gold: #C4A55A;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-light: #ffffff;
    --bg-page: #edf2f7;
    --bg-surface: #f7fafc;
    --bg-card: #ffffff;
    --border-color: #cbd5e0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --accent-fha: #dd9933;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    margin: 0;
    padding: 24px;
}

/* --- Header --- */
.header-container {
    text-align: center;
    margin-bottom: 32px;
}

.brand-header {
    margin-bottom: 8px;
    position: relative;
}

.home-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-block;
    padding: 8px 20px;
    background-color: var(--primary);
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85em;
    border-radius: var(--radius-sm);
    letter-spacing: 0.03em;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.home-btn:hover {
    background-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.brand-name {
    font-size: 1.6em;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-the, .brand-better {
    color: var(--primary);
}

.brand-veteran {
    color: var(--accent-gold);
}

h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1.8em;
    letter-spacing: -0.02em;
}

h2 {
    color: var(--primary);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 12px;
    margin-top: 0;
    font-size: 1.1em;
    letter-spacing: -0.01em;
}

/* --- Calculator Inputs --- */
#calculator-container {
    display: flex;
    justify-content: space-around;
    gap: 24px;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

label {
    font-weight: 600;
    font-size: 0.8em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

select, input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1em;
    background-color: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

/* --- Stay Duration Slider --- */
.stay-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stay-slider-container input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    outline: none;
    touch-action: manipulation;
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) 20.7%, #ddd 20.7%, #ddd 100%);
}

.stay-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.stay-slider-container input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.stay-slider-container input[type="range"]::-moz-range-progress {
    background: var(--primary);
    height: 6px;
    border-radius: 3px;
}

.stay-slider-value {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--primary);
    min-width: 70px;
    text-align: center;
}

/* --- State Info Note (amber) --- */
.state-note {
    font-size: 0.82em;
    padding: 10px 14px;
    background-color: rgba(196, 165, 90, 0.12);
    border: 1px solid rgba(196, 165, 90, 0.3);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

.state-note strong {
    color: #8B6914;
}

.state-sources {
    margin-top: 8px;
    font-size: 0.9em;
}

.state-sources a {
    color: #8B6914;
    text-decoration: underline;
}

.state-sources a:hover {
    color: var(--primary-light);
}

/* --- Section Containers --- */
.section-container {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
    text-align: center;
}

/* --- Comparison Cards (VA vs Conventional) --- */
#comparison-results {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.comparison-card {
    flex: 1;
    min-width: 240px;
    max-width: 360px;
    padding: 24px;
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    border: 2px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-sm);
    text-align: left;
}

.comparison-card.winner {
    border-color: rgba(56, 161, 105, 0.4);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(56, 161, 105, 0.1);
}

.comparison-card h3 {
    margin: 0 0 16px 0;
    font-size: 1.05em;
    color: var(--primary);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-light);
}

.comparison-card .comp-line {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.88em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

.comparison-card .comp-line:last-child {
    border-bottom: none;
}

.comparison-card .comp-line span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.comparison-card .comp-total {
    margin-top: 12px;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-sm);
    text-align: center;
}

.comparison-card .comp-total h4 {
    margin: 0 0 4px 0;
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.comparison-card .comp-total p {
    margin: 0;
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-light);
}

/* --- Badges --- */
.tax-free-badge, .no-pmi-badge, .exempt-badge {
    display: inline-block;
    font-size: 0.65em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #276749;
    background-color: rgba(56, 161, 105, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.mip-badge {
    display: inline-block;
    font-size: 0.65em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #b7791f;
    background-color: rgba(221, 153, 51, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.not-exempt-badge {
    display: inline-block;
    font-size: 0.65em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #c53030;
    background-color: rgba(229, 62, 62, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

/* --- Monthly Delta Indicator --- */
.comparison-delta {
    text-align: center;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9em;
    background-color: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.comparison-delta.positive { color: #276749; }
.comparison-delta.negative { color: #c53030; }

.estimates-note {
    margin: 12px auto 0;
    max-width: 600px;
    font-size: 0.75em;
    color: var(--text-secondary);
    line-height: 1.5;
    font-style: italic;
}

/* --- DTI Line --- */
.dti-line span:last-child {
    font-weight: 600;
}
.dti-green { color: #276749; }
.dti-amber { color: #8B6914; }
.dti-red { color: #c53030; }

/* --- Property Tax Savings --- */
.tax-savings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.tax-savings-card {
    padding: 20px;
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-sm);
}

.tax-savings-card h4 {
    margin: 0 0 8px 0;
    font-size: 0.8em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.tax-savings-card .tax-value {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.tax-savings-card .tax-sub {
    font-size: 0.78em;
    color: var(--text-secondary);
    margin-top: 4px;
}

.tax-savings-card.highlight {
    background: linear-gradient(135deg, #276749 0%, #38a169 100%);
    border: none;
}

.tax-savings-card.highlight h4 {
    color: rgba(255, 255, 255, 0.8);
}

.tax-savings-card.highlight .tax-value {
    color: var(--text-light);
}

.tax-savings-card.highlight .tax-sub {
    color: rgba(255, 255, 255, 0.7);
}

#exemption-description {
    margin-top: 12px;
    font-size: 0.85em;
    color: var(--text-secondary);
    font-style: italic;
}

/* --- Cash Position Cards --- */
#cash-position-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.opp-cost-card {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    padding: 20px;
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-sm);
}

.opp-cost-card h4 {
    margin: 0 0 8px 0;
    font-size: 0.8em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.opp-cost-card .opp-cost-value {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.opp-cost-card .opp-cost-sub {
    font-size: 0.78em;
    color: var(--text-secondary);
    margin-top: 4px;
}

.opp-cost-card.highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: none;
}

.opp-cost-card.highlight h4 {
    color: rgba(255, 255, 255, 0.8);
}

.opp-cost-card.highlight .opp-cost-value {
    color: var(--text-light);
}

.opp-cost-card.highlight .opp-cost-sub {
    color: rgba(255, 255, 255, 0.7);
}

/* --- Timeline Chart --- */
.timeline-chart-container {
    max-width: 900px;
    margin: 16px auto 0;
    position: relative;
    height: 400px;
}

@media (max-width: 600px) {
    .timeline-chart-container {
        height: 300px;
    }
}

/* --- Verdict Breakdown --- */
.verdict-breakdown {
    max-width: 560px;
    margin: 0 auto 20px;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-sm);
}

.verdict-breakdown h4 {
    margin: 0 0 8px 0;
    font-size: 0.85em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
}

.verdict-method {
    font-size: 0.78em;
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.verdict-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.88em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

.verdict-line:last-child {
    border-bottom: none;
}

.verdict-line span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.verdict-line.verdict-total {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 2px solid var(--primary-light);
    border-bottom: none;
    font-weight: 700;
    color: var(--primary);
}

.verdict-line.verdict-total span:last-child {
    color: var(--primary);
    font-size: 1.1em;
}

.verdict-positive { color: #276749 !important; }
.verdict-negative { color: #c53030 !important; }

/* --- Verdict Card --- */
.verdict-card {
    padding: 28px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-md);
    margin-top: 16px;
}

.verdict-card .verdict-label {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 8px 0;
}

.verdict-card .verdict-amount {
    font-size: 2em;
    font-weight: 700;
    color: var(--text-light);
    margin: 0;
}

.verdict-card .verdict-detail {
    font-size: 0.88em;
    color: rgba(255, 255, 255, 0.7);
    margin: 8px 0 0 0;
}

.verdict-summary {
    max-width: 600px;
    margin: 16px auto 0;
    font-size: 0.82em;
    color: var(--text-secondary);
    line-height: 1.6;
    font-style: italic;
    text-align: center;
}

/* --- Subscribe Section --- */
#subscribe-container {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
    text-align: center;
}

.subscribe-subtext {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin: 0 0 20px 0;
}

.subscribe-embed {
    display: flex;
    justify-content: center;
}

/* --- Footer --- */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 0 20px;
    color: var(--text-secondary);
}

footer p {
    max-width: 800px;
    margin: 0 auto;
    font-size: 0.78em;
    line-height: 1.7;
}

/* --- Responsive --- */
@media (max-width: 900px) and (min-width: 769px) {
    .comparison-card {
        min-width: 220px;
        max-width: 340px;
    }

    .opp-cost-card {
        min-width: 160px;
        max-width: 240px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    #calculator-container {
        padding: 20px;
    }

    .input-group {
        min-width: 100%;
    }

    .comparison-card {
        min-width: 100%;
        max-width: 100%;
    }

    .opp-cost-card {
        min-width: 100%;
        max-width: 100%;
    }

    .tax-savings-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.3em;
    }

    .home-btn {
        position: static;
        transform: none;
        display: block;
        text-align: center;
        margin-bottom: 12px;
    }

    .verdict-card .verdict-amount {
        font-size: 1.5em;
    }
}
