/* === LoanCalc — Personal Loan Payment Calculator 2026 === */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #059669;
    --accent: #f59e0b;
    --danger: #dc2626;
    --text: #1f2937;
    --text-light: #6b7280;
    --text-muted: #9ca3af;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --max-width: 1280px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.site-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,0.95);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.25rem;
}
.main-nav {
    display: flex;
    gap: 28px;
}
.main-nav a {
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}
.main-nav a:hover { color: var(--primary); }

/* Hero */
.hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: white;
    padding: 64px 0 48px;
    text-align: center;
}
.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}
.hero-sub {
    font-size: 1.15rem;
    opacity: 0.9;
    max-width: 640px;
    margin: 0 auto 24px;
}
.trust-badges {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.badge {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Calculator Section */
.calculator-section {
    padding: 40px 0 64px;
}
.calc-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 32px;
    align-items: start;
}

/* Inputs Panel */
.inputs-panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 88px;
    border: 1px solid var(--border);
}
.inputs-panel h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--text);
}
.input-group {
    margin-bottom: 16px;
}
.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.input-group input, .input-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg-white);
}
.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.input-group .hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn-primary, .btn-secondary, .btn-toggle {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    margin-top: 8px;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary {
    background: var(--border-light);
    color: var(--text-light);
}
.btn-secondary:hover { background: var(--border); }
.btn-toggle {
    background: var(--bg);
    color: var(--text);
    border: 1.5px solid var(--border);
    width: auto;
    padding: 10px 20px;
    font-size: 0.9rem;
}
.btn-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Rate Presets */
.rate-presets {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.rate-presets h4 {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.preset-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.preset-btn {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    color: var(--text);
}
.preset-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* Results Panel */
.results-panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.results-panel h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.summary-card {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 20px;
    border: 1px solid var(--border-light);
    transition: transform 0.2s, box-shadow 0.2s;
}
.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.summary-card.highlight {
    background: linear-gradient(135deg, var(--primary-light), #eff6ff);
    border-color: #bfdbfe;
}
.summary-card.highlight .card-value {
    color: var(--primary);
}
.card-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}
.card-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.card-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Charts */
.chart-container {
    margin: 28px 0;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}
.chart-container h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text);
}
.chart-row {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: center;
}
.chart-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.chart-box.wide {
    align-items: stretch;
}
.chart-box canvas {
    max-width: 100%;
    height: auto;
}
.chart-legend {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-light);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}
.chart-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Comparison Table */
.comparison-section {
    margin: 28px 0;
}
.comparison-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}

/* Amortization */
.amortization-section {
    margin: 28px 0;
}
.amortization-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
}
.amortization-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}
#scheduleCount {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.data-table, #amortizationTable, #comparisonTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.data-table thead, #amortizationTable thead, #comparisonTable thead {
    background: var(--bg);
}
.data-table th, #amortizationTable th, #comparisonTable th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td, #amortizationTable td, #comparisonTable td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    white-space: nowrap;
}
.data-table tbody tr:hover, #amortizationTable tbody tr:hover, #comparisonTable tbody tr:hover {
    background: var(--bg);
}
.data-table tbody tr:last-child td, #comparisonTable tbody tr:last-child td {
    border-bottom: none;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* Strategy Box */
.strategy-box {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin: 20px 0;
    border: 1px solid var(--border-light);
}
.strategy-box h3 {
    font-size: 1rem;
    margin-bottom: 10px;
}
.strategy-box ul {
    list-style: none;
    padding: 0;
}
.strategy-box li {
    padding: 6px 0;
    color: var(--text-light);
    font-size: 0.95rem;
    position: relative;
    padding-left: 20px;
}
.strategy-box li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 700;
}

/* Info Cards */
.info-cards {
    background: var(--bg-white);
    padding: 64px 0;
    border-top: 1px solid var(--border);
}
.info-cards h2 {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 40px;
    color: var(--text);
}
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}
.info-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 28px;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}
.info-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.card-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}
.info-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--text);
}
.info-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 16px;
}
.read-more {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}
.read-more:hover { text-decoration: underline; }

/* FAQ */
.faq-section {
    padding: 64px 0;
    background: var(--bg);
}
.faq-section h2 {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 40px;
}
.faq-list {
    max-width: 800px;
    margin: 0 auto;
}
.faq-item {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.faq-item summary {
    padding: 18px 24px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text);
    transition: background 0.2s;
}
.faq-item summary:hover { background: var(--bg); }
.faq-item summary::after {
    content: "+";
    font-size: 1.25rem;
    color: var(--primary);
    font-weight: 700;
    transition: transform 0.2s;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item p {
    padding: 0 24px 18px;
    color: var(--text-light);
    line-height: 1.7;
    font-size: 0.95rem;
}
.faq-item p strong { color: var(--text); }

/* CTA */
.cta-section {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: white;
    padding: 64px 0;
    text-align: center;
}
.cta-section h2 {
    font-size: 1.75rem;
    margin-bottom: 12px;
}
.cta-section p {
    opacity: 0.9;
    max-width: 560px;
    margin: 0 auto 28px;
    font-size: 1.05rem;
}
.cta-section .btn-primary {
    display: inline-block;
    width: auto;
    padding: 14px 36px;
    background: white;
    color: var(--primary);
    font-size: 1.05rem;
}
.cta-section .btn-primary:hover {
    background: var(--bg);
    transform: translateY(-2px);
}

/* Footer */
.site-footer {
    background: #0f172a;
    color: #94a3b8;
    padding: 48px 0 0;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid #1e293b;
}
.footer-brand .logo { color: white; margin-bottom: 12px; }
.footer-brand p { font-size: 0.9rem; line-height: 1.6; max-width: 300px; }
.footer-links h4 {
    color: white;
    font-size: 0.9rem;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.footer-links a {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 0;
    transition: color 0.2s;
}
.footer-links a:hover { color: white; }
.footer-bottom {
    padding: 20px 0;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
}

/* Article Page Styles */
.article-page { padding: 40px 0 64px; }
.breadcrumb { margin-bottom: 24px; font-size: 0.85rem; color: var(--text-muted); }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb span { margin: 0 8px; }
.article-page h1 { font-size: 2rem; margin-bottom: 8px; color: var(--text); }
.article-meta { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; }
.article-intro { background: var(--bg); padding: 24px; border-radius: var(--radius); margin-bottom: 32px; border-left: 4px solid var(--primary); }
.article-intro p { color: var(--text-light); font-size: 1.05rem; line-height: 1.7; margin: 0; }

.quick-facts { margin: 32px 0; }
.quick-facts h2 { font-size: 1.25rem; margin-bottom: 20px; }

.facts-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.fact-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px; text-align: center; }
.fact-card.highlight { background: linear-gradient(135deg, var(--primary-light), #eff6ff); border-color: #bfdbfe; }
.fact-number { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.fact-label { font-size: 0.8rem; color: var(--text-light); line-height: 1.4; }
.fact-label small { color: var(--text-muted); }

.article-page h2 { font-size: 1.4rem; margin: 40px 0 16px; color: var(--text); border-bottom: 2px solid var(--border); padding-bottom: 8px; }
.article-page h3 { font-size: 1.15rem; margin: 28px 0 12px; color: var(--text); }
.article-page h4 { font-size: 1rem; margin: 20px 0 10px; color: var(--text); }
.article-page p { color: var(--text-light); line-height: 1.7; margin-bottom: 14px; }
.article-page ul, .article-page ol { margin-bottom: 16px; padding-left: 24px; }
.article-page li { color: var(--text-light); line-height: 1.7; margin-bottom: 8px; }
.article-page li strong { color: var(--text); }
.article-page a { color: var(--primary); text-decoration: none; }
.article-page a:hover { text-decoration: underline; }

blockquote { background: var(--bg); border-left: 4px solid var(--accent); padding: 16px 20px; margin: 20px 0; font-style: italic; color: var(--text-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.highlight-row td { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.table-note { font-size: 0.8rem; color: var(--text-muted); margin-top: -12px; margin-bottom: 20px; }

.info-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius-sm); padding: 16px; margin: 20px 0; font-size: 0.9rem; color: var(--text-light); }
.info-box a { color: var(--primary); font-weight: 500; }

.example-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius-sm); padding: 20px; margin: 20px 0; }
.example-box h4 { margin-top: 0; color: var(--secondary); }
.example-box ul { margin-bottom: 0; }
.example-box .formula { font-size: 1.1rem; font-weight: 600; color: var(--text); background: white; padding: 12px; border-radius: var(--radius-sm); display: inline-block; margin: 8px 0; }

.cta-box { background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%); color: white; border-radius: var(--radius); padding: 32px; text-align: center; margin: 40px 0; }
.cta-box h3 { color: white; font-size: 1.25rem; margin-bottom: 10px; }
.cta-box p { color: rgba(255,255,255,0.9); margin-bottom: 20px; max-width: 500px; margin-left: auto; margin-right: auto; }
.cta-box .btn-primary { background: white; color: var(--primary); display: inline-block; width: auto; padding: 12px 32px; }
.cta-box .btn-primary:hover { background: var(--bg); }

.sources { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.sources h3 { font-size: 1rem; margin-bottom: 12px; }
.sources ul { font-size: 0.85rem; color: var(--text-light); }
.sources a { color: var(--primary); }

/* Responsive */
@media (max-width: 1024px) {
    .calc-layout { grid-template-columns: 1fr; }
    .inputs-panel { position: static; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .chart-row { grid-template-columns: 1fr; }
    .facts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .hero h1 { font-size: 1.75rem; }
    .main-nav { display: none; }
    .summary-cards { grid-template-columns: 1fr; }
    .cards-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .data-table, #amortizationTable, #comparisonTable { font-size: 0.75rem; }
    .data-table th, .data-table td, #amortizationTable th, #amortizationTable td, #comparisonTable th, #comparisonTable td { padding: 8px 10px; }
    .facts-grid { grid-template-columns: 1fr; }
    .article-page h1 { font-size: 1.5rem; }
}

/* Print */
@media print {
    .site-header, .hero, .info-cards, .faq-section, .cta-section, .site-footer, .btn-primary, .btn-secondary, .btn-toggle, .preset-buttons {
        display: none !important;
    }
    .results-panel { box-shadow: none; border: 1px solid #ccc; }
    .calc-layout { grid-template-columns: 1fr; }
}
