/* General styles for the calculators section */
#calculators {
    background-color: #f9f9f9;
    padding: 36px 20px;
}
.row {
    display: flex;
    flex-wrap: wrap;
}
#calculators h2,
#calculators h3 {
    color: #001f3f; /* Midnight blue */
    text-align: center;
    margin-bottom: 20px;
}

.calculator-intro {
    width: min(100%, 980px);
    margin: 0 auto 26px;
    text-align: center;
}

.calculator-intro p {
    line-height: 1.75;
    margin-bottom: 18px;
}

.calculator-selector-panel {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: auto minmax(220px, 360px);
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: min(100%, 1040px);
    margin: 0 auto 22px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 31, 63, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 22px rgba(0, 31, 63, 0.08);
}

.calculator-selector-panel label {
    color: #001f3f;
    font-weight: 800;
}

.calculator-selector-panel select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid rgba(0, 31, 63, 0.18);
    border-radius: 6px;
    background: #fff;
    color: #001f3f;
    font: inherit;
    font-weight: 700;
}

/* Style for calculator rows */
.calculator-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    width: 100%;
    max-width: 1040px;
}

/* Style for each calculator box */
.calculator-box {
    min-width: 0;
    max-width: none;
}

.calculator-box.is-hidden,
.stamp-duty-calculator-box.is-hidden {
    display: none;
}

.calculator {
    position: relative;
    background-color: #fff;
    border: 1px solid rgba(0, 31, 63, 0.12);
    border-radius: 8px;
    padding: 24px 26px;
    box-shadow: 0 12px 28px rgba(0, 31, 63, 0.1);
    overflow: hidden;
}

.calculator::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: #ff0000;
}

.calculator h4 {
    color: #001f3f;
    margin-bottom: 6px;
    text-align: left;
    font-size: 1.35rem;
}

.calculator-purpose {
    margin-bottom: 18px;
    padding: 0;
    color: #444;
    line-height: 1.65;
    text-align: left;
}

.calculator label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #222;
}

.calculator input,
.calculator select {
    width: 100%;
    padding: 12px;
    margin-bottom: 14px;
    border: 1px solid rgba(0, 31, 63, 0.18);
    border-radius: 4px;
    background: #fff;
    font: inherit;
}

.live-calculator {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.borrowing-summary {
    display: grid;
    grid-column: 1 / -1;
    gap: 6px;
    padding: 16px;
    border-radius: 8px;
    background: #001f3f;
    color: #fff;
}

.borrowing-summary span {
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
}

.borrowing-summary strong {
    font-size: clamp(1.8rem, 4vw, 3.1rem);
    line-height: 1;
}

.range-field {
    display: grid;
    gap: 8px;
}

.switch-field {
    display: grid;
    gap: 8px;
}

.field-label {
    font-weight: bold;
    color: #222;
}

.applicant-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 4px;
    border: 1px solid rgba(0, 31, 63, 0.18);
    border-radius: 999px;
    background: #f1f4f8;
}

.repayment-switch {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-radius: 8px;
}

.two-option-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.repayment-switch label,
.repayment-switch span {
    min-width: 0;
}

.repayment-switch span {
    border-radius: 6px;
    white-space: normal;
}

.applicant-switch label {
    display: block;
    margin: 0;
}

.applicant-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    inline-size: 1px;
    block-size: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.applicant-switch span {
    display: block;
    padding: 10px 14px;
    border-radius: 999px;
    color: #001f3f;
    font-weight: 800;
    text-align: center;
    cursor: pointer;
}

.applicant-switch input:checked + span {
    background: #001f3f;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 31, 63, 0.18);
}

.applicant-switch input:focus-visible + span {
    outline: 3px solid rgba(255, 0, 0, 0.25);
    outline-offset: 2px;
}

.range-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.calculator .range-label label {
    margin: 0;
}

.range-label output {
    flex: 0 0 auto;
    color: #001f3f;
    font-weight: 800;
}

.exact-input-row {
    display: grid;
    grid-template-columns: minmax(130px, max-content) minmax(0, 180px);
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.calculator .exact-input-row label {
    margin: 0;
    color: #444;
    font-size: 0.9rem;
    font-weight: 700;
}

.calculator .exact-input-row input {
    margin: 0;
    padding: 9px 10px;
}

.hem-expense-display {
    display: flex;
    grid-column: 1 / -1;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 31, 63, 0.14);
    border-radius: 8px;
    background: #f7f9fc;
}

.hem-expense-display span {
    color: #444;
    font-weight: 700;
}

.hem-expense-display strong {
    flex: 0 0 auto;
    color: #001f3f;
}

.full-width-field,
.loan-reduction-panel {
    grid-column: 1 / -1;
}

.loan-reduction-panel {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(0, 31, 63, 0.14);
    border-radius: 8px;
    background: #f7f9fc;
}

.amortisation-chart {
    position: relative;
    min-height: 320px;
}

.amortisation-chart svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.amortisation-axis,
.amortisation-grid {
    stroke: rgba(0, 31, 63, 0.16);
    stroke-width: 1;
}

.amortisation-axis-label {
    fill: #445;
    font-size: 12px;
    font-weight: 700;
}

.amortisation-line {
    fill: none;
    stroke: #ff0000;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
}

.offset-line-without,
.offset-line-with {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
}

.offset-line-without {
    stroke: #001f3f;
}

.offset-line-with {
    stroke: #ff0000;
}

.offset-curve-panel {
    margin-bottom: 16px;
}

.offset-curve-legend {
    grid-template-columns: repeat(2, max-content);
    justify-content: center;
}

.amortisation-area {
    fill: rgba(255, 0, 0, 0.08);
}

.amortisation-point {
    fill: #001f3f;
    stroke: #fff;
    stroke-width: 3;
    cursor: pointer;
}

.amortisation-point:hover,
.amortisation-point:focus {
    fill: #ff0000;
    outline: none;
}

.amortisation-tooltip {
    position: absolute;
    min-width: 190px;
    padding: 10px 12px;
    border: 1px solid rgba(0, 31, 63, 0.14);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 22px rgba(0, 31, 63, 0.16);
    color: #001f3f;
    font-size: 0.9rem;
    line-height: 1.45;
    pointer-events: none;
    transform: translate(-50%, -110%);
}

.amortisation-tooltip strong {
    display: block;
    margin-bottom: 4px;
}

.funds-chart-layout {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1fr);
    align-items: center;
    gap: 20px;
}

.funds-pie-chart svg {
    display: block;
    width: min(100%, 260px);
    margin: 0 auto;
}

.pie-center-label {
    fill: #001f3f;
    font-size: 16px;
    font-weight: 800;
}

.pie-center-value {
    fill: #444;
    font-size: 13px;
    font-weight: 700;
}

.chart-legend {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #001f3f;
    font-weight: 700;
}

.chart-legend i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.chart-result-summary {
    display: grid;
    gap: 6px;
}

.offset-savings-chart {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid rgba(0, 31, 63, 0.14);
    border-radius: 8px;
    background: #f7f9fc;
}

.offset-chart-head,
.offset-bar-row {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr) 120px;
    align-items: center;
    gap: 12px;
}

.offset-chart-head {
    grid-template-columns: minmax(0, 1fr) auto;
    color: #001f3f;
    font-weight: 800;
}

.offset-bar-row span {
    color: #001f3f;
    font-weight: 700;
}

.offset-bar-row strong {
    color: #001f3f;
    text-align: right;
}

.offset-bar-track {
    height: 16px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4e8ee;
}

.offset-bar-fill {
    height: 100%;
    min-width: 2px;
    border-radius: inherit;
}

.live-calculator .calculator-result-box {
    grid-column: 1 / -1;
}

.calculator input[type="range"] {
    height: 8px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff0000 var(--range-progress, 0%), #e4e8ee var(--range-progress, 0%));
    cursor: pointer;
    appearance: none;
}

.calculator input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #ff0000;
    box-shadow: 0 2px 8px rgba(0, 31, 63, 0.28);
    appearance: none;
}

.calculator input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #ff0000;
    box-shadow: 0 2px 8px rgba(0, 31, 63, 0.28);
}

.calculator input[type="range"]:focus-visible {
    outline: 3px solid rgba(255, 0, 0, 0.25);
    outline-offset: 4px;
}

.calculator input[type="range"]:disabled {
    background: #d7dce3;
    cursor: not-allowed;
    opacity: 0.58;
}

.calculator input[type="range"]:disabled::-webkit-slider-thumb {
    background: #7b8794;
}

.calculator input[type="range"]:disabled::-moz-range-thumb {
    background: #7b8794;
}

.calculator button {
    background-color: #001f3f; /* Midnight blue */
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
}

.calculator button:hover {
    background-color: #ff0000; /* Red */
}

.calculator-result-box,
.calculator [id$="-result-box"],
.calculator #LMI-result-box,
.calculator #offset-result-box,
.calculator #FTC-result-box {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid rgba(255, 0, 0, 0.22);
    border-radius: 8px;
    background: #fff7f7;
    color: #001f3f;
    line-height: 1.55;
}

.calculator-result-box p,
.calculator [id$="-result-box"] p {
    margin-bottom: 6px;
}

.result-note {
    font-size: 0.84rem;
    color: #444;
}

fieldset.calc-method {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 5px;
}

.calculator fieldset {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 31, 63, 0.16);
    border-radius: 8px;
    background: #fbfbfb;
}

legend {
    font-weight: bold;
    margin-bottom: 5px;
    color: #001f3f; /* Midnight blue */
}

.calc-method input[type="radio"] {
   /* margin-right: 10px;*/
}

.content-ol {
    padding-left: 40px;
    list-style-type: decimal;
}

.content-ol li {
    margin-bottom: 10px;
}

.content-ol a {
    color: #ff0000;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.content-ol a:hover {
    text-decoration: underline;
}

/* Stamp duty row */
/* Styles for stamp duty box */
.stamp-duty-calculator-box {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(0, 31, 63, 0.12);
    box-shadow: 0 12px 28px rgba(0, 31, 63, 0.1);
    align-items: center;
    width: 100%;
    max-width: 1200px;
}

.stamp-duty-box h3 {
    color: #001f3f;
    margin-left: 10px;
    font-size: 1.5rem;
}

.stamp-duty-box p {
    margin-bottom: 20px;
    padding-left: 20px;
    font-size: 1rem;
    line-height: 1.6;
}
.stamp-duty-box .row {
    display: flex;
    flex-wrap: wrap;
}

.stamp-duty-box {
    flex: 1;
    padding: 15px;
}

.content-ul {
    list-style-type: none;
    padding-left: 0;
    font-size: 1rem;
    text-decoration: none;
}

.content-ul li {
    margin-bottom: 10px;
}

.content-ul li a {
    color: #007bff;
    text-decoration: none;
}

.content-ul li a:hover {
    text-decoration: underline;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.radio-group label,
.calculator fieldset > div label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 16px 0 0;
    font-weight: 600;
}

.radio-group input,
.calculator fieldset input[type="radio"] {
    width: auto;
    margin: 0;
}

.col-lg-6 {
    flex: 1;
   /* min-width: 50%;*/
    padding: 15px;
}
/* Responsive Design */
@media (max-width: 1200px) {
    .stamp-duty-box {
        max-width: calc(50% - 20px); /* Two boxes per row for tablet */
    }
}

@media (max-width: 768px) {
    .calculator {
        padding: 22px 20px;
    }

    .calculator-selector-panel {
        position: static;
        grid-template-columns: 1fr;
        justify-content: stretch;
    }

    .range-label {
        display: grid;
        gap: 2px;
    }

    .exact-input-row {
        grid-template-columns: 1fr;
    }

    .live-calculator,
    .hem-expense-display {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .amortisation-chart {
        min-height: 260px;
    }

    .amortisation-axis-label {
        font-size: 11px;
    }

    .funds-chart-layout,
    .offset-bar-row {
        grid-template-columns: 1fr;
    }

    .offset-chart-head {
        grid-template-columns: 1fr;
    }

    .offset-bar-row strong {
        text-align: left;
    }

    .stamp-duty-box {
        max-width: 100%; /* Full width for mobile */
    }
}
/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .col-lg-6 {
        min-width: 100%;
    }
}
