<?php
if (!defined('ABSPATH')) exit; // Exit if accessed directly 

$iwbvel_items = $new_form_items['type'];

foreach ($iwbvel_items as $iwbvel_name => $iwbvel_item):
    $iwbvel_field_id = 'iwbvel-bulk-new-form-' . esc_attr($iwbvel_item['name']);
    $iwbvel_field_type = isset($iwbvel_item['field_type']) ? $iwbvel_item['field_type'] : 'text';

    // Handle section headers
    if ($iwbvel_field_type === 'section_header') {
        if (!empty($iwbvel_item['label'])) {
            echo '<div><strong>' . esc_html($iwbvel_item['label']) . '</strong></div>';
        }
        echo '<hr><div class="iwbvel-mb20"></div>';
        continue;
    }
?>
    <div class="iwbvel-form-group" data-name="<?php echo esc_attr($iwbvel_name); ?>" data-type="<?php echo esc_attr($iwbvel_item['update_type']); ?>">
        <div>
            <label for="<?php echo esc_attr($iwbvel_field_id); ?>"><?php echo esc_html($iwbvel_item['label']); ?></label>

            <?php
            $iwbvel_field_type_path = IWBVEL_VIEWS_DIR . 'bulk_new_products_form/fields_type/' . $iwbvel_field_type . '.php';
            if (file_exists($iwbvel_field_type_path)) {
                include $iwbvel_field_type_path;
            } else {
                include IWBVEL_VIEWS_DIR . 'bulk_new_products_form/fields_type/text.php';
            }
            ?>
        </div>

        <?php if (isset($iwbvel_item['disabled']) && $iwbvel_item['disabled']): ?>
            <span class="iwbvel-alert-pro-description"><?php esc_html_e('Upgrade to pro version!', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></span>
        <?php endif; ?>
    </div>
<?php endforeach; ?>