/* base.css (theme) is loaded before this file by includes/header.php */

/* ==========================================================================
   GrowthNEXT - MF tools hub (/mutual-fund-tools) + tool pages (/tools/slug)
   ========================================================================== */

/* ---------- Hub ---------- */
.tool-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.tool-hub-card {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: .3rem;
    padding: 1rem .8rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    transition: all var(--transition);
}
.tool-hub-icon {
    width: 42px; height: 42px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 1.05rem;
    background: var(--color-secondary);
    color: #fff;
    margin-bottom: .2rem;
    transition: transform var(--transition);
}
.tool-hub-card strong { font-family: var(--font-heading); font-weight: 600; font-size: .92rem; line-height: 1.3; color: var(--color-heading); }
.tool-hub-card small {
    color: var(--color-muted); font-size: .76rem; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;   /* max 2 lines */
}
.tool-hub-card:hover { border-color: var(--color-secondary); box-shadow: var(--shadow); transform: translateY(-3px); color: var(--color-text); }
.tool-hub-card:hover .tool-hub-icon { transform: scale(1.08); }

/* MF Tools hub page: tighter sections */
.tools-hub .section { padding: clamp(32px, 4vw, 48px) 0; }
.tools-hub .section-head { margin-bottom: 1.5rem; }
.tools-hub .section-head h2 { font-size: clamp(1.4rem, 2.2vw, 1.8rem); margin-bottom: .4rem; }
.tools-hub .section-head p { font-size: .95rem; margin: 0; }

/* ---------- Tool page ---------- */
.tool-intro { max-width: 820px; font-size: 1.04rem; margin-bottom: 2rem; }
.tool-panel { background: var(--color-bg-soft); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.5rem; }

/* Calculator inputs */
.calc-form { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.calc-field { padding: .9rem 0; border-bottom: 1px dashed var(--color-border); }
.calc-field:last-child { border-bottom: 0; }
.calc-field[hidden] { display: none; }
.calc-field__top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.calc-field__top label { font-weight: 500; font-size: .94rem; color: var(--color-heading); }
.calc-value {
    display: flex; align-items: center; gap: .25rem;
    background: var(--color-primary-light);
    border-radius: var(--radius-sm);
    padding: .25rem .6rem;
    color: var(--color-primary);
    font-weight: 600;
}
.calc-value input { width: 110px; border: 0; background: transparent; text-align: right; font-weight: 600; color: var(--color-primary); outline: 0; -moz-appearance: textfield; }
.calc-value input::-webkit-outer-spin-button, .calc-value input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.calc-range {
    --fill: 50%;
    width: 100%; height: 6px;
    -webkit-appearance: none; appearance: none;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--color-primary) var(--fill), var(--color-border) var(--fill));
    outline: 0;
}
.calc-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 5px solid var(--color-primary); cursor: pointer; box-shadow: var(--shadow-sm); }
.calc-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 5px solid var(--color-primary); cursor: pointer; }
.calc-range:focus-visible { box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), .2); }

.calc-presets { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.calc-presets button { border: 1px solid var(--color-border); background: #fff; border-radius: 999px; padding: .25rem .7rem; font-size: .78rem; color: var(--color-text); }
.calc-presets button:hover, .calc-presets button.is-active { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }
.calc-help { color: var(--color-muted); font-size: .8rem; display: block; margin-top: .35rem; }

.calc-toggle { display: inline-flex; background: var(--color-bg-soft); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 3px; flex-wrap: wrap; }
.calc-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.calc-toggle span { display: block; padding: .4rem .95rem; border-radius: 6px; font-size: .88rem; cursor: pointer; color: var(--color-text); }
.calc-toggle input:checked + span { background: var(--color-primary); color: #fff; }
.calc-toggle input:focus-visible + span { outline: 2px solid var(--color-primary); }

/* Results */
.calc-results { position: sticky; top: calc(var(--header-h) + 20px); }
.calc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1.25rem; }
.calc-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem 1.1rem; }
.calc-card span { display: block; font-size: .8rem; color: var(--color-muted); margin-bottom: .25rem; }
.calc-card strong { font-family: var(--font-heading); font-size: 1.15rem; color: var(--color-heading); font-weight: 600; word-break: break-word; }
.calc-card.is-main { background: var(--color-primary); border-color: var(--color-primary); }
.calc-card.is-main span { color: rgba(255, 255, 255, .8); }
.calc-card.is-main strong { color: #fff; font-size: 1.3rem; }
.calc-chart-wrap { position: relative; height: 340px; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem; }
.calc-note { margin: 1rem 0 0; font-weight: 500; color: var(--color-heading); }
.calc-table-wrap { margin-top: 2rem; border: 1px solid var(--color-border); border-radius: var(--radius); padding: .25rem 1.25rem; }
.calc-table-wrap summary { cursor: pointer; padding: .9rem 0; font-weight: 600; color: var(--color-primary); font-family: var(--font-heading); }
.calc-table-wrap[hidden] { display: none; }

/* Data tables */
.tool-table { font-size: .9rem; margin: 0; }
.tool-table thead th { background: var(--color-primary); color: #fff; font-weight: 600; white-space: nowrap; border: 0; padding: .7rem .8rem; }
.tool-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.tool-table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.tool-table thead th button { background: none; border: 0; color: inherit; font-weight: 600; padding: 0; }
.tool-table thead th button::after { content: ' \2195'; opacity: .6; font-size: .8em; }
.tool-table td { padding: .65rem .8rem; vertical-align: middle; border-color: var(--color-border); }
.tool-table tbody tr:nth-child(even) td { background: var(--color-bg-soft); }
.tool-table tfoot th { background: var(--color-primary-light); }
.tool-table .pos { color: var(--color-secondary); font-weight: 600; }
.tool-table .neg { color: var(--color-negative); font-weight: 600; }
.calc-card .pos { color: var(--color-secondary); }
.calc-card .neg { color: var(--color-negative); }

/* Fund picker + status */
.fund-picker__label { font-family: var(--font-heading); font-weight: 600; color: var(--color-primary); margin-bottom: .5rem; }
.mf-status { margin: 1rem 0; font-size: .92rem; }
.mf-status:empty { display: none; }
.mf-status.is-loading { color: var(--color-primary); }
.mf-status.is-error { color: var(--color-negative); background: var(--color-negative-light); padding: .7rem 1rem; border-radius: var(--radius-sm); }
.mf-status.is-warning { color: #7a5600; background: var(--color-gold-light); padding: .7rem 1rem; border-radius: var(--radius-sm); }
.mf-result { margin-top: 1.5rem; }

/* NFO cards */
.nfo-card { height: 100%; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.5rem; background: #fff; }
.nfo-card__head { display: flex; gap: .5rem; margin-bottom: .8rem; flex-wrap: wrap; }
.nfo-status, .nfo-cat { font-size: .74rem; font-weight: 600; padding: .25rem .7rem; border-radius: 999px; }
.nfo-status.is-open { background: var(--color-secondary-light); color: var(--color-secondary); }
.nfo-status.is-upcoming { background: var(--color-gold-light); color: #7a5600; }
.nfo-status.is-closed { background: #eceff3; color: #5b6573; }
.nfo-cat { background: var(--color-primary-light); color: var(--color-primary); }
.nfo-amc { color: var(--color-muted); font-size: .9rem; }
.nfo-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 1rem 0; padding: .9rem; background: var(--color-bg-soft); border-radius: var(--radius-sm); }
.nfo-facts dt { font-size: .75rem; color: var(--color-muted); font-weight: 500; }
.nfo-facts dd { margin: 0; font-weight: 600; color: var(--color-heading); font-size: .92rem; }

/* Downloads + CTA */
.tool-docs { margin-top: 2rem; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.tool-docs ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.tool-docs a { display: inline-flex; gap: .5rem; align-items: center; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: .5rem .9rem; color: var(--color-heading); font-size: .9rem; }
.tool-docs a span { font-size: .7rem; background: var(--color-accent); color: #fff; border-radius: 4px; padding: .05rem .35rem; }
.tool-docs a:hover { border-color: var(--color-primary); color: var(--color-primary); }
.tool-docs h2 i { color: var(--color-accent); }
.tool-cta {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
    margin-top: 2.5rem; padding: 1.75rem;
    border-radius: var(--radius);
    background: linear-gradient(120deg, var(--color-navy-2), var(--color-primary));
    color: rgba(255, 255, 255, .85);
}
.tool-cta h2 { color: #fff; margin-bottom: .25rem; }
.tool-cta p { margin: 0; }

@media (max-width: 991.98px) { .calc-results { position: static; } }
@media print {
    .calc-form, .tool-panel, .calc-presets { display: none !important; }
    .calc-table-wrap[open], .calc-table-wrap { display: block; }
}


/* ---------- Left menu on tool pages (Financial Calculators / Resources) ---------- */
.tool-side { position: sticky; top: 110px; }
.tool-side__title { font-size: 1.25rem; font-weight: 700; color: var(--color-heading); margin-bottom: .75rem; }
.tool-side ul { list-style: none; margin: 0; padding: 0; }
.tool-side li a {
    display: block; padding: .8rem .9rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text); font-weight: 500;
    transition: background .2s ease, color .2s ease;
}
.tool-side li a:hover { background: var(--color-bg-soft); color: var(--color-primary); }
.tool-side li a.is-active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; border-left: 3px solid var(--color-primary); }

@media (max-width: 991.98px) {
    .tool-side { position: static; }
    .tool-side__title { font-size: 1rem; }
    .tool-side ul { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .5rem; scrollbar-width: thin; }
    .tool-side li a { white-space: nowrap; border: 1px solid var(--color-border); border-radius: 999px; padding: .45rem .9rem; font-size: .9rem; }
    .tool-side li a.is-active { border-left-width: 1px; }
}

/* ---------- Current NFOs: list + details box (like enrichwise) ---------- */
.nfo-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-border); }
.nfo-row {
    display: flex; flex-direction: column; gap: .15rem; width: 100%;
    padding: .7rem .9rem; text-align: left;
    background: none; border: 0; border-bottom: 1px solid var(--color-border);
    color: var(--color-text); transition: background .2s ease;
}
.nfo-row:hover, .nfo-row:focus-visible { background: var(--color-bg-soft); }
.nfo-row__name { font-weight: 600; color: var(--color-heading); }
.nfo-row:hover .nfo-row__name { color: var(--color-primary); }
.nfo-row__meta { font-size: .85rem; color: var(--color-muted); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.nfo-row__meta .nfo-status { font-size: .72rem; }
.nfo-detail th { width: 22%; background: var(--color-bg-soft); font-weight: 600; color: var(--color-heading); }
.nfo-detail th, .nfo-detail td { border: 1px solid var(--color-border); padding: .6rem .75rem; vertical-align: middle; }
@media (max-width: 575.98px) {
    .nfo-detail tr { display: flex; flex-wrap: wrap; }
    .nfo-detail th, .nfo-detail td { flex: 1 1 50%; width: auto; }
}

/* ---------- Fund Factsheets: fund house + category -> scheme list -> Fund Summary ---------- */
.fs-cats { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; padding-bottom: .45rem; }
.fs-cats label { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; cursor: pointer; }
.fs-list-wrap { margin-top: 1.25rem; }
.fs-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: 10px; }
.fs-list li:nth-child(even) button { background: var(--color-bg-soft); }
.fs-list button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: .5rem .85rem; font-size: .92rem; color: var(--color-text); }
.fs-list button:hover, .fs-list button:focus-visible { background: var(--color-primary-light); color: var(--color-primary); }
.fs-summary { margin-top: 1rem; }
.fs-summary__head { margin: .5rem 0 1rem; }
.fs-badge { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--color-primary-light); color: var(--color-primary); padding: .25rem .7rem; border-radius: 6px; margin-bottom: .5rem; }
.fs-summary__head .fs-cat { color: var(--color-muted); font-weight: 600; margin: 0; }
.fs-detail thead th { background: var(--color-primary); color: #fff; }
.fs-returns .calc-card strong .pos { color: var(--color-secondary); }
.fs-returns .calc-card strong .neg { color: var(--color-negative); }

/* Fund Factsheets: presentation like a printed factsheet (boxes with a legend) */
.fs-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.fs-box { position: relative; border: 1px solid var(--color-border); border-radius: 10px; padding: 1.75rem 1.25rem 1.25rem; margin-top: 1.6rem; background: #fff; }
.fs-legend { position: absolute; top: -.8rem; left: 1rem; margin: 0; padding: .15rem .7rem; font-size: 1rem; font-weight: 700; background: #fff; color: var(--color-heading); border: 1px solid var(--color-border); border-radius: 6px; }
.fs-sub { font-size: .95rem; font-weight: 700; color: var(--color-heading); margin: 1rem 0 .5rem; }
.fs-cat { font-weight: 600; color: var(--color-muted); margin-bottom: 0; }
.fs-kv, .fs-grid { width: 100%; font-size: .92rem; }
.fs-kv th { width: 18%; font-weight: 600; color: var(--color-heading); padding: .4rem .5rem .4rem 0; vertical-align: top; }
.fs-kv td { width: 32%; padding: .4rem .5rem; vertical-align: top; }
.fs-kv tr + tr { border-top: 1px solid var(--color-border); }
.fs-grid th { font-weight: 700; color: var(--color-heading); padding: .45rem .5rem .3rem 0; white-space: nowrap; }
.fs-grid td { padding: .3rem .5rem .45rem 0; }
.fs-grid .pos { color: var(--color-secondary); font-weight: 600; }
.fs-grid .neg { color: var(--color-negative); font-weight: 600; }
.fs-inception .pos { color: var(--color-secondary); }
.fs-inception .neg { color: var(--color-negative); }
.fs-chart { position: relative; height: 320px; border: 1px solid var(--color-border); border-radius: 8px; padding: .75rem; }
.fs-chart--sm { height: 260px; }
@media (max-width: 767.98px) { .fs-kv tr { display: flex; flex-wrap: wrap; } .fs-kv th, .fs-kv td { width: 50%; } }
@media print {
    .fs-docs, .fs-list-wrap, .site-header, .site-footer, .page-banner, .tool-cta, .disclaimer-note ~ * { display: none !important; }
    .fs-box { break-inside: avoid; }
}
.calc-chart-wrap[hidden] { display: none; }
