/* Mortgage Calculator CSS */

:root {
    --mortgage-blue: #2563eb;
    --mortgage-dark: #1e3a8a;
    --mortgage-green: #10b981;
    --mortgage-orange: #f59e0b;
    --mortgage-red: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --bg-input: #f8fafc;
    --border-color: #e2e8f0;
}

/* Tool Container */
.mortgage-tool-wrapper {
    max-width: 1000px;
    margin: 0 auto 3rem auto;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
}

.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-header h1 {
    font-size: 2.2rem;
    color: var(--mortgage-dark);
    margin-bottom: 0.5rem;
}

.tool-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Layout */
.calculator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: #fff;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

@media (max-width: 850px) {
    .calculator-layout {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }
}

/* --- INPUTS --- */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-wrapper-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper-icon.right input {
    padding-left: 12px;
    padding-right: 35px;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.icon-right {
    position: absolute;
    right: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-wrapper-icon input {
    width: 100%;
    padding: 12px 12px 12px 30px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-input);
    transition: all 0.2s;
}

.input-wrapper-icon input:focus {
    outline: none;
    border-color: var(--mortgage-blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-input);
    cursor: pointer;
}

.row-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.badge {
    background: #eff6ff;
    color: var(--mortgage-blue);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Tooltip */
.tooltip-icon {
    color: #94a3b8;
    cursor: help;
    margin-left: 5px;
}

/* Advanced Options */
.advanced-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    color: var(--mortgage-blue);
    font-weight: 600;
    user-select: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.advanced-toggle:hover {
    color: var(--mortgage-dark);
}

.advanced-options {
    height: 0;
    overflow: hidden;
    transition: height 0.4s ease-out;
    background: #f8fafc;
    border-radius: 8px;
    padding: 0 1rem;
    margin-bottom: 1rem;
}

.advanced-options.open {
    height: auto;
    padding: 1rem;
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.helper-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

/* Calculate Button */
.calc-btn {
    width: 100%;
    padding: 1rem;
    background: var(--mortgage-blue);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.calc-btn:hover {
    background: var(--mortgage-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.3);
}

/* --- RESULTS --- */
.result-container {
    animation: fadeIn 0.5s ease-out;
}

.result-card-main {
    background: #eff6ff;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
    border: 1px solid #bfdbfe;
}

.result-label {
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--mortgage-blue);
    letter-spacing: 1px;
    display: block;
    margin-bottom: 0.5rem;
}

.result-value-lg {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--mortgage-dark);
}

/* Donut Chart */
.donut-section {
    position: relative;
    height: 200px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

#breakdownChart {
    max-height: 200px;
}

/* Breakdown List */
.breakdown-list {
    margin-bottom: 1.5rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.dot.principal {
    background: #2563eb;
}

.dot.interest {
    background: #8b5cf6;
}

.dot.tax {
    background: #10b981;
}

.dot.ins {
    background: #f59e0b;
}

.dot.pmi {
    background: #ef4444;
}

.dot.hoa {
    background: #ec4899;
}

.val {
    font-weight: 700;
}

/* Loan Summary */
.loan-summary {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sum-item {
    display: flex;
    flex-direction: column;
}

.sum-item span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sum-item strong {
    font-size: 1rem;
    color: var(--text-primary);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
}

.secondary-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #cbd5e1;
    background: white;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: #f1f5f9;
}

.icon-btn {
    width: 44px;
    border: 1px solid #cbd5e1;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--mortgage-blue);
    background: #f1f5f9;
}

/* --- AMORTIZATION TABLE --- */
.amortization-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 3rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toggle-group {
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    display: flex;
}

.toggle-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.toggle-btn.active {
    background: white;
    color: var(--mortgage-blue);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.export-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.table-responsive {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.amortization-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    padding: 12px;
    text-align: right;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.amortization-table th:first-child {
    text-align: left;
}

.amortization-table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}

.amortization-table td:first-child {
    text-align: left;
    font-weight: 600;
}

.amortization-table tr:hover {
    background: #f8fafc;
}

/* --- SEO CONTENT --- */
.seo-content {
    max-width: 800px;
    margin: 3rem auto;
    line-height: 1.7;
    color: #334155;
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
}

.seo-content h2 {
    color: #1e293b;
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.seo-content h3 {
    color: #334155;
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
}

.seo-content p {
    margin-bottom: 1.2rem;
}

.seo-content ul,
.seo-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.seo-content li {
    margin-bottom: 0.5rem;
}

.content-block {
    margin-bottom: 3rem;
}

.bg-highlight {
    background: #eff6ff;
    padding: 2rem;
    border-radius: 12px;
    border-left: 5px solid var(--mortgage-blue);
}

.formula-box {
    background: #1e293b;
    color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    text-align: center;
    font-size: 1.1rem;
    margin: 1.5rem 0;
}

.comparison-table-wrapper {
    overflow-x: auto;
    margin: 2rem 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.comparison-table th {
    background: #1e293b;
    color: white;
    padding: 12px;
    text-align: left;
}

.comparison-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.faq-item {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 1rem;
}

.faq-item h3 {
    font-size: 1.1rem;
    color: var(--mortgage-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }

    .mortgage-tool-wrapper,
    .mortgage-tool-wrapper * {
        visibility: visible;
    }

    .mortgage-tool-wrapper {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        max-width: none;
    }

    .action-buttons,
    .advanced-toggle,
    .tool-subtitle,
    .header,
    .footer {
        display: none !important;
    }

    .calculator-layout {
        grid-template-columns: 1fr 1fr;
        border: none;
        box-shadow: none;
    }

    .result-container {
        display: block !important;
    }
}