/* Base styles */
body {
    font-family: sans-serif;
    margin: 20px;
    background-color: #f4f7f6;
    font-size: 16px; /* Base font size */
}
.container {
    max-width: 800px;
    margin: auto;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.2rem; /* Using rem for relative sizing */
}
h2 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 15px; /* Lebih dekat */
    font-size: 1.8rem; /* Using rem */
}
label {
    display: block;
    margin-bottom: 5px; /* Lebih dekat */
    font-weight: bold;
    color: #34495e;
    font-size: 1rem; /* Using rem */
}
/* Unified styling for text inputs and selects */
input[type="text"],
input[type="number"],
select {
    padding: 10px;
    margin-bottom: 10px; /* Lebih dekat */
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    width: 100%;
    font-size: 1rem; /* Using rem */
    min-height: 40px; /* Ensure consistent height for text fields and selects */
    -webkit-appearance: none; /* Remove default select styling for better control */
    -moz-appearance: none;
    appearance: none;
    background-color: white; /* Ensure consistent background */
    /* Custom arrow for select box */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%204%205%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M2%200L0%202h4zM2%205L0%203h4z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 0.7em top 50%, 0 0;
    background-size: 0.65em auto, 100%;
}

/* Specific styling for radio buttons to add spacing */
input[type="radio"] {
    width: auto; /* Override 100% width */
    margin-right: 5px; /* Space between radio and its label */
    vertical-align: middle; /* Align with text */
    min-height: auto; /* Don't force min-height on radio */
}
.radio-option { /* NEW: Wrapper for each radio+label pair */
    display: inline-block; /* Make each option float next to each other */
    margin-right: 15px; /* Space between options (e.g., "Yes" and "No") */
}
.radio-option label {
    display: inline-block; /* Allow labels to sit next to radios */
    margin-bottom: 0; /* Remove default label margin for inline display */
    font-weight: normal; /* Labels for radio/checkbox often not bold */
}


.form-row {
    display: flex;
    gap: 15px; /* Jarak antar kolom lebih dekat */
    margin-bottom: 10px; /* Jarak antar baris lebih dekat */
}
.form-column {
    flex: 1;
    min-width: 0;
}
.input-with-select {
    display: flex;
    align-items: center;
}
.input-with-select input {
    flex-grow: 1;
    margin-right: 8px;
    width: auto;
}
.input-with-select select {
    width: auto;
    min-width: 70px;
    margin-right: 8px;
}
.input-with-select .unit-label {
    white-space: nowrap;
    margin-left: auto;
}

.form-group { margin-bottom: 15px; }
.hint {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: -8px;
    margin-bottom: 10px;
}
.section-separator { border-top: 1px dashed #bdc3c7; margin: 20px 0; }
button {
    background-color: #3498db;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    width: 100%;
    margin-top: 10px;
}
button:hover { background-color: #2980b9; }
.toggle-section {
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
    background-color: #ecf0f1;
}

/* Language Toggle Styles */
.language-toggle {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #555;
}
.language-toggle span { margin: 0 5px; }
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 20px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider { background-color: #3498db; }
input:focus + .slider { box-shadow: 0 0 1px #3498db; }
input:checked + .slider:before {
    -webkit-transform: translateX(20px);
    -ms-transform: translateX(20px);
    transform: translateX(20px);
}

/* Styles for Dynamic Composition Rows */
.dynamic-composition-row {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    display: flex; /* Use flexbox for inner row layout */
    align-items: flex-end; /* Align items to the bottom */
    gap: 10px; /* Space between component name/percent and delete button */
}

.dynamic-composition-row .form-column {
    margin-bottom: 0; /* Override default form-column margin-bottom */
}

.dynamic-composition-row input {
    margin-bottom: 0; /* Remove extra margin from inputs inside dynamic rows */
}

.delete-row-button {
    background-color: #e74c3c; /* Red color for delete */
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap; /* Prevent button text from wrapping */
    height: 40px; /* Match height with inputs */
    line-height: 24px; /* Adjust line-height for vertical alignment */
    width: auto; /* Override 100% width for button */
}
.delete-row-button:hover {
    background-color: #c0392b;
}

.add-component-button {
    background-color: #2ecc71; /* Green color for add */
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 10px;
    width: auto; /* Override 100% width */
}
.add-component-button:hover {
    background-color: #27ae60;
}

/* Styles for Results Display */
.results-table {
    margin-bottom: 20px;
    overflow-x: auto; /* For responsive tables on small screens */
}
.results-table table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
.results-table th, .results-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
    font-size: 0.95rem;
}
.results-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #34495e;
}
.results-table tr:nth-child(even) {
    background-color: #f9f9f9;
}
.results-table tr:hover {
    background-color: #f1f1f1;
}
.results-table strong {
    color: #2c3e50;
}
.back-to-form {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 15px;
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}
.back-to-form:hover {
    background-color: #5a6268;
}

/* Ensure calculated values are always visible */
.calculated-value {
    display: inline;  /* Ensure it's not hidden by default */
    visibility: visible; /* Ensure it's not hidden */
    color: inherit; /* Ensure color is not  transparent */
    font-weight: bold; /* Keep it bold visually */
}


/* Responsive adjustments for smaller screens */
@media (max-width: 600px) {
    body { font-size: 14px; }
    .container { padding: 15px; margin: 10px; }
    h1 { font-size: 1.8rem; margin-bottom: 20px; }
    h2 { font-size: 1.5rem; margin-bottom: 10px; }
    label, input, select, .input-with-select .unit-label, button { font-size: 0.95rem; }
    .hint { font-size: 0.8rem; }
    .form-row { flex-direction: column; gap: 0; }
    .form-column { margin-bottom: 10px; }
    input[type="text"], input[type="number"], select { margin-bottom: 8px; }
    label { margin-bottom: 3px; }
    .language-toggle { justify-content: center; margin-top: 10px; }

    /* Responsive adjustments for dynamic rows on small screens */
    .dynamic-composition-row {
        flex-direction: column; /* Stack name/percent/delete vertically */
        align-items: stretch; /* Stretch items to full width */
        gap: 0;
    }
    .dynamic-composition-row .form-column {
        margin-bottom: 10px; /* Add margin between stacked inputs */
    }
    .delete-row-button {
        width: 100%; /* Make delete button full width on mobile */
        margin-top: 5px;
    }
}