#anesthesia-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: Arial, sans-serif;
}

#anesthesia-form-container h3 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
}

.form-section {
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    background-color: #f9f9f9;
}

.form-section legend {
    font-weight: bold;
    font-size: 18px;
    color: #2c3e50;
    padding: 0 10px;
    background-color: white;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
}

.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.form-row label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #444;
    font-size: 14px;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="date"],
.form-row select,
.form-row textarea {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

.form-row input[type="text"]:focus,
.form-row input[type="number"]:focus,
.form-row input[type="date"]:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.form-row select[multiple] {
    height: auto;
    min-height: 80px;
}

.multi-select-container {
    position: relative;
}

.multi-select-container small {
    color: #666;
    font-style: italic;
    margin-top: 5px;
    display: block;
}

/* Two-input rows (age + unit, weight + unit) */
.form-row select + select,
.form-row input + select {
    margin-left: 10px;
    flex: 0 0 auto;
    width: 120px;
}

.form-row:has(input[name="patient_age"]),
.form-row:has(input[name="weight"]) {
    flex-direction: row;
    align-items: flex-end;
}

.form-row:has(input[name="patient_age"]) input,
.form-row:has(input[name="weight"]) input {
    flex: 1;
    margin-right: 10px;
}

.form-row:has(input[name="patient_age"]) label,
.form-row:has(input[name="weight"]) label {
    margin-bottom: 5px;
    flex: 100%;
}

.form-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e1e1e1;
}

#submit-btn {
    background-color: #2980b9;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#submit-btn:hover {
    background-color: #3498db;
}

#submit-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

#form-messages {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
}

#form-messages.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#form-messages.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#download-section {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
}

#download-section h4 {
    color: #155724;
    margin-bottom: 15px;
}

#download-link {
    display: inline-block;
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

#download-link:hover {
    background-color: #218838;
}

/* Required field indicator */
label:has(+ input[required]),
label:has(+ select[required]),
label:has(+ textarea[required]) {
    position: relative;
}

label:has(+ input[required])::after,
label:has(+ select[required])::after,
label:has(+ textarea[required])::after {
    content: " *";
    color: #e74c3c;
    font-weight: bold;
}

/* Loading state */
.loading #submit-btn {
    position: relative;
    color: transparent;
}

.loading #submit-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Responsive design */
@media (max-width: 600px) {
    #anesthesia-form-container {
        padding: 15px;
    }

    .form-section {
        padding: 15px;
    }

    .form-row:has(input[name="patient_age"]),
    .form-row:has(input[name="weight"]) {
        flex-direction: column;
    }

    .form-row:has(input[name="patient_age"]) input,
    .form-row:has(input[name="weight"]) input {
        margin-right: 0;
        margin-bottom: 5px;
    }

    .form-row select + select,
    .form-row input + select {
        margin-left: 0;
        width: 100%;
    }
}