/* ═══════════════════════════════════════════
   fd.css — FD Calculator specific styles
   Requires: calc-global.css
   v2.0 — updated:
     [D3]  3D donut radialGradient + hover tooltip (mirrors lumpsum.css)
     [LC1] Line chart legend / container styles
     [LS2] Layout-shift prevention (contain:layout, min-height locks)
   ─────────────────────────────────────────
   SECTIONS:
   [CSS0]  CSS variables — FD colour palette
   [CSS1]  Colour utilities
   [CSS2]  Bank / rate chip grid
   [CSS3]  Tenure pill toggle
   [CSS4]  Effective rate note
   [CSS5]  TDS detail & safe boxes
   [CSS6]  Hero TDS banner
   [CSS7]  Empty field prompt
   [CSS8]  Compounding frequency note
   [CSS9]  [D3] 3D Donut tooltip
   [CSS10] [LC1] Line chart legend
   [CSS11] [LS2] Layout-shift prevention
   [CSS12] Responsive
═══════════════════════════════════════════ */


/* ═══════════════════════════════════════════
   [CSS0]  FD CSS VARIABLES
═══════════════════════════════════════════ */

:root {
    --fd-teal:       #0D9488;
    --fd-teal-soft:  #CCFBF1;
    --fd-amber:      #F59E0B;
    --fd-amber-soft: #FEF3C7;
}


/* ═══════════════════════════════════════════
   [CSS1]  FD-ONLY COLOUR UTILITIES
═══════════════════════════════════════════ */

.c-teal  { color: var(--fd-teal); }
.c-amber { color: var(--fd-amber); }
.c-red   { color: var(--danger); }


/* ═══════════════════════════════════════════
   [CSS2]  BANK / RATE CHIP GRID
═══════════════════════════════════════════ */

.bank-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: .9rem;
}

.bank-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: .26rem .75rem;
    border-radius: 30px;
    border: 1.5px solid var(--slate-line);
    background: var(--white);
    font-size: .73rem;
    font-weight: 600;
    color: var(--slate);
    cursor: pointer;
    transition: all .18s var(--ease);
    user-select: none;
}
.bank-chip:hover {
    border-color: var(--fd-teal);
    color: var(--fd-teal);
}
.bank-chip.active {
    background: var(--fd-teal-soft);
    border-color: var(--fd-teal);
    color: #0f766e;
}
.bank-chip .chip-rate {
    font-size: .68rem;
    color: var(--emerald);
    font-weight: 700;
}


/* ═══════════════════════════════════════════
   FEE GRID  (2-col inside TDS settings panel)
═══════════════════════════════════════════ */

.fee-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding-top: .85rem;
}


/* ═══════════════════════════════════════════
   [CSS3]  TENURE PILL TOGGLE
═══════════════════════════════════════════ */

.tenure-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 8px;
}

.tenure-pill {
    display: flex;
    gap: 4px;
    background: var(--slate-light);
    border-radius: 20px;
    padding: 3px;
}

.tp-opt {
    padding: .18rem .6rem;
    border-radius: 16px;
    border: none;
    background: transparent;
    font-size: .7rem;
    font-weight: 600;
    color: var(--slate);
    cursor: pointer;
    transition: all .15s;
}
.tp-opt.active {
    background: var(--white);
    color: var(--navy);
    box-shadow: 0 1px 4px rgba(13,37,69,.12);
}
.tp-opt:hover:not(.active) { color: var(--navy); }


/* ═══════════════════════════════════════════
   [CSS4]  EFFECTIVE RATE NOTE
   Shown when senior citizen bonus is active.
═══════════════════════════════════════════ */

.eff-rate-note {
    margin-top: 6px;
    background: var(--amber-soft);
    border: 1px solid #FDE68A;
    border-radius: 8px;
    padding: .35rem .7rem;
    font-size: .69rem;
    color: #92400E;
    font-weight: 500;
    display: none;
}
.eff-rate-note.show { display: block; }


/* ═══════════════════════════════════════════
   [CSS5]  TDS DETAIL BOX & SAFE BOX
═══════════════════════════════════════════ */

.tds-box {
    background: var(--danger-soft);
    border: 1.5px solid #FECACA;
    border-radius: var(--r-md);
    padding: .85rem 1rem;
    margin-bottom: 1.2rem;
    display: none;
}
.tds-box.show { display: block; }

.tds-hd {
    font-size: .7rem;
    font-weight: 700;
    color: #991B1B;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .65rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.tds-hd i { color: #EF4444; }

.tds-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tds-item {
    background: var(--white);
    border-radius: 10px;
    padding: .55rem .7rem;
    border: 1px solid #FECACA;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tds-lbl {
    font-size: .65rem;
    color: #991B1B;
    font-weight: 500;
    margin-bottom: 3px;
}

.tds-val {
    font-size: .88rem;
    font-weight: 800;
    color: #B91C1C;
    font-family: var(--font-mono);
}
.tds-val.green { color: var(--emerald); }

.tds-safe-box {
    background: var(--emerald-soft);
    border: 1.5px solid #6EE7B7;
    border-radius: var(--r-md);
    padding: .75rem 1rem;
    margin-bottom: 1.2rem;
    display: none;
    font-size: .77rem;
    color: #065f46;
    font-weight: 500;
    align-items: center;
    gap: .5rem;
}
.tds-safe-box.show { display: flex; }
.tds-safe-box i    { color: var(--emerald); font-size: .9rem; flex-shrink: 0; }


/* ═══════════════════════════════════════════
   [CSS6]  HERO TDS BANNER
═══════════════════════════════════════════ */

.hero-tds-banner {
    margin-top: 10px;
    background: rgba(220, 38, 38, .1);
    border: 1px solid rgba(220, 38, 38, .22);
    border-radius: 12px;
    padding: .55rem .85rem;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: .78rem;
    font-weight: 600;
}
.hero-tds-banner.show { display: flex; }
.hero-tds-banner i    { color: #FCA5A5; }

.tds-amt {
    color: #FCA5A5;
    font-family: var(--font-mono);
    font-weight: 700;
}


/* ═══════════════════════════════════════════
   [CSS7]  EMPTY FIELD PROMPT
═══════════════════════════════════════════ */

.field-empty-prompt {
    font-size: .7rem;
    color: var(--danger);
    margin-top: 5px;
    display: none;
    align-items: center;
    gap: 4px;
    background: var(--danger-soft);
    border: 1px solid #FECACA;
    border-radius: 8px;
    padding: .3rem .6rem;
}
.field-empty-prompt.show { display: flex; }


/* ═══════════════════════════════════════════
   [CSS8]  COMPARE COMPOUNDING FREQ NOTE
═══════════════════════════════════════════ */

.compare-freq-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    background: var(--slate-light);
    border: 1px solid var(--slate-line);
    border-radius: 10px;
    padding: .5rem .8rem;
    font-size: .73rem;
    color: var(--slate);
    margin-bottom: .85rem;
    line-height: 1.5;
}
.compare-freq-note i  { color: var(--navy); flex-shrink: 0; margin-top: 2px; }
.compare-freq-note strong { color: var(--navy); }

/* TDS yearly note */
.tds-yr-note {
    font-size: .72rem;
    color: var(--slate);
    background: var(--navy-light);
    border-left: 3px solid var(--navy);
    border-radius: 0 8px 8px 0;
    padding: .5rem .85rem;
    margin: 0 0 .85rem;
    display: none;
    line-height: 1.5;
}
.tds-yr-note.show { display: block; }


/* ═══════════════════════════════════════════
   [CSS9]  [D3]  3D DONUT TOOLTIP
   Matches lumpsum donut tooltip exactly.
   Uses id="fdDonutTip" to avoid conflicts.
═══════════════════════════════════════════ */

#fdDonutTip {
    position: absolute;
    bottom: 105%;
    left: 50%;
    transform: translateX(-50%);
    background: #0D2545;
    border-radius: 16px;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s;
    z-index: 20;
    width: 192px;
    box-shadow: 0 20px 40px rgba(13,37,69,.35), 0 4px 12px rgba(13,37,69,.2);
}

/* Donut arc interaction */
.donut-arc {
    transition: opacity .18s, stroke-width .15s;
    fill: none;
    stroke-width: 16px;
}

/* Legend active / dim states */
.dl-item.dl-active .dl-txt,
.dl-item.dl-active .dl-val { color: var(--navy); font-weight: 700; }
.dl-item.dl-dim { opacity: .4; }


/* ═══════════════════════════════════════════
   [CSS10] [LC1] LINE CHART LEGEND & CONTAINER
   Replaces bar-chart legend styles.
═══════════════════════════════════════════ */

/* Legend dots — principal uses dashed line style */
.chart-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--slate-line);
}

.cl-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    color: var(--slate);
    font-weight: 500;
}

.cl-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Yearly table — TDS column accent */
td.td-t {
    color: var(--danger);
    font-weight: 600;
}


/* ═══════════════════════════════════════════
   [CSS11] [LS2] LAYOUT-SHIFT PREVENTION
   contain:layout + min-height locks on
   insight list and chart containers.
   NOTE: #vSummary and #yrBars deliberately
   do NOT use contain:layout — it clips the
   SVG line chart tooltip and overflow.
═══════════════════════════════════════════ */

.inputs-sticky {
    contain: layout;
}

.insights-body {
    contain: layout;
}

/* Chart wrap locks height so surrounding content
   doesn't jump when the SVG redraws */
.yr-chart-wrap {
    min-height: 320px;
    position: relative;
}

/* yrBars must NOT have contain or overflow:hidden at
   the wrapper level — the SVG tooltip overflows it.
   min-height gives the container space before draw. */
#yrBars {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 260px;
    box-sizing: border-box;
    position: relative;
}

/* vSummary: no contain (clips SVG), just min-height */
#vSummary {
    min-height: 360px;
}

/* Insight list — height lock during content swap */
#insightList {
    transition: min-height .2s ease;
}

@media (min-width: 768px) {
    .insights-body {
        overflow: visible;
    }

    #insightList {
        min-height: 200px;
        max-height: 420px;
        overflow-y: auto;
        overflow-x: hidden;
        scroll-behavior: smooth;
    }
}


/* ═══════════════════════════════════════════
   [CSS12] RESPONSIVE
═══════════════════════════════════════════ */

@media (max-width: 700px) {
    .tds-grid       { grid-template-columns: 1fr; }
    .tenure-hd      { flex-direction: column; align-items: flex-start; }
    .compare-freq-note { font-size: .68rem; }
}

@media (max-width: 480px) {
    .bank-grid { gap: 5px; }
    .bank-chip { font-size: .68rem; padding: .22rem .6rem; }
}