/* Global Resets and Font */
body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa; /* Light gray background */
    color: #343a40; /* Darker text for readability */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1000px; /* Max width for larger screens */
    margin: 20px auto; /* Centering and top/bottom margin */
    padding: 20px;
    background: #ffffff; /* White background for content */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); /* Softer shadow */
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef; /* Light separator */
}

header h1 {
    color: #007bff; /* Primary blue */
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: #6c757d; /* Muted text color */
}

main {
    flex-grow: 1;
}

/* Form Styling */
.form-section, .results-section {
    margin-bottom: 25px;
    padding: 20px;
}

.card { /* Common card styling for sections */
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.form-section h2, .results-section h2 {
    color: #343a40;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 1px solid #f1f1f1;
    padding-bottom: 10px;
}
.results-section h3 {
    color: #495057;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
}
.results-section h4 {
    color: #007bff;
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 1.1rem;
    text-align: center;
}


.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057; /* Slightly lighter label color */
}

.form-control, .form-control-file, .form-check-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
}
.form-control:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.form-control-file {
    padding: 0.4rem 0.8rem; /* Adjusted padding for file input */
}

.form-check-input {
    width: auto; /* Checkbox specific */
    margin-right: 0.5rem;
}
.form-check-label {
    font-weight: normal;
}

.grid-halves {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive grid */
    gap: 20px;
}

/* Buttons */
.btn {
    display: inline-flex; /* For aligning text and spinner */
    align-items: center;
    justify-content: center;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.75rem 1.5rem; /* Larger padding */
    font-size: 1rem;
    border-radius: 0.3rem;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    text-decoration: none; /* For potential <a> tags styled as buttons */
}

.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
    width: 100%; /* Full width button */
    margin-top: 10px;
}
.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}
.btn-primary:disabled {
    background-color: #007bff;
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d; /* Muted gray */
    border-color: #6c757d;
}
.btn-secondary:hover {
    background-color: #545b62;
    border-color: #545b62;
}
.btn-secondary:disabled {
    background-color: #6c757d;
    opacity: 0.65;
    cursor: not-allowed;
}

/* Spinner for button */
.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: text-bottom;
    border: .2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
    margin-left: 0.5rem;
}
@keyframes spinner-border {
    to { transform: rotate(360deg); }
}


/* Results Area */
#resultsArea h2, #resultsArea h3, #resultsArea h4 {
    color: #343a40;
}

pre {
    background: #e9ecef; /* Lighter background for pre */
    padding: 15px;
    border-radius: 4px;
    white-space: pre-wrap;       /* CSS3 */
    white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
    font-size: 0.9rem;
    border: 1px solid #dee2e6;
}

.chart-container {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 4px;
    text-align: center; /* Center images */
}
.chart-container img {
    max-width: 100%;
    height: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

/* Alerts and Messages */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.error-message {
    color: #721c24; /* Bootstrap danger text color */
    font-size: 0.9rem;
    margin-top: 5px;
}


/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 15px;
    }
    .grid-halves {
        grid-template-columns: 1fr; /* Stack on smaller screens */
    }
    header h1 {
        font-size: 1.8rem;
    }
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
    }
}
