@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

#emiApp {
    font-family: 'Inter', sans-serif;
    max-width: 1100px;
    margin: 0 auto;
    background: #0f0f1a;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    color: #fff;
}

/* Header */
.emi-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #f472b6 100%);
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.emi-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: headerPulse 4s ease-in-out infinite;
}

@keyframes headerPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 1; }
}

.emi-header-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.emi-header h2 {
    margin: 0 0 8px;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.emi-header p {
    margin: 0;
    font-size: 16px;
    opacity: 0.85;
}

/* Body */
.emi-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

/* Left Panel */
.emi-left {
    padding: 36px;
    border-right: 1px solid rgba(255,255,255,0.08);
    background: #13131f;
}

/* Loan Type Tabs */
.emi-loan-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 32px;
}

.emi-loan-tab {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.emi-loan-tab:hover {
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.4);
    color: #fff;
}

.emi-loan-tab.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 15px rgba(99,102,241,0.4);
}

/* Input Group */
.emi-input-group {
    margin-bottom: 28px;
}

.emi-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}

.emi-label-row label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    flex: 1;
}

.emi-value-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 8px 14px;
    gap: 6px;
    min-width: 120px;
}

.emi-value-box span {
    font-size: 14px;
    color: #6366f1;
    font-weight: 700;
}

.emi-value-box input {
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    width: 90px;
    text-align: right;
}

/* Tenure Toggle */
.emi-tenure-toggle {
    display: flex;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
}

.emi-tenure-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.emi-tenure-btn.active {
    background: #6366f1;
    color: #fff;
}

/* Slider */
.emi-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    outline: none;
    cursor: pointer;
    margin-bottom: 8px;
}

.emi-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.3);
    transition: box-shadow 0.2s;
}

.emi-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 8px rgba(99,102,241,0.2);
}

.emi-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255,255,255,0.35);
}

/* Calculate Button */
.emi-calc-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #f472b6 100%);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(99,102,241,0.4);
    margin-top: 8px;
}

.emi-calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(99,102,241,0.5);
}

.emi-calc-btn:active {
    transform: translateY(0);
}

/* Right Panel */
.emi-right {
    padding: 36px;
    background: #0f0f1a;
}

/* Result Cards */
.emi-result-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 28px;
}

.emi-result-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 18px;
    text-align: center;
    transition: all 0.3s ease;
}

.emi-result-card:hover {
    background: rgba(99,102,241,0.1);
    border-color: rgba(99,102,241,0.3);
    transform: translateY(-2px);
}

.emi-main-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(244,114,182,0.2));
    border-color: rgba(99,102,241,0.3);
}

.emi-result-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.emi-result-label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.emi-result-value {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

.emi-main-card .emi-result-value {
    font-size: 28px;
    background: linear-gradient(135deg, #6366f1, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Chart Section */
.emi-chart-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

#emiDonutChart {
    max-width: 200px;
    max-height: 200px;
}

.emi-chart-legend {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.emi-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.emi-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.emi-legend-item span {
    color: rgba(255,255,255,0.6);
    flex: 1;
}

.emi-legend-item strong {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

/* Table Section */
.emi-table-section {
    padding: 28px 36px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: #13131f;
}

.emi-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.emi-table-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.emi-toggle-btn {
    background: rgba(99,102,241,0.2);
    border: 1px solid rgba(99,102,241,0.4);
    color: #6366f1;
    padding: 8px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.emi-toggle-btn:hover {
    background: #6366f1;
    color: #fff;
}

.emi-table-scroll {
    overflow-x: auto;
}

#emiTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

#emiTable thead tr {
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(244,114,182,0.3));
}

#emiTable th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.8);
}

#emiTable td {
    padding: 13px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.75);
    font-weight: 500;
}

#emiTable tbody tr:hover {
    background: rgba(99,102,241,0.08);
}

#emiTable tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

/* Responsive */
@media (max-width: 768px) {
    .emi-body {
        grid-template-columns: 1fr;
    }
    .emi-left {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .emi-result-cards {
        grid-template-columns: 1fr;
    }
    .emi-main-card {
        grid-column: 1;
    }
}
