/* --- Global Styles & Font --- */
body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f8f9fa; /* Lighter background */
    color: #343a40; /* Darker text for better contrast */
}

/* --- Typography --- */
h1 {
    text-align: center;
    color: #0056b3; /* Primary blue color */
    margin-bottom: 30px;
    font-weight: 700;
}

h2 {
    text-align: left; /* Align section headers left */
    color: #0056b3;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6; /* Subtle separator */
    font-weight: 700;
}

/* --- Main Calculator Layout --- */
.calculator {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between; /* Better spacing */
    background: #ffffff; /* Clean white background */
    padding: 30px;
    border-radius: 12px; /* More rounded corners */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Softer shadow */
    max-width: 1000px; /* Slightly wider */
    margin: 20px auto;
}

/* --- Section Styling --- */
.car-section, .common-section {
    flex-basis: calc(50% - 20px); /* Adjusted basis for space */
    margin-bottom: 30px; /* Increased bottom margin */
    padding: 25px;
    border: 1px solid #e9ecef; /* Lighter border */
    border-radius: 8px;
    background-color: #ffffff; /* Keep sections white */
    box-sizing: border-box; /* Include padding in width calculation */
}

.ev-section h2 {
    color: #28a745; /* Green for EV */
    border-bottom-color: #a3d9b1;
}

.fuel-section h2 {
    color: #dc3545; /* Red for Fuel */
    border-bottom-color: #f5c6cb;
}

.common-section {
     flex-basis: 100%; /* Common section spans full width */
     background-color: #f8f9fa; /* Slightly different background */
     margin-top: 10px; /* Add some space above */
}
.common-section h2 {
    color: #0056b3; /* Back to primary blue */
    border-bottom-color: #dee2e6;
}


/* --- Labels & Inputs --- */
label {
    display: block; /* Labels on their own line */
    width: 100%;   /* Full width */
    margin-bottom: 8px;
    font-weight: 400; /* Regular weight */
    color: #495057; /* Slightly lighter text */
    font-size: 0.95em;
}

input[type="number"] {
    width: calc(100% - 22px); /* Full width minus padding/border */
    padding: 10px;
    margin-bottom: 15px; /* More space below input */
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

input[type="number"]:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* --- Validation Styling --- */
.validation-msg {
    color: #dc3545; /* Bootstrap danger red */
    font-size: 0.85em;
    margin-left: 0; /* Reset margin */
    display: block; /* Show message below input */
    margin-top: -10px; /* Pull message up slightly */
    margin-bottom: 10px;
    min-height: 1.2em; /* Reserve space to prevent layout shifts */
}

input.invalid {
    border-color: #dc3545;
    background-color: #f8d7da; /* Light red background */
}
input.invalid:focus {
     border-color: #dc3545;
     box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}


/* --- Results Section --- */
#results {
    flex-basis: 100%;
    margin-top: 20px;
    padding: 25px;
    border: 1px solid #c3e6cb; /* Green border */
    border-radius: 8px;
    background-color: #d4edda; /* Light green background */
    color: #155724; /* Dark green text */
}

#results h2 {
    margin-top: 0;
    color: #155724; /* Dark green header */
    border-bottom-color: #b1dfbb;
}

#results p {
    margin: 12px 0;
    font-size: 1.05em; /* Slightly larger result text */
    font-weight: 400;
}
#results p:last-child {
    margin-bottom: 0;
}

/* --- Responsive Adjustments --- */
@media (max-width: 992px) { /* Adjust breakpoint */
    .car-section {
        flex-basis: calc(50% - 15px); /* Slightly adjust basis */
    }
}

@media (max-width: 768px) {
    .car-section {
        flex-basis: 100%; /* Stack sections */
        margin-bottom: 25px;
    }
    .calculator {
        padding: 20px;
    }
    h1 {
        font-size: 1.8em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .calculator {
        padding: 15px;
    }
    h1 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
    h2 {
        font-size: 1.2em;
    }
    label {
        font-size: 0.9em;
    }
    input[type="number"] {
        padding: 8px;
        font-size: 0.95em;
    }
    #results p {
        font-size: 1em;
    }
}
