jQuery(document).ready(function($){$('.calcufacil-aquarium_substrate.calcufacil-container').each(function(){const $container=$(this);const $substrateTypeSelect=$container.find('select[name="substrate_type"]');const $customDensityGroup=$container.find('[id^="custom_density_fields_"]');const $substrateDimsGroup=$container.find('[id^="substrate_dims_group_"]');// Container for L,W,Depth function toggleSubstrateInputs(){const selectedType=$substrateTypeSelect.val();if (selectedType==='bare'){$substrateDimsGroup.slideUp();$substrateDimsGroup.find('input, select').prop('required',false);$customDensityGroup.slideUp();$customDensityGroup.find('input').prop('required',false)}else{$substrateDimsGroup.slideDown();$substrateDimsGroup.find('input[name="tank_length"], input[name="tank_width"], input[name="substrate_depth"]').prop('required',true);$substrateDimsGroup.find('select[name="dim_unit"], select[name="depth_unit"]').prop('required',true);if (selectedType==='custom_density'){$customDensityGroup.slideDown();$customDensityGroup.find('input[name="custom_density_lb_cu_ft"]').prop('required',true);// custom_bag_weight_lb is optional}else{$customDensityGroup.slideUp();$customDensityGroup.find('input').prop('required',false)}}}$substrateTypeSelect.on('change',toggleSubstrateInputs);// Initial state toggleSubstrateInputs()})});