/* ============================================
   Personal Loan EMI Calculator
   ============================================ */

.emi-page {
    overflow-x: hidden; /* safety: no horizontal scroll on mobile */
    --navy: #0a1733;
    --blue: #2156e5;
    --blue-dark: #102a86;
    --donut-loan: #a9c2f5;
    --donut-interest: #0b1a3a;
    --line: #e6e9f2;
    --muted: #667085; /* darkened from #8a93a6 to meet WCAG AA contrast on white */
    --ink: #14223f;
    background: #ffffff;
    font-family: "Inter", sans-serif;
}

/* Dark patterned hero band — ONLY the top strip behind the title + top of cards */
.emi-hero {
    position: relative;
    background-color: #0a0e27;
    min-height: 481px;
    box-sizing: border-box;
    padding: 125px 24px 40px; /* title sits below the nav; card overlaps the lower part */
    overflow: hidden;
}

.emi-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--hero-bg, url('/assets/CalcBg.png'));
    background-size: var(--hero-size, 100% 100%);
    background-position: center center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}

.emi-hero .emi-shell {
    position: relative;
    z-index: 1;
}

.emi-shell {
    max-width: 1300px;
    margin: 0 auto;
}

/* White body; pulled up so the cards overlap into the dark band above */
.emi-body {
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.emi-title {
    color: #fff;
    font-size: 38px;
    font-weight: 500;
    margin: 0 0 28px;
    padding-left: 24px; /* nudge the title slightly right */
    letter-spacing: -0.5px;
    line-height: 1.2;
    text-wrap: balance; /* even out the two wrapped lines instead of a long line + a stub */
}
.emi-title strong { font-weight: 800; }

/* Two-column layout, pulled up so cards straddle the dark/white edge */
.emi-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 28px;
    align-items: start;
    margin-top: -258px; /* pull card up so it sits just below the title in the 481px hero */
}
.emi-main-col { min-width: 0; }
/* Grid/flex children must be allowed to shrink below their content's min-content, else a
   1fr track blows up to content width and the whole page overflows on mobile. */
.emi-sidebar { min-width: 0; }
.emi-card-grid { min-width: 0; }
.emi-inputs, .emi-chart { min-width: 0; }

/* ---------- Calculator card ---------- */
.emi-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 24px 60px rgba(10, 23, 51, 0.12);
    max-width: 100%;
    box-sizing: border-box;
}
.calc-card .emi-inputs, .calc-card .emi-chart { min-width: 0; }
.emi-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.emi-field-label {
    font-size: 13px;
    color: #4a5567;
    margin: 0 0 8px;
}
.emi-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 14px;
    height: 50px;
    background: #fff;
}
.emi-input-wrap .rupee { color: var(--ink); font-size: 16px; margin-right: 8px; }
.emi-input-wrap input {
    border: none;
    outline: none;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    width: 100%;
    background: transparent;
    font-family: inherit;
}
.emi-input-wrap .suffix { color: var(--muted); font-size: 13px; }
.emi-input-wrap .emi-unit {
    border: none;
    outline: none;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    flex: 0 0 auto;
    padding: 0 0 0 6px;
    margin-left: auto;
}

.emi-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 22px;
}
.emi-block { margin-top: 22px; }

/* Range slider — thin track with a blue "filled" portion (set inline by JS via
   linear-gradient) and a plain blue thumb with a soft ring. */
.emi-slider { margin-top: 26px; }
.emi-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 6px;
    border-radius: 6px;
    background: #eceff5; /* JS replaces with a gradient showing the filled portion */
    outline: none;
    cursor: pointer;
}
.emi-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #F1F7FF;
    border: 3px solid #AACAF1;
    box-shadow: 0 1px 4px rgba(10, 23, 51, 0.15);
    box-sizing: border-box;
    cursor: pointer;
    margin-top: 0; /* input height IS the 6px track, so WebKit already centres the thumb */
}
.emi-slider input[type="range"]::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #F1F7FF;
    border: 3px solid #AACAF1;
    box-shadow: 0 1px 4px rgba(10, 23, 51, 0.15);
    box-sizing: border-box;
    cursor: pointer;
}
.emi-slider input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: #eceff5; }
.emi-slider input[type="range"]::-moz-range-progress { height: 6px; border-radius: 6px; background: #183FBA; }
.emi-slider-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 16px; /* clear the thumb, which overflows below the thin track */
    font-size: 12px;
    color: var(--muted);
}
.emi-slider-legend .max { color: var(--blue); font-weight: 700; }

/* ---------- Donut ---------- */
.emi-chart { text-align: center; }
.emi-donut-wrap { position: relative; width: 260px; height: 260px; margin: 0 auto; }
.emi-donut { width: 100%; height: 100%; transform: rotate(-90deg); }
.emi-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 22%; /* keep the label + amount inside the ring's inner hole */
}
.emi-donut-center .label { font-size: 13px; color: #5b6478; line-height: 1.3; }
.emi-donut-center .value { font-size: 18px; font-weight: 800; color: var(--ink); margin-top: 4px; line-height: 1.15; word-break: break-word; }

.emi-legend {
    display: flex;
    justify-content: center;
    gap: 36px;
    margin-top: 22px;
}
.emi-legend-item { font-size: 12px; color: var(--muted); }
.emi-legend-item .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.emi-legend-item .amt { display: block; color: var(--ink); font-weight: 700; font-size: 14px; margin-top: 4px; }
.dot-loan { background: var(--donut-loan); }
.dot-interest { background: var(--donut-interest); }

/* ---------- CTA ---------- */
.emi-eligibility-btn {
    display: block;
    width: 100%;
    margin-top: 32px;
    padding: 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(180deg, #2a5be0 0%, #102a86 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* ---------- Generic calculator: select / segmented / result blocks ---------- */
.calc-select {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}
.calc-segmented {
    display: flex;
    gap: 6px;
    background: #f0f2f7;
    border-radius: 12px;
    padding: 5px;
}
.calc-segmented .calc-seg {
    flex: 1;
    border: none;
    background: transparent;
    padding: 11px 10px;
    border-radius: 9px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #5b6478;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.calc-segmented .calc-seg.active {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(10, 23, 51, 0.12);
}
/* Primary result (when there's no donut, e.g. GST) */
.calc-result-primary {
    text-align: center;
    padding: 8px 0 22px;
}
.calc-result-primary .label { display: block; font-size: 14px; color: #5b6478; }
.calc-result-primary .value { display: block; font-size: 30px; font-weight: 800; color: var(--ink); margin-top: 6px; word-break: break-word; }
/* Breakdown rows (both donut and non-donut layouts) */
.calc-breakdown { margin-top: 22px; }
.calc-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.calc-breakdown-item:last-child { border-bottom: none; }
.calc-breakdown-label { color: var(--muted); }
.calc-breakdown-value { font-weight: 700; color: var(--ink); }

/* ---------- Sidebar ---------- */
.emi-sidebar { display: flex; flex-direction: column; gap: 24px; }
.toc-card {
    background: #F8F8F8;
    border: 1px solid #D5DEEE;
    border-radius: 24px;
    padding: 24px;
    width: 420px;
    max-width: 100%;
    box-sizing: border-box;
    font-family: 'Geist', sans-serif;
}
.toc-card h2 {
    position: relative;
    font-size: 20px;
    font-weight: 800;
    color: var(--ink);
    margin: 0 0 16px;
    line-height: 1.1;
    font-family: 'Geist', sans-serif;
}
/* wider blue accent bar with a rounded right edge, sitting on top of the card's left border */
.toc-card h2::before {
    content: '';
    position: absolute;
    left: -25px;              /* card padding (24) + border (1) → reaches the card's outer edge */
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 30px;
    background: #065FEC;
    border-radius: 0 10px 10px 0;
    z-index: 2;
}
.toc-card ul { list-style: none; margin: 0; padding: 0; }
.toc-card li { margin: 0 0 18px; }
.toc-card li:last-child { margin-bottom: 0; }
.toc-card a { line-height: 1.4; }
.toc-card a {
    color: #6B707B;
    font-size: 14px;
    font-family: 'Geist', sans-serif;
    text-decoration: none;
    display: block;
}
.toc-card a:hover { color: var(--blue); }

.popular-card {
    background: #fff;
    border: 1px solid #D5E0FD;
    border-radius: 24px;
    padding: 24px 26px 16px;
    width: 420px;
    max-width: 100%;
    box-sizing: border-box;
}
.popular-card h2 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 24px;
    font-weight: 500;
    color: #000000;
    margin: 0 0 8px;
}
.popular-card a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px 0;
    border-bottom: 1px solid #D5E0FD;
    color: #6B707B;
    font-family: 'Geist', sans-serif;
    text-decoration: none;
    font-size: 14px;
}
.popular-card a:last-child { border-bottom: none; }
.popular-card a .pop-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* normal black right arrow (the unicode arrow's text is hidden via font-size:0) */
.popular-card a .arrow {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    font-size: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ---------- Content below the calculator ---------- */
.emi-content { padding-top: 40px; padding-bottom: 60px; font-family: 'Geist', sans-serif; color: #6B6B7C; }
.emi-content p {
    color: #6B6B7C;
    font-family: 'Geist', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    margin: 0 0 18px;
}
.emi-content h2 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 24px;
    font-weight: 500;
    color: #1B1B1B;
    margin: 64px 0 32px;
}
.emi-content h2:first-child { margin-top: 0; }
.emi-content h3 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 20px;
    font-weight: 500;
    color: #1B1B1B;
    margin: 24px 0 12px;
}
.emi-content img { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: 16px 0; }
.emi-content ul, .emi-content ol { margin: 0 0 18px; padding-left: 22px; }
/* Restore list markers — a globally-loaded reset sets `li { list-style: none }`, so we must
   re-apply the marker on the <li> itself (a rule on the <ul> alone loses to that reset). */
.emi-content ul, .emi-content ul li { list-style: disc outside; }
.emi-content ol, .emi-content ol li { list-style: decimal outside; }
.emi-content li { font-size: 16px; line-height: 1.7; color: #6B6B7C; font-family: 'Geist', sans-serif; margin: 0 0 8px; }
.emi-content a { color: var(--blue); text-decoration: none; }
.emi-content strong { color: #1B1B1B; }
/* buttons inside content must stay white (override the content-link color above) */
.emi-content a.emi-apply-btn,
.emi-content a.emi-eligibility-btn { color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
    .emi-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; }
    .toc-card, .popular-card { width: 100%; }
}
/* Sidebar drops below the main column; cards go full-width and the hero overlap shrinks
   with the (now shorter) hero band so nothing collides. */
@media (max-width: 980px) {
    /* Force single-column here (and card-grid) so nothing overflows on phones/tablets.
       Hero uses NATURAL height + a gentle card overlap so multi-line titles never get
       covered by the card (fixed 481px + big pull is desktop-only). */
    .emi-layout { grid-template-columns: 1fr !important; margin-top: -90px; }
    .emi-card-grid { grid-template-columns: 1fr !important; }
    .emi-hero { min-height: 0; padding: 110px 24px 112px; }
    .emi-title { font-size: 32px; }
    .emi-sidebar { margin-top: 8px; }
}
@media (max-width: 768px) {
    .emi-card-grid { grid-template-columns: 1fr; gap: 30px; }
    .emi-content h2 { font-size: 22px; margin: 44px 0 20px; }
    .emi-content h3 { font-size: 18px; }
}
@media (max-width: 640px) {
    .emi-hero { min-height: 0; padding: 84px 16px 92px; } /* mobile: natural height (fits multi-line titles, no card overlap) */
    .emi-layout { margin-top: -90px; gap: 10px; }
    .emi-sidebar { margin-top: 0; }
    .emi-title { font-size: 27px; font-weight: 700; margin-bottom: 20px; line-height: 1.22; letter-spacing: -0.4px; }
    .emi-body { padding: 0 16px; }
    .emi-card { padding: 20px; border-radius: 16px; }
    .emi-card-grid { grid-template-columns: 1fr; gap: 26px; }
    .emi-row-2 { grid-template-columns: 1fr; }
    .emi-content { padding-top: 28px; padding-bottom: 6px; }
    .emi-content p, .emi-content li { font-size: 15px; }
    .emi-content table { display: block; overflow-x: auto; max-width: 100%; }
    .emi-formula { font-size: 15px; padding: 14px 16px; }
    .emi-steps li { padding-left: 54px; font-size: 15px; padding-bottom: 34px; }
    .emi-steps li::before { width: 40px; height: 40px; }
    .emi-steps li:not(:last-child)::after { left: 19px; top: 40px; height: calc(100% - 40px); }
    .emi-apply-btn { width: 100%; }
    .emi-blogs { padding: 20px 0 48px; }
    .emi-blogs > h2 { font-size: 24px; }
    .emi-donut-wrap { width: 220px; height: 220px; }
    .emi-donut-center .value { font-size: 16px; }
    .emi-legend { gap: 22px; }
    .acc-head { font-size: 15px; padding: 18px 0; }
    .toc-card { display: none; } /* ToC not useful on phones — hide it */
    /* generic calculator (eligibility / GST / custom) on phones */
    .calc-result-primary { padding: 4px 0 16px; }
    .calc-result-primary .value { font-size: 24px; }
    .calc-segmented { gap: 4px; padding: 4px; }
    .calc-segmented .calc-seg { padding: 10px 6px; font-size: 13px; }
    .calc-select { font-size: 15px; }
    .calc-breakdown { margin-top: 8px; }
    .calc-breakdown-item { padding: 11px 0; }
}
@media (max-width: 400px) {
    .emi-title { font-size: 23px; }
    .emi-card { padding: 16px; }
    .emi-donut-wrap { width: 190px; height: 190px; }
    .emi-donut-center .value { font-size: 15px; }
    .emi-legend { gap: 16px; }
    .calc-result-primary .value { font-size: 22px; }
    .calc-segmented .calc-seg { font-size: 12px; padding: 9px 4px; }
}

/* ---------- Bulleted lists ---------- */
.emi-bullets { margin: 0 0 18px; padding-left: 22px; }
.emi-bullets li { color: #4a5567; font-size: 15px; line-height: 1.7; margin: 0 0 8px; list-style: disc outside; }
.emi-bullets li strong { color: var(--ink); }

/* ---------- Formula block ---------- */
.emi-formula {
    background: #f5f7fb;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px 20px;
    font-size: 17px;
    color: var(--ink);
    font-weight: 600;
    margin: 0 0 18px;
    overflow-x: auto;
}
.emi-note { font-size: 13px; color: var(--muted); }

/* ---------- Steps (dotted connector between numbered circles) ---------- */
.emi-steps { list-style: none; margin: 8px 0 28px; padding: 0; counter-reset: emi-step; }
.emi-steps li {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0 40px 64px;
    color: #1B1B1B;
    font-family: 'Geist', sans-serif;
    font-size: 16px;
    counter-increment: emi-step;
}
.emi-steps li:last-child { padding-bottom: 0; }
/* Number circle drawn from a CSS counter — no <span> needed, so it survives rich-text editors
   (TinyMCE strips empty spans). The <li> only holds the step text. */
.emi-steps li::before {
    content: counter(emi-step);
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f0f1f4;
    color: #1B1B1B;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
/* If old content still has a leftover <span>, hide it so the number isn't doubled. */
.emi-steps li span { display: none; }
/* vertical dashed line from each circle down to the next */
.emi-steps li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 21px;
    top: 44px;
    height: calc(100% - 44px);
    border-left: 2px dashed #d6d9e0;
}
.emi-apply-btn {
    display: inline-block;
    width: 320px;
    max-width: 100%;
    margin-top: 20px;
    text-align: center;
    text-decoration: none;
    padding: 16px;
    border-radius: 12px;
    background: linear-gradient(180deg, #2a5be0 0%, #102a86 100%);
    color: #fff;
    font-weight: 600;
    font-size: 16px;
}

/* ---------- Accordion ---------- */
.emi-accordion { margin: 0 0 18px; border-top: 1px solid var(--line); }
.acc-item { border-bottom: 1px solid var(--line); }
.acc-head {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 22px 0;
    font-size: 16px;
    font-weight: 500;
    color: #1B1B1B;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-family: 'Geist', sans-serif;
}
/* chevron caret that rotates up when open (the +/- text is hidden via font-size:0) */
.acc-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    font-size: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231b1b1b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center/contain no-repeat;
    transition: transform 0.25s ease;
}
.acc-item.open .acc-icon { transform: rotate(180deg); }
.acc-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.acc-item.open .acc-body { max-height: 600px; }
.acc-body p { color: #6B6B7C; font-family: 'Geist', sans-serif; font-size: 16px; line-height: 1.7; margin: 4px 0 24px; }

/* ---------- Top Blogs ---------- */
.emi-blogs { padding: 24px 0 70px; }
.emi-blogs > h2 { font-size: 28px; font-weight: 800; color: var(--ink); margin: 0 0 24px; }
.emi-blogs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.emi-blog-card {
    display: block;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    background: #fff;
    transition: box-shadow 0.2s;
}
.emi-blog-card:hover { box-shadow: 0 14px 36px rgba(10, 23, 51, 0.12); }
.emi-blog-img { height: 180px; background: linear-gradient(135deg, #c9d6f5, #8aa6e8); background-size: cover; background-position: center; }
.emi-blog-body { padding: 20px; }
.emi-blog-date { font-size: 12px; color: var(--muted); }
.emi-blog-body h3 { font-size: 18px; font-weight: 800; color: var(--ink); margin: 8px 0 10px; line-height: 1.3; }
.emi-blog-body p { font-size: 14px; color: #4a5567; line-height: 1.6; margin: 0 0 14px; }
.emi-blog-link { color: var(--blue); font-weight: 600; font-size: 14px; }

@media (max-width: 860px) {
    .emi-blogs-grid { grid-template-columns: 1fr; }
}

/* ---- Buttons: no change on hover/focus, text always white, no focus ring ---- */
.emi-eligibility-btn, .emi-eligibility-btn:hover, .emi-eligibility-btn:focus, .emi-eligibility-btn:active,
.emi-apply-btn, .emi-apply-btn:hover, .emi-apply-btn:focus, .emi-apply-btn:active {
    color: #fff !important;
    filter: none !important;
    outline: none !important;
}
/* ---- Accordion header: no blue outline/border when clicked ---- */
.acc-head, .acc-head:hover, .acc-head:focus, .acc-head:active, .acc-head:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    background: none !important;
}
