body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #333;
}

.container {
    max-width: 850px;
    /* Slightly wider for tabs */
    margin: 30px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #0056b3;
    text-align: center;
    margin-bottom: 10px;
    /* Reduced margin */
    font-size: 2rem;
    /* Slightly larger H1 */
}

/* Updated Tagline Style */
p.tagline {
    font-size: 0.95em;
    font-style: italic;
    /* Added italic */
    color: #6c757d;
    text-align: left;
    /* Kept left align */
    margin-top: 0;
    /* Adjusted margin */
    margin-bottom: 20px;
    /* Adjusted margin */
    line-height: 1.4;
    /* Added line-height */
}

/* Added subtle note style */
p.subtle-note {
    font-size: 0.85em;
    color: #666;
    margin-top: -10px;
    margin-bottom: 15px;
}

p {
    margin-bottom: 15px;
}

form {
    margin-top: 10px;
    padding: 25px;
    background-color: #f8f9fa;
    /* Kept user's form background */
    border: 1px solid #e9ecef;
    /* Added subtle border */
    border-radius: 5px;
    margin-bottom: 30px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
}

input[type=number] {
    /* Keep width calculation */
    width: calc(100% - 12px);
    padding: 8px 6px;
    margin-bottom: 15px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

input[type=submit] {
    display: block;
    width: 100%;
    padding: 12px 15px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    transition: background-color 0.2s ease-in-out;
    margin-top: 15px;
}

input[type=submit]:hover {
    background-color: #0056b3;
}

/* Combined Result/Warning/Error base style */
.result,
.warning,
.error {
    margin-top: 25px;
    /* Increased top margin */
    padding: 15px 20px;
    /* Adjusted padding */
    border-radius: 5px;
    border-left: 5px solid;
    margin-bottom: 20px;
    /* Added bottom margin */
}

.result {
    background-color: #e6f7ff;
    border-color: #007bff;
    color: #004085;
    /* Slightly darker text */
}

/* Use H3 inside results for consistency */
.result h3 {
    margin-top: 0;
    color: #0056b3;
    font-size: 1.2rem;
    /* Adjusted size */
    border-bottom: 1px solid #b8daff;
    /* Subtle border */
    padding-bottom: 8px;
    margin-bottom: 15px;
}

/* Warning Style */
.warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
    /* Keep user's color */
}

/* Ensure text inside warnings isn't bold by default */
.warning p {
    margin: 0;
    font-weight: normal;
}

/* Allow bolding specific parts */
.warning p b,
.warning p strong {
    font-weight: bold;
}


/* Error Style */
.error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.error p {
    margin: 0;
    font-weight: bold;
    /* Errors are important */
}


ul {
    padding-left: 20px;
    list-style: disc;
    margin-top: 10px;
    /* Add space before list */
}

li {
    margin-bottom: 8px;
}

b,
strong {
    font-weight: 600;
    /* Keep user's bold style */
}

hr {
    border: none;
    border-top: 1px solid #dee2e6;
    /* Keep user's hr style */
    margin: 30px 0;
    /* Increased margin */
}

/* Headings inside tab content */
.tab-content h2 {
    margin-top: 0;
    /* Remove top margin */
    margin-bottom: 15px;
    padding-bottom: 10px;
    /* Increased padding */
    border-bottom: 2px solid #007bff;
    color: #0056b3;
    font-size: 1.5rem;
}

/* Sub-headings inside forms */
form h3 {
    margin-top: 0;
    /* Remove top margin if it's first element */
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 5px;
    /* Increased padding */
}

form h3:first-child {
    margin-top: 0;
}


/* Form Grid */
.form-grid {
    display: grid;
    /* Keep auto-fit, adjusted minmax */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px 20px;
    /* Row and column gap */
    margin-bottom: 20px;
}

/* Density Grid */
.density-grid {
    display: grid;
    /* Keep auto-fit, specific minmax for densities */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px 20px;
    /* Match form-grid gap */
}

/* Input width within grids */
.form-grid input[type=number],
.density-grid input[type=number] {
    width: calc(100% - 12px);
    /* Ensure consistency */
}

/* Tab Styles */
.tab-container {
    width: 100%;
    margin-top: 20px;
}

.tab-control {
    display: none;
}

.tab-label {
    display: inline-block;
    padding: 12px 25px;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    position: relative;
    top: 1px;
    margin-right: 3px;
    color: #495057;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    font-size: 1rem;
}

.tab-label:hover {
    background-color: #f8f9fa;
    /* Lighter hover */
}

.tab-control:checked+.tab-label {
    background-color: #fff;
    /* Active tab background */
    border-color: #dee2e6;
    border-bottom: 1px solid #fff;
    /* Hide bottom border */
    color: #0056b3;
    /* Active tab text color */
    font-weight: bold;
}

.tab-content-wrapper {
    background-color: #fff;
    border: 1px solid #dee2e6;
    padding: 30px;
    border-radius: 0 5px 5px 5px;
    /* Match tab corner radius */
    /* box-shadow: 0 2px 5px rgba(0,0,0,0.05); Removed shadow, border provides definition */
    clear: both;
}

.tab-content {
    display: none;
    /* Hide content by default */
}

/* Show active tab content - IMPORTANT: Added #tab-nutrient-level */
#tab-solution:checked~.tab-content-wrapper>#content-solution,
#tab-dry-dose:checked~.tab-content-wrapper>#content-dry-dose,
#tab-nutrient-level:checked~.tab-content-wrapper>#content-nutrient-level,
#tab-tds:checked~.tab-content-wrapper>#content-tds {
    /* Added rule for new tab */
    display: block;
}


/* Warnings Container */
.warnings-container {
    margin-top: 20px;
    margin-bottom: 20px;
    /* Add space after warnings */
    /* Using existing .warning style, just need container */
}

.warnings-container .warning {
    margin-bottom: 10px;
    /* Space between multiple warnings */
}

.warnings-container .warning:last-child {
    margin-bottom: 0;
}


/* Responsive adjustments */
@media (max-width: 600px) {
    .container {
        margin: 10px;
        padding: 15px;
        /* Adjusted padding */
    }

    h1 {
        font-size: 1.8rem;
        /* Adjusted size */
    }

    .tab-label {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .form-grid,
    .density-grid {
        grid-template-columns: 1fr;
        /* Stack columns */
        gap: 10px;
    }

    .tab-content-wrapper {
        padding: 20px;
        /* Adjusted padding */
    }

    input[type=submit] {
        font-size: 1rem;
        padding: 10px 12px;
    }

    /* Ensure inputs take full width on mobile */
    input[type=number] {
        width: calc(100% - 12px);
    }
}

/* Style for the Unit Radio Buttons */
.unit-selector {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f0f0f0; /* Light background for distinction */
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.unit-selector strong {
    margin-right: 15px;
    color: #333;
}

.unit-selector label {
    display: inline-block; /* Keep labels next to radios */
    margin-right: 15px; /* Space between options */
    margin-left: 3px; /* Space after radio button */
    font-weight: normal; /* Normal weight for options */
    cursor: pointer;
}

.unit-selector input[type="radio"] {
    margin-right: 2px; /* Tiny space */
    cursor: pointer;
    vertical-align: middle; /* Align radios with text */
}

/* Optional: Adjust chemical input grid margin */
.chemical-inputs {
    margin-top: 15px; /* Add some space below unit selector */
}

/* TDS Calculator Styles */
.tds-salt-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.salt-result {
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.salt-result strong {
    color: #0056b3;
    display: block;
    margin-bottom: 5px;
    font-size: 1.05em;
}

.salt-result ul {
    margin: 5px 0 0 0;
    padding-left: 18px;
}

.salt-result li {
    margin: 3px 0;
    font-size: 0.9em;
    color: #555;
}

/* Help Section Styles */
.help-section {
    margin: 15px 0 25px 0;
    padding: 0;
}

.help-toggle {
    background-color: #e3f2fd;
    border: 1px solid #2196f3;
    color: #1976d2;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.help-toggle:hover {
    background-color: #bbdefb;
}

.help-content {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 20px;
    margin-top: 10px;
    line-height: 1.5;
}

.help-content h4 {
    color: #0056b3;
    margin-top: 0;
    margin-bottom: 15px;
}

.help-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.help-content li {
    margin: 5px 0;
    color: #555;
}

.help-content strong {
    color: #333;
}