:root {
    --brand-navy: #0a126e;
    --brand-green: #42d113;
    --bg-light: #f4f6f9;
}

/* Container */
.emi-grid-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 30px;
    background: #ffffff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(10, 18, 110, 0.08);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    align-items: stretch; 
}

/* --- Inputs Section --- */
.input-group { margin-bottom: 30px; }

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.label-row label {
    font-size: 15px;
    font-weight: 600;
    color: var(--brand-navy);
}

/* UNIFIED INPUT DESIGN */
.input-wrapper {
    display: flex;
    align-items: center;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 2px;
    transition: border-color 0.3s;
    width: 140px; /* Fixed width to prevent shifting */
    justify-content: flex-end; /* Align content to right */
}

.input-wrapper:focus-within {
    border-bottom-color: var(--brand-green);
}

.input-symbol {
    font-weight: 700;
    color: var(--brand-navy);
    font-size: 18px;
    margin-right: 4px;
}

.input-unit {
    font-weight: 600;
    color: var(--brand-navy);
    font-size: 14px;
    margin-left: 5px;
}

.editable-field {
    border: none !important;
    background: transparent;
    text-align: right; 
    font-weight: 700;
    font-size: 18px;
    color: var(--brand-navy) !important;
    outline: none;
    padding: 0;
    width: 100%;
}

/* Sliders */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 5px;
    outline: none;
    display: block;
    margin-bottom: 8px;
    margin-top: 15px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--brand-navy);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: var(--brand-green);
}

.limit-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
}

/* --- Middle Column: Result --- */
.emi-col-result {
    display: flex;
    flex-direction: column;
}

.result-card {
    background: var(--bg-light);
    width: 100%;
    flex: 1; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 20px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid #eef0f5;
}

.emi-title {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.result-card h2 {
    font-size: 42px;
    font-weight: 800;
    color: var(--brand-navy);
    margin: 0 0 15px 0;
}

/* FIXED: 3-Row Limit for Words to prevent Shaking */
.emi-words {
    font-size: 14px;
    color: #777;
    font-style: italic;
    line-height: 1.5;
    /* Reserve height for exactly 3 lines (1.5 line-height * 3 = 4.5em) */
    min-height: 4.5em; 
    max-height: 4.5em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

/* --- Right Column: Chart --- */
.chart-container-unique {
    height: 200px;
    position: relative;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.modern-legend { padding: 0 10px; }

.leg-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: #444;
    align-items: center;
}

.dot {
    height: 12px;
    width: 12px;
    border-radius: 3px;
    display: inline-block;
    margin-right: 8px;
}

.p-dot { background: var(--brand-navy); }
.i-dot { background: var(--brand-green); }

.total-row {
    border-top: 1px solid #ddd;
    padding-top: 15px;
    margin-top: 15px;
    font-weight: 700;
    color: var(--brand-navy);
}

.btn-primary-emi {
    background: var(--brand-navy);
    color: #fff;
    border: none;
    padding: 15px;
    width: 100%;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    margin-top: 25px;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(10, 18, 110, 0.2);
}

.btn-primary-emi:hover {
    background: var(--brand-green);
    transform: translateY(-2px);
}

/* --- Schedule & Accordion --- */
.emi-schedule-section { margin-top: 50px; }

.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.year-row {
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.year-header {
    background: #fff;
    padding: 18px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--brand-navy);
    transition: 0.3s;
}

.year-header:hover { background: var(--bg-light); }
.year-header.active { background: #f0fdf4; border-bottom: 1px solid #eee; }

/* Shake Animation */
@keyframes shakeText {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

.shake-it {
    animation: shakeText 0.4s ease-in-out;
    color: var(--brand-green);
}

.month-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.month-table th { background: var(--brand-navy);
    color: #fff !important;
    padding: 12px !important;
    font-size: 13px;
    text-align: center;}
.month-table td { padding: 12px; font-size: 13px; color: #555; border: 1px solid #eee; text-align: center; }
.month-table td:first-child { text-align: center; font-weight: 600; color: var(--brand-navy); }

/* Mobile CSS */
@media (max-width: 1024px) {
    .emi-grid-container { grid-template-columns: 1fr; padding: 25px; }
    .result-card { padding: 40px; min-height: auto; }
    .label-row { flex-wrap: wrap; }
    .month-table th, .month-table td { font-size: 11px; padding: 10px 5px; }
}