/* ========================================
   EMI Calculator - Reference Design Style
   ======================================== */

/* Section Header */
.emi-section-header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 50px;
    position: relative;
    z-index: 1;
}

.emi-section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(239, 68, 68, 0.1) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.emi-section-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.emi-section-title span {
    background: linear-gradient(135deg, #2563eb 0%, #ef4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.emi-section-subtitle {
    font-size: 1.0625rem;
    color: #64748b;
    line-height: 1.7;
    max-width: 520px;
    margin: 0 auto;
}

/* Section Background */
.emi-section-home {
    position: relative;
    padding: 100px 0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 50%, #ffffff 100%);
    overflow: hidden;
}

.emi-section-home::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 30% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 70% 80%, rgba(239, 68, 68, 0.05) 0%, transparent 40%);
    pointer-events: none;
}

.emi-calculator-ref {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.emi-ref-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .emi-ref-container {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Left Column - Loan Details
   ======================================== */
.emi-ref-left {
    display: flex;
}

.emi-ref-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
    width: 100%;
}

.emi-ref-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.emi-ref-title svg {
    color: #64748b;
}

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

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

.emi-ref-label {
    font-size: 0.9375rem;
    color: #64748b;
    font-weight: 500;
}

.emi-ref-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e40af;
}

/* Custom Slider with Visible Thumb */
.emi-ref-slider {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
}

.emi-ref-slider-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
    margin: 0;
}

.emi-ref-slider-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: visible;
}

.emi-ref-slider-fill {
    height: 100%;
    background: #1e40af;
    border-radius: 3px;
    width: 30%;
    transition: width 0.1s ease;
}

/* Visible Thumb */
.emi-ref-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #1e40af;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(30, 64, 175, 0.4);
    left: var(--thumb-position, 30%);
    transform: translateX(-50%);
    z-index: 2;
    pointer-events: none;
    transition: left 0.1s ease;
}

.emi-ref-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 8px;
}

/* Result Cards */
.emi-ref-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #f1f5f9;
}

.emi-ref-result-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.emi-ref-result-card.blue {
    background: #eff6ff;
}

.emi-ref-result-card.green {
    background: #f0fdf4;
}

.emi-ref-result-card.red {
    background: #fef2f2;
}

.emi-ref-result-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

.emi-ref-result-value {
    font-size: 1.125rem;
    font-weight: 700;
}

.emi-ref-result-card.blue .emi-ref-result-value {
    color: #1e40af;
}

.emi-ref-result-card.green .emi-ref-result-value {
    color: #166534;
}

.emi-ref-result-card.red .emi-ref-result-value {
    color: #dc2626;
}

/* ========================================
   Right Column - Charts
   ======================================== */
.emi-ref-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.emi-ref-chart-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.emi-ref-chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.emi-ref-chart-title svg {
    color: #64748b;
}

/* Doughnut Chart - Fixed Container */
.emi-ref-doughnut-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex: 1;
    min-height: 160px;
}

.emi-ref-doughnut-container {
    position: relative;
    width: 150px;
    height: 150px;
    flex-shrink: 0;
}

.emi-ref-doughnut-container canvas {
    width: 150px !important;
    height: 150px !important;
}

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

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

.emi-ref-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.emi-ref-legend-dot.blue {
    background: #3b82f6;
}

.emi-ref-legend-dot.red {
    background: #ef4444;
}

.emi-ref-legend-label {
    font-size: 0.875rem;
    color: #64748b;
}

.emi-ref-legend-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1e293b;
    margin-left: auto;
}

/* Line Chart - Fixed Height */
.emi-ref-line-wrapper {
    height: 160px;
    position: relative;
    flex: 1;
    min-height: 0;
}

.emi-ref-line-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 768px) {
    .emi-calculator-ref {
        padding: 16px;
    }
    
    .emi-ref-card {
        padding: 24px;
    }
    
    .emi-ref-results {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .emi-ref-result-card {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 14px 16px;
    }
    
    .emi-ref-doughnut-wrapper {
        flex-direction: column;
        gap: 20px;
        min-height: auto;
    }
    
    .emi-ref-doughnut-container {
        width: 140px;
        height: 140px;
    }
    
    .emi-ref-doughnut-container canvas {
        width: 140px !important;
        height: 140px !important;
    }
    
    .emi-ref-chart-legend {
        flex-direction: row;
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }
    
    .emi-ref-line-wrapper {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .emi-ref-card,
    .emi-ref-chart-card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .emi-ref-title {
        font-size: 1.125rem;
        margin-bottom: 20px;
    }
    
    .emi-ref-value {
        font-size: 1rem;
    }
    
    .emi-ref-result-value {
        font-size: 1rem;
    }
    
    .emi-ref-doughnut-container {
        width: 120px;
        height: 120px;
    }
    
    .emi-ref-doughnut-container canvas {
        width: 120px !important;
        height: 120px !important;
    }
    
    .emi-ref-line-wrapper {
        height: 140px;
    }
}


/* ========================================
   Section Header Responsive
   ======================================== */
@media (max-width: 768px) {
    .emi-section-home {
        padding: 60px 0;
    }
    
    .emi-section-header {
        margin-bottom: 36px;
        padding: 0 16px;
    }
    
    .emi-section-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .emi-section-home {
        padding: 48px 0;
    }
    
    .emi-section-header {
        margin-bottom: 28px;
    }
    
    .emi-section-title {
        font-size: 1.5rem;
    }
    
    .emi-section-subtitle {
        font-size: 0.9375rem;
    }
}
