body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    padding: 20px;
    max-width: 1000px; /* Increased max-width for table */
    margin: auto;
}

h1, h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
}

h2 {
    margin-top: 10px;
    font-size: 1.5em;
}

/* System Parameters Container */
.system-parameters-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Responsive columns */
    gap: 20px 30px; /* Row gap, Column gap */
    background-color: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.system-parameters-container .column h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
    text-align: left;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.form-group {
    margin-bottom: 15px;
    display: flex; /* Use flexbox for alignment */
    align-items: center; /* Vertically center label and input */
}

.form-group label {
    flex: 0 0 160px; /* Fixed width for labels */
    margin-bottom: 0; /* Remove bottom margin */
    font-weight: bold;
    padding-right: 10px; /* Space between label and input */
    text-align: right;
    white-space: nowrap; /* Prevent labels wrapping */
}

.form-group input,
.form-group select {
    flex: 1; /* Allow input/select to take remaining space */
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 250px; /* Limit max width */
}

/* Table Container */
.table-container {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow-x: auto; /* Allow horizontal scrolling */
}

.table-container h2 {
    text-align: left;
    font-size: 1.2em;
    margin-bottom: 15px;
}

#calculationTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#calculationTable th,
#calculationTable td {
    border: 1px solid #ddd;
    padding: 10px 8px; /* More padding */
    text-align: center;
    vertical-align: middle;
}

#calculationTable th {
    background-color: #e9ecef; /* Lighter grey header */
    font-weight: bold;
    white-space: nowrap;
    font-size: 0.9em;
}

/* Make input columns sized appropriately */
#calculationTable td input[type="number"],
#calculationTable td select {
    width: 90px; /* Adjust as needed */
    padding: 6px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}
#calculationTable td select {
    width: 110px; /* Slightly wider for size text */
}

/* Input group styling within the table cell */
#calculationTable td .input-group {
    display: flex;
    align-items: center;
    justify-content: center; /* Center input group in cell */
}
#calculationTable td .input-group input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    min-width: 60px; /* Ensure input doesn't get too small */
    max-width: 100px;
}
#calculationTable td .input-group .units-label {
    background-color: #e9ecef;
    border: 1px solid #ccc;
    border-left: 0;
    padding: 6px 8px;
    font-size: 0.85em;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    white-space: nowrap;
}


/* Result columns */
#calculationTable td.result-cell {
    font-weight: bold;
    min-width: 80px; /* Ensure space for results */
    font-size: 0.95em;
}

/* Action buttons in table */
#calculationTable .action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 6px;
    font-size: 18px; /* Larger 'x' */
    line-height: 1; /* Align 'x' better */
    color: #dc3545; /* Red for remove */
    opacity: 0.7;
    transition: opacity 0.2s;
}
#calculationTable .action-btn:hover {
    opacity: 1;
}

.table-buttons {
    margin-top: 20px;
    text-align: right;
}

.table-buttons button {
    background-color: #6c757d; /* Grey */
    color: white;
    padding: 10px 18px; /* More padding */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px; /* Slightly larger text */
    margin-left: 10px;
    transition: background-color 0.2s;
}
.table-buttons button.calculate-all-btn {
    background-color: #8B4513; /* Brown */
}

.table-buttons button:hover {
    opacity: 0.9;
}

/* Result cell styling */
.result-success { background-color: #d4edda !important; color: #155724 !important; }
.result-warning { background-color: #fff3cd !important; color: #856404 !important; }
.result-error { background-color: #f8d7da !important; color: #721c24 !important; }

/* Hidden class */
.hidden {
    display: none !important; /* Use important to ensure override */
}

/* Tooltip Styles (no change needed) */
.tooltip-icon {
    display: inline-block;
    position: relative;
    cursor: help;
    color: #007bff;
    font-weight: bold;
    margin-left: 5px;
}

.tooltip-icon .tooltip-text {
    visibility: hidden;
    width: 250px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: normal;
}

.tooltip-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Animation for row removal */
@keyframes fadeOut {
    from { opacity: 1; transform: scaleY(1); }
    to { opacity: 0; transform: scaleY(0.8); }
}
.row-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}