:root {
--primary-color: #1d1d1d;
--primary-color-light: #444444;
--secondary-color: #f4f4f4;
--text-main: #1d1d1d;
--text-muted: #666666;
--input-bg: #899bbd24;
--bg-page: #f4f4f4;
--white: #ffffff;
--border-radius: 12px;
}  

body.emi-calculator-page {
    font-family: 'Inter', sans-serif;
    background-color: #f4f4f4;
    color: #1d1d1d;
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* ========================
   EMI-Calculator
========================== */
.emi-calc-container {
    max-width: 1100px;
    width: 100%;
}

/* Calculator Card */
.emi-calc-card {
    background-color: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    padding: 3rem;
    margin-bottom: 2rem;
}

.emi-calc-header {
    margin-bottom: 3rem;
    text-align: left;
}

.emi-calc-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    margin-top: 0;
    color: var(--text-main);
}

.emi-calc-header p {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 800px;
    margin: 0;
}

.emi-calc-top-section {
    display: flex;
    flex-wrap: wrap;
    gap: 4rem;
    margin-bottom: 0;
}

.emi-calc-input-section {
    flex: 1;
    min-width: 300px;
}

.emi-calc-chart-section {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Form Groups */
.emi-calc-form-group {
    margin-bottom: 2.5rem;
}

.emi-calc-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.emi-calc-label-row label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
}

.emi-calc-input-wrapper {
    background-color: var(--input-bg);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    width: 160px;
    font-weight: 700;
    color: var(--primary-color);
}

.emi-calc-input-wrapper input {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    width: 100%;
    text-align: right;
    outline: none;
    font-family: 'Inter', sans-serif;
}

/* Hide Spin buttons */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.emi-calc-currency-symbol,
.emi-calc-suffix {
    color: var(--text-muted);
    font-weight: 500;
    margin: 0 4px;
}

/* Range Sliders */
.emi-calc-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    outline: none;
    margin-top: 0.5rem;
    cursor: pointer;
}

/* Slider Thumb */
.emi-calc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid white;
    box-shadow: 0 0 0 1px var(--primary-color);
    cursor: pointer;
    transition: transform 0.1s;
    margin-top: -8px;
}

.emi-calc-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* For Firefox */
.emi-calc-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: 3px solid white;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
    cursor: pointer;
}

.emi-calc-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Result Display (Main EMI) */
.emi-calc-result-display {
    margin-top: 2rem;
}

.emi-calc-result-display .emi-calc-label {
    font-size: 1.1rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.5rem;
}

.emi-calc-result-display h1 {
    font-size: 3rem;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.2;
    font-weight: 700;
}

.emi-calc-result-display .emi-calc-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Chart Section */
.emi-calc-chart-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin-bottom: 2rem;
}

.emi-calc-chart-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    width: 160px;
}

.emi-calc-chart-center-text .emi-calc-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.emi-calc-chart-center-text .emi-calc-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

/* Legend */
.emi-calc-chart-legend {
    display: flex;
    gap: 3rem;
}

.emi-calc-legend-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.emi-calc-legend-item .emi-calc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.emi-calc-dot.emi-calc-aspect-principal {
    background-color: var(--primary-color);
}

.emi-calc-dot.emi-calc-aspect-interest {
    background-color: var(--secondary-color);
}

.emi-calc-legend-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.emi-calc-legend-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Amortization Schedule */
.emi-calc-amortization-section {
    padding-top: 0;
}

.emi-calc-amortization-section h3 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

.emi-calc-table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    /* Add vertical spacing between rows instead of horizontal */
    font-size: 0.95rem;
}

th {
    text-align: left;
    padding: 1rem;
    background-color: var(--input-bg);
    color: var(--text-main);
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    color: var(--text-muted);
}

tr:last-child td {
    border-bottom: none;
}

/* Helper for range sliders */
input[type="range"] {
    background: linear-gradient(to right, var(--primary-color) 0%, var(--primary-color) 0%, #e5e7eb 0%, #e5e7eb 100%);
}

/* Year Header in Amortization Table */
/* Year Header in Amortization Table */
.emi-calc-year-header td {
    background: transparent;
    padding: 0;
    border: none;
    height: auto;
}

.emi-calc-year-header-inner {
    background-color: #ffffff;
    font-weight: 600;
    color: var(--text-main);
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;

    /* Flex layout to put arrow on right */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row-reverse;
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    margin-bottom: 8px;
}

/* Toggle Icon specific styles */
.emi-calc-toggle-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #f3f4f6;
    margin-left: 12px;
    margin-right: 0;
    font-size: 0;
    color: transparent;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

/* Custom Chevron using pseudo-element */
.emi-calc-toggle-icon::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-right: 2px solid #555;
    border-top: 2px solid #555;
    transform: rotate(45deg) translateX(-2px);
    margin-left: -2px;
}

.emi-calc-year-text {
    flex: 1;
}

/* Ensure expanded rows look good */
.emi-calc-year-header {
    user-select: none;
}

.emi-calc-year-header:hover .emi-calc-year-header-inner {
    background-color: #fafafa;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.emi-calc-year-header:hover .emi-calc-toggle-icon {
    background-color: #e5e7eb;
    border-color: #d1d5db;
    transform: scale(1.05);
}

/* Active State (Expanded) */
.expanded .emi-calc-year-header-inner {
    background-color: #f9fafb;
    border-color: #e5e7eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Rotate icon when expanded */
.expanded .emi-calc-toggle-icon {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: rotate(90deg);
    /* Rotate 90 deg to point down */
}

.expanded .emi-calc-toggle-icon::after {
    border-color: white;
    /* White arrow on dark background */
}

/* Back Button */
.back-button {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
}

.back-button:hover {
    color: var(--primary-color);
}

/* Hide on desktop, show on mobile */
@media (min-width: 992px) {
    .back-button {
        display: none;
    }
}

@media (max-width: 991px) {
    .emi-calculator-page {
        padding: 1rem;
    }

    .back-button {
        display: block; /* Ensure it's displayed as a block element */
        padding-left: 1rem; /* Aligns with body padding */
        margin-bottom: 1rem; /* Add margin below button for spacing */
    }

    .emi-calc-card {
        padding: 1.5rem;
    }

    .emi-calc-top-section {
        flex-direction: column;
        gap: 2.5rem;
    }

    .emi-calc-header {
        margin-bottom: 2rem;
    }

    .emi-calc-header h2 {
        font-size: 1.5rem;
    }

    .emi-calc-result-display h1 {
        font-size: 2.2rem;
    }

    .emi-calc-chart-container {
        width: 100%;
        max-width: 280px;
        height: auto;
        aspect-ratio: 1 / 1;
    }
    
    .emi-calc-chart-legend {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
        width: 100%;
    }

    .emi-calc-legend-item {
        align-items: center;
        width: 100%;
        max-width: 250px;
    }

    th, td {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .emi-calc-label-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .emi-calc-input-wrapper {
        width: 90%;
    }

    .emi-calc-result-display h1 {
        font-size: 1.8rem;
    }

    .emi-calc-header p {
        font-size: 0.9rem;
    }
}
