:root {
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #374151;
    --text-light: #6b7280;
    --accent-green: #10b981;
    --accent-green-light: #d1fae5;
    --border-color: #e5e7eb;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
}

body { 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    padding: 2rem 1rem; 
    line-height: 1.5; 
}

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

.calculator-grid { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.card { 
    background: var(--card-bg); 
    border-radius: 16px; 
    padding: 2rem; 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); 
    flex: 1; 
    min-width: 320px; 
}

/* "Clear Form" Button & Header Alignment */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    margin-top: 0; 
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.section-header h2 {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.clear-btn {
    background-color: #fee2e2; /* Light red background */
    border: 1px solid #fca5a5; /* Visible border to make it a box */
    color: #dc2626; /* Dark red text */
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 6px 12px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); /* Slight shadow for depth */
}

.clear-btn:hover {
    background-color: #fef2f2; 
    border-color: #ef4444; 
}

h2 { 
    font-size: 1.1rem; 
    margin-bottom: 1rem; 
    color: #111827; 
    border-bottom: 1px solid var(--border-color); 
    padding-bottom: 0.5rem; 
    margin-top: 1.5rem; 
}
h2:first-child { margin-top: 0; }

.input-row { display: flex; gap: 1rem; }
.input-group { flex: 1; margin-bottom: 1rem; }

label { 
    display: block; 
    font-size: 0.875rem; 
    font-weight: 500; 
    margin-bottom: 0.5rem; 
    color: var(--text-main); 
}
input[type="number"] { 
    width: 100%; 
    padding: 0.75rem; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    font-size: 1rem; 
    transition: all 0.2s; 
    background-color: #f9fafb; 
}
input[type="number"]:focus { 
    outline: none; 
    border-color: var(--accent-green); 
    background-color: #fff; 
    box-shadow: 0 0 0 3px var(--accent-green-light); 
}

/* Restored Yellow "Extra Fee" Box */
.advanced-fee { 
    display: flex; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 12px; 
    margin-top: 0.5rem; 
    padding: 16px; 
    background-color: #fffbeb; 
    border-radius: 12px; 
    border: 1px solid #fde68a; 
}
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
input:checked + .slider { background-color: #f59e0b; } 
input:checked + .slider:before { transform: translateX(20px); }

.toggle-label { flex-grow: 1; font-size: 0.95rem; font-weight: 500; color: #92400e; } 
.small-input { width: 70px !important; padding: 0.5rem !important; text-align: center; border-radius: 6px; border: 1px solid #fcd34d; }
.percent-sign { color: #92400e; font-weight: bold; }

.chart-container { position: relative; height: 250px; width: 100%; margin-bottom: 1.5rem; min-height: 250px; }

/* Polished Stat Boxes using CSS Grid */
.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 16px; 
    margin-bottom: 1.5rem; 
}
.stat-box { 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #f9fafb; 
    padding: 1.5rem 1rem; 
    border-radius: 12px; 
    border: 1px solid var(--border-color); 
}
.stat-box span { font-size: 0.85rem; color: var(--text-light); font-weight: 500; margin-bottom: 8px; text-align: center; }
.stat-box h3 { font-size: 1.75rem; color: #111827; margin: 0; line-height: 1; font-weight: 700; }

.stat-box.highlight { 
    background: var(--accent-green-light); 
    border-color: #a7f3d0; 
    transition: all 0.3s; 
}
.stat-box.highlight h3 { color: #065f46; }

.insights-box { 
    background: #eff6ff; 
    padding: 1.5rem; 
    border-radius: 12px; 
    border: 1px solid #bfdbfe; 
    min-height: 175px; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-around;
}
.insights-box h3 { font-size: 1rem; color: #1e3a8a; margin-bottom: 0.5rem; }
.insights-box p { font-size: 0.9rem; color: #1e40af; margin-bottom: 0.4rem; }
.bold-text { font-weight: 700; font-size: 1.05rem; }
.projection-text { margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px dashed #93c5fd; }
