/* Basic Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f4f4f4;
    padding: 20px;
    display: flex;
    justify-content: center; /* Center items horizontally */
    align-items: flex-start; /* Align items to the top */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 30px; /* Space between canvas and controls */
}

.main-container {
    display: flex;
    flex-direction: column; /* Stack canvas and controls vertically */
    align-items: center; /* Center items horizontally within the container */
    width: 100%;
}


/* --- Canvas Styling --- */
/* Container to control display size and aspect ratio */
#canvas-container {
    width: 95%; /* Responsive width */
    max-width: 1000px; /* Max display width on desktop */
    border: 1px solid #ccc;
    background-color: #e0e0e0; /* Placeholder bg */
    /* Maintain aspect ratio of the canvas (2000 / 1014) */
    aspect-ratio: 2000 / 1014;
    margin-bottom: 30px; /* Space below canvas */
    overflow: hidden; /* Hide any potential overflow if aspect ratio slightly off */
    position: relative; /* Needed for potential absolute elements if added later */
}

/* Canvas itself fills the container */
#loanCanvas {
    display: block; /* Removes bottom space */
    width: 100%;
    height: 100%;
    background-color: white; /* Fallback color */
}

/* --- Controls Styling --- */
#controls {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 95%;
    max-width: 1000px; /* Match canvas max width */
}

#controls h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

#controls hr {
    margin: 20px 0;
    border: none;
    border-top: 1px solid #eee;
}

#controls h3 {
    margin-top: 15px;
    margin-bottom: 15px;
    color: #555;
    font-size: 1.1em;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.form-row {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping within a row */
    gap: 15px; /* Space between items in a row */
    margin-bottom: 15px;
}

.form-group {
    flex: 1; /* Allow groups to grow */
    min-width: 180px; /* Minimum width before wrapping */
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9em;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    width: 100%; /* Take full width within the group */
}

.form-group input[type="color"] {
    padding: 0;
    height: 38px; /* Match text input height */
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    min-width: 50px; /* Ensure color picker is not too small */
    flex-grow: 0; /* Don't allow color picker to grow excessively */
}

.form-group input[type="range"] {
    width: 100%;
    margin-top: 5px;
    cursor: pointer;
}

.form-group.slider-group label {
    display: flex;
    justify-content: space-between; /* Put percentage on the right */
}

.form-group button[type="button"] {
    padding: 5px 10px;
    font-size: 0.8em;
    margin-top: 5px;
    background-color: #eee;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    align-self: flex-start; /* Don't stretch button */
}
.form-group button[type="button"]:hover {
    background-color: #ddd;
}


#download-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: #C00000; /* Match highlight color */
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    margin-top: 25px;
    transition: background-color 0.3s ease;
}

#download-btn:hover {
    background-color: #A00000; /* Darker shade on hover */
}

/* Media Query for better layout on very small screens if needed */
@media (max-width: 600px) {
    .form-row {
        flex-direction: column; /* Stack elements vertically on small screens */
        gap: 10px;
    }
    .form-group {
        min-width: auto; /* Remove min-width */
    }
    body {
        padding: 10px;
    }
    #controls {
        padding: 15px;
    }
}