

:root {
    --primary-color: #2563eb;
    --primary-light: #dbeafe;
    --secondary-color: #10b981;
    --secondary-light: #d1fae5;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    background: var(--primary-color);
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.2rem;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.calculator-card {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
    width: 100%;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Inputs Section */
.inputs-section {
    padding: 2.5rem;
    border-right: 1px solid var(--border-color);
}

.input-group {
    margin-bottom: 2.5rem;
}

.input-group:last-child {
    margin-bottom: 0;
}

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

.label-row label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.input-wrapper input {
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    width: 80px;
    text-align: right;
    outline: none;
    -moz-appearance: textfield;
}

.input-wrapper input::-webkit-outer-spin-button,
.input-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.currency-symbol, .suffix {
    color: var(--text-gray);
    font-weight: 500;
    font-size: 0.9rem;
}

.currency-symbol { margin-right: 4px; }
.suffix { margin-left: 4px; }

/* Range Slider Styling */
input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--primary-light);
    border-radius: 3px;
}

/* Firefox Slider Support */
input[type=range]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--primary-light);
    border-radius: 3px;
}

/* Results Section */
.results-section {
    background: var(--bg-color);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.chart-container {
    position: relative;
    width: 220px;
    height: 220px;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pie-chart {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Initial fallback gradient */
    background: conic-gradient(
        var(--primary-color) 0% 70%, 
        var(--secondary-color) 70% 100%
    );
    position: relative;
    transition: background 0.5s ease;
}

/* Inner circle for Donut Chart effect */
.pie-chart::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75%;
    height: 75%;
    background: var(--bg-color);
    border-radius: 50%;
}

.chart-center {
    position: absolute;
    text-align: center;
    z-index: 10;
}

.emi-label {
    font-size: 0.85rem;
    color: var(--text-gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-center h2 {
    font-size: 1.75rem;
    color: var(--text-dark);
    margin-top: 0.25rem;
}

.summary-details {
    width: 100%;
}

.summary-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.summary-item.total {
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 1rem;
    margin-bottom: 0;
    justify-content: space-between;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 12px;
}

.summary-item.principal .dot { background-color: var(--primary-color); }
.summary-item.interest .dot { background-color: var(--secondary-color); }

.summary-item .text {
    color: var(--text-gray);
    flex: 1;
}

.summary-item.total .text {
    color: var(--text-dark);
}

.summary-item .value {
    font-weight: 600;
    color: var(--text-dark);
}

.summary-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
}

footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-gray);
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-card {
        grid-template-columns: 1fr;
    }
    
    .inputs-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1.5rem;
    }

    .results-section {
        padding: 2rem 1.5rem;
    }
}