/* ════════════════════════════════════════════════════════════════════════════
   RECATOOLS — Compound Interest Calculator — style.css
   Tool-specific overrides only.
   Base styles live in /assets/css/tool-page.css.
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Input grid layout ───────────────────────────────────────────────────────── */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
}
@media (max-width: 600px) {
    .calc-grid { grid-template-columns: 1fr; }
}

.calc-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.calc-field.full-width {
    grid-column: 1 / -1;
}

.calc-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
    letter-spacing: 0.01em;
}

.calc-input {
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: 1.5px solid var(--border, #E2E4E8);
    border-radius: 8px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text, #0D1B2A);
    background: #fff;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}
.calc-input:focus {
    outline: none;
    border-color: var(--accent, #E8472F);
    box-shadow: 0 0 0 3px rgba(232, 98, 42, 0.12);
}

/* ── Currency prefix wrapper ─────────────────────────────────────────────────── */
.input-prefix-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.input-prefix {
    position: absolute;
    left: 0.875rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
    pointer-events: none;
    user-select: none;
}
.input-prefix-wrap .calc-input {
    padding-left: 2.75rem;
}

/* ── Slider row ──────────────────────────────────────────────────────────────── */
.slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.years-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: var(--border, #E2E4E8);
    outline: none;
    cursor: pointer;
    transition: background 0.15s;
}
.years-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent, #E8472F);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    transition: transform 0.12s;
}
.years-slider::-webkit-slider-thumb:hover,
.years-slider:focus::-webkit-slider-thumb {
    transform: scale(1.15);
}
.years-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent, #E8472F);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.years-slider:focus {
    box-shadow: 0 0 0 3px rgba(232, 98, 42, 0.18);
}

.years-number {
    width: 64px;
    flex-shrink: 0;
    padding: 0.55rem 0.5rem;
    border: 1.5px solid var(--border, #E2E4E8);
    border-radius: 8px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    color: var(--text, #0D1B2A);
    background: #fff;
    transition: border-color 0.15s;
}
.years-number:focus {
    outline: none;
    border-color: var(--accent, #E8472F);
    box-shadow: 0 0 0 3px rgba(232, 98, 42, 0.12);
}
.years-unit {
    font-size: 0.8125rem;
    color: var(--text-secondary, #64748B);
    white-space: nowrap;
}

/* ── Frequency pill buttons ──────────────────────────────────────────────────── */
.freq-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.freq-pill {
    padding: 0.4rem 0.875rem;
    border: 1.5px solid var(--border, #E2E4E8);
    border-radius: 999px;
    background: #fff;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
}
.freq-pill:hover {
    border-color: var(--accent, #E8472F);
    color: var(--accent, #E8472F);
}
.freq-pill.active {
    background: var(--accent, #E8472F);
    border-color: var(--accent, #E8472F);
    color: #fff;
}

/* ── Calculate button ────────────────────────────────────────────────────────── */
.btn-calculate {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--accent, #E8472F);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    margin-top: 0.5rem;
}
.btn-calculate:hover {
    background: #d45520;
    box-shadow: 0 4px 14px rgba(232, 98, 42, 0.35);
}
.btn-calculate:active {
    transform: translateY(1px);
}

/* ── Error message ───────────────────────────────────────────────────────────── */
.error-msg {
    color: #c0392b;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: #fdf2f0;
    border-radius: 8px;
    border: 1px solid #f5c6c1;
}

/* ── Results panel ───────────────────────────────────────────────────────────── */
.results-panel {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1.5px solid var(--border, #E2E4E8);
}

.results-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 560px) {
    .results-summary { grid-template-columns: 1fr; gap: 0.75rem; }
}

.result-item {
    text-align: center;
    padding: 1rem 0.75rem;
    background: var(--bg, #FFFFFF);
    border-radius: 10px;
}
.result-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}
.result-value {
    font-family: 'IBM Plex Serif', serif;
    font-size: 1.625rem;
    color: var(--text, #0D1B2A);
    line-height: 1.1;
}
.result-value.result-final {
    font-size: 2rem;
    color: var(--accent, #E8472F);
}
.result-value.result-interest {
    color: #1a8a4a;
}
.result-value.result-contribs {
    color: var(--text-secondary, #64748B);
    font-size: 1.375rem;
}

/* ── Stacked bar chart ───────────────────────────────────────────────────────── */
.chart-section {
    margin-bottom: 1.5rem;
}
.chart-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.6rem;
}
.stacked-bar {
    display: flex;
    height: 28px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg, #FFFFFF);
    gap: 2px;
}
.bar-segment {
    height: 100%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
    border-radius: 0;
}
.bar-segment.bar-principal { background: #3b82f6; border-radius: 8px 0 0 8px; }
.bar-segment.bar-contribs  { background: var(--accent, #E8472F); }
.bar-segment.bar-interest  { background: #1a8a4a; border-radius: 0 8px 8px 0; }
.bar-segment.bar-contribs:first-child { border-radius: 8px 0 0 8px; }
.bar-segment.bar-interest:last-child  { border-radius: 0 8px 8px 0; }

/* When contributions are 0, principal gets right radius too */
.stacked-bar .bar-segment:last-child { border-radius: 0 8px 8px 0; }
.stacked-bar .bar-segment:first-child { border-radius: 8px 0 0 8px; }
.stacked-bar .bar-segment:only-child { border-radius: 8px; }

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-top: 0.75rem;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--text-secondary, #64748B);
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.legend-dot.principal { background: #3b82f6; }
.legend-dot.contribs  { background: var(--accent, #E8472F); }
.legend-dot.interest  { background: #1a8a4a; }
.legend-val {
    font-weight: 600;
    color: var(--text, #0D1B2A);
}

/* ── Year-by-year table ──────────────────────────────────────────────────────── */
.table-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1.5px solid var(--border, #E2E4E8);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    margin-bottom: 0;
}
.table-toggle-btn:hover {
    border-color: var(--accent, #E8472F);
    color: var(--accent, #E8472F);
}
.toggle-icon {
    font-size: 1.1rem;
    font-weight: 400;
    line-height: 1;
    transition: transform 0.2s;
}

.yearly-table-wrap {
    display: none;
    margin-top: 1rem;
    overflow-x: auto;
    border-radius: 10px;
    border: 1.5px solid var(--border, #E2E4E8);
}
.yearly-table-wrap.open { display: block; }

.yearly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.yearly-table th {
    padding: 0.625rem 1rem;
    background: var(--bg, #FFFFFF);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, #64748B);
    text-align: right;
    border-bottom: 1.5px solid var(--border, #E2E4E8);
}
.yearly-table th:first-child { text-align: left; }
.yearly-table td {
    padding: 0.5rem 1rem;
    text-align: right;
    color: var(--text, #0D1B2A);
    font-weight: 500;
    border-bottom: 1px solid var(--border, #E2E4E8);
}
.yearly-table td:first-child { text-align: left; font-weight: 700; }
.yearly-table tbody tr:last-child td { border-bottom: none; }
.yearly-table tbody tr:nth-child(even) td { background: rgba(247, 246, 243, 0.6); }
.td-interest { color: #1a8a4a !important; }
.td-muted { color: var(--text-secondary, #64748B) !important; }

/* ── CPF tip callout ─────────────────────────────────────────────────────────── */
.cpf-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    background: #f0faf4;
    border: 1.5px solid #b2e0c5;
    border-radius: 10px;
    padding: 1rem 1.125rem;
    margin-top: 1.5rem;
}
.cpf-tip-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.05rem;
}
.cpf-tip-body {
    font-size: 0.875rem;
    color: #1a4d2e;
    line-height: 1.55;
}
.cpf-tip-body strong {
    font-weight: 700;
}

/* ── Finance disclaimer ──────────────────────────────────────────────────────── */
.finance-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #fffbf0;
    border: 1.5px solid #f0d280;
    border-radius: 10px;
    padding: 0.875rem 1rem;
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: #7a5f10;
    line-height: 1.5;
}
.finance-disclaimer strong {
    font-weight: 700;
}

/* ── Pull quote ──────────────────────────────────────────────────────────────── */
.pull-quote {
    border-left: 4px solid var(--accent, #E8472F);
    margin: 1.5rem 0;
    padding: 0.875rem 1.25rem;
    background: #FFF5F2;
    border-radius: 0 8px 8px 0;
}
.pull-quote p {
    font-family: 'IBM Plex Serif', serif;
    font-size: 1.0625rem;
    color: var(--text, #0D1B2A);
    line-height: 1.55;
    margin: 0;
    font-style: italic;
}

/* ── Educational content ─────────────────────────────────────────────────────── */
.educational-content h3 {
    font-family: 'IBM Plex Serif', serif;
    font-size: 1.1875rem;
    color: var(--text, #0D1B2A);
    margin: 1.75rem 0 0.6rem;
}
.educational-content h3:first-child {
    margin-top: 0;
}
.educational-content p {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text, #0D1B2A);
    margin-bottom: 1rem;
}
.educational-content strong {
    font-weight: 700;
    color: var(--text, #0D1B2A);
}

/* ── Fact cards grid ─────────────────────────────────────────────────────────── */
/* Inherits .fact-cards-grid from tool-page.css */

/* ── Smooth results reveal ───────────────────────────────────────────────────── */
#results-section {
    animation: fadeSlideUp 0.35s ease both;
}
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* cache-buster: 2026-05-24T05:06:05Z */
