<?php
    if ( ! defined( 'ABSPATH' ) ) exit;
    
    $model_src = get_post_meta($post->ID, '_u3dmv_model_src', true);
    $model_height = get_post_meta($post->ID, '_u3dmv_model_height', true);
    $model_display = get_post_meta($post->ID, '_u3dmv_model_display', true);
    $model_position = get_post_meta($post->ID, '_u3dmv_model_position', true);
    $model_dimensions = get_post_meta($post->ID, '_u3dmv_model_dimensions', true);
    $model_dimensions_scale_factor = get_post_meta($post->ID, '_u3dmv_model_dimensions_scale_factor', true);
    $model_dimensions_custom = get_post_meta($post->ID, '_u3dmv_model_dimensions_custom', true);
    $model_dimensions_x = get_post_meta($post->ID, '_u3dmv_model_dimensions_x', true);
    $model_dimensions_y = get_post_meta($post->ID, '_u3dmv_model_dimensions_y', true);
    $model_dimensions_z = get_post_meta($post->ID, '_u3dmv_model_dimensions_z', true);
    $model_poster = get_post_meta($post->ID, '_u3dmv_model_poster', true);
    $model_env = get_post_meta($post->ID, '_u3dmv_model_env', true);
    $model_skybox = get_post_meta($post->ID, '_u3dmv_model_skybox', true);
    $model_tone_mapping = get_post_meta($post->ID, '_u3dmv_model_tone_mapping', true);
    $model_exposure = get_post_meta($post->ID, '_u3dmv_model_exposure', true);
    $model_shadow_int = get_post_meta($post->ID, '_u3dmv_model_shadow_int', true);
    $model_shadow_soft = get_post_meta($post->ID, '_u3dmv_model_shadow_soft', true);
    $model_camera_orbit = get_post_meta($post->ID, '_u3dmv_model_camera_orbit', true);
    $model_camera_orbit_max = get_post_meta($post->ID, '_u3dmv_model_camera_orbit_max', true);
    $model_camera_orbit_min = get_post_meta($post->ID, '_u3dmv_model_camera_orbit_min', true);
    $model_camera_target =  get_post_meta($post->ID, '_u3dmv_model_camera_target', true);
    $model_camera_fov = get_post_meta($post->ID, '_u3dmv_model_camera_fov', true);
    $model_camera_fov_max = get_post_meta($post->ID, '_u3dmv_model_camera_fov_max', true);
    $model_camera_fov_min = get_post_meta($post->ID, '_u3dmv_model_camera_fov_min', true);
    $model_loading = get_post_meta($post->ID, '_u3dmv_model_loading', true);
    $model_rotation = get_post_meta($post->ID, '_u3dmv_model_rotation', true);
    $model_ar = get_post_meta($post->ID, '_u3dmv_model_ar', true);
    $model_ios_src = get_post_meta($post->ID, '_u3dmv_model_ios_src', true);

    $gallery = get_post_meta($post->ID, '_product_image_gallery', true);
    $gallery_ids = array_filter(explode(',', $gallery));
?>
<div class="u3dmv-metabox">
    <!-- MODEL SOURCE -->
    <div id="u3dmv-source-selection">
        <h4><?php echo esc_html__('3D Model Viewer Source', 'ultimate-3d-model-viewer'); ?></h4>

        <p>
            <label for="u3dmv_model_src">
                <?php echo esc_html__('Select or upload a .glb or .gltf file', 'ultimate-3d-model-viewer'); ?>
            </label><br>

            <input
                type="text"
                id="u3dmv_model_src"
                name="u3dmv_model_src"
                readonly
                value="<?php echo esc_attr($model_src); ?>"
            />
            <br>

            <button type="button" class="button u3dmv-upload-btn" id="u3dmv_model_src_upload">
                <?php echo esc_html__('Select File', 'ultimate-3d-model-viewer'); ?>
            </button>

            <button type="button" class="button u3dmv-delete-btn" id="u3dmv_model_src_delete">
                <?php echo esc_html__("Delete File", "ultimate-3d-model-viewer"); ?>
            </button>
        </p>
    </div>

    <br>

    <div id="u3dmv-style-selection">
        <h4>Style</h4>

        <p><?php echo esc_html__("Select a height for the model viewer", "ultimate-3d-model-viewer") ?></p>

        <div class="u3dmv-flex-container">
            <label id="u3dmv_model_height_label" for="u3dmv_model_height">px</label>
            <input
                id="u3dmv_model_height"
                name="u3dmv_model_height"
                type="text"
                value="<?php echo esc_attr($model_height) ?>"
            />
        </div>
    </div>

    <hr>

        <!-- POSITIONING ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__("positioning", "ultimate-3d-model-viewer"); ?></strong></summary>
        <div id="u3dmv-display-selection">
            <p><?php echo esc_html__("Display Size", "ultimate-3d-model-viewer") ?></p>

            <p><?php echo esc_html__("Would you like the model viewer to occupy half of the page layout?", "ultimate-3d-model-viewer"); ?></p>
            <input
                id="u3dmv_model_display"
                name="u3dmv_model_display"
                type="checkbox"
                value="1"
                <?php checked($model_display, '1'); ?>
            />

            <br>

            <p><?php echo esc_html__("Position of the model viewer", "ultimate-3d-model-viewer"); ?></p>
            <label>
                <input type="radio" name="u3dmv_model_position" value="above" <?php checked($model_position, 'above'); ?> />
                <?php echo esc_html__("Above product image", "ultimate-3d-model-viewer"); ?>
            </label><br>

            <?php if(empty($gallery_ids)): ?>
                <label>
                    <input type="radio" name="u3dmv_model_position" value="under" <?php checked($model_position, 'under'); ?>/>
                    <?php echo esc_html__("Under product image", "ultimate-3d-model-viewer"); ?>
                </label><br>
            <?php endif; ?>

            <label>
                <input type="radio" name="u3dmv_model_position" value="right" <?php checked($model_position, 'right'); ?>/>
                <?php echo esc_html__("Right side of product image", "ultimate-3d-model-viewer"); ?>
            </label><br>

            <label>
                <input type="radio" name="u3dmv_model_position" value="left" <?php checked($model_position, 'left'); ?>/>
                <?php echo esc_html__("Left side of product image", "ultimate-3d-model-viewer"); ?>
            </label><br>

            <label>
                <input type="radio" name="u3dmv_model_position" value="replace" <?php checked($model_position, 'replace'); ?>/>
                <?php echo esc_html__("Replace product image", "ultimate-3d-model-viewer"); ?>
            </label>
        </div>
    </details>

    <hr>

    <!-- SKYBOX ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('Skybox', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <div id="u3dmv-skybox-selection">
            <p>
                <label for="u3dmv_model_skybox">
                    <?php echo esc_html__("Select a skybox image (JPG or PNG)", "ultimate-3d-model-viewer"); ?>
                </label>
            </p>

            <input
                type="text"
                id="u3dmv_model_skybox"
                name="u3dmv_model_skybox"
                readonly
                value="<?php echo esc_attr($model_skybox); ?>"
            />
            <br>
            <button type="button" class="button u3dmv-upload-btn" id="u3dmv_model_skybox_upload">
                <?php echo esc_html__('Select File', 'ultimate-3d-model-viewer'); ?>
            </button>

            <button type="button" class="button u3dmv-delete-btn" id="u3dmv_model_skybox_delete">
                <?php echo esc_html__("Delete File", "ultimate-3d-model-viewer"); ?>
            </button>
        </div>
    </details>

    <hr>

    <!-- DIMENSIONS ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('Dimensions', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <div id="u3dmv-dimensions-selection">
            <p><?php echo esc_html__("Show dimensions of the 3D product?", "ultimate-3d-model-viewer"); ?></p>
            <input
                id="u3dmv_model_dimensions"
                name="u3dmv_model_dimensions"
                type="checkbox"
                <?php checked($model_dimensions, '1'); ?>
            />

            <!-- SCALE FACTOR -->
            <p><?php echo esc_html__("Are your real dimensions too small or to big? Use a scale factor e.g. 10 or 0.1","ultimate-3d-model-viewer"); ?></p>
            <div class="u3dmv-flex-container">
                <label id="u3dmv_model_dimensions_scale_factor_label" for="u3dmv_model_dimensions_scale_factor"><?php echo esc_html__("Scale", "ultimate-3d-model-viewer");?></label>
                <input 
                    id="u3dmv_model_dimensions_scale_factor"
                    name="u3dmv_model_dimensions_scale_factor"
                    type="text"
                    value="<?php echo esc_attr($model_dimensions_scale_factor); ?>"
                />
            </div>
            

            <p><?php echo esc_html__("Use custom dimensions instead of actual model size?","ultimate-3d-model-viewer") ?></p>
            <input
                id="u3dmv_model_dimensions_custom"
                name="u3dmv_model_dimensions_custom"
                type="checkbox"
                <?php checked($model_dimensions_custom, '1'); ?>
            />
            
            <p><?php echo esc_html__("Enter custom width, height and depth in centimeters for your product", "ultimate-3d-model-viewer"); ?></p>

            <div class="u3dmv-flex-container">
                <label id="u3dmv_model_dimensions_x_label" for="u3dmv_model_dimensions_x"><?php echo esc_html__("Width", "ultimate-3d-model-viewer");?></label>
                <input 
                    id="u3dmv_model_dimensions_x"
                    name="u3dmv_model_dimensions_x"
                    type="text"
                    value="<?php echo esc_attr($model_dimensions_x); ?>"
                />
            </div>

            <div class="u3dmv-flex-container">
                <label id="u3dmv_model_dimensions_y_label" for="u3dmv_model_dimensions_y"><?php echo esc_html__("Height", "ultimate-3d-model-viewer");?></label>
                <input 
                    id="u3dmv_model_dimensions_y"
                    name="u3dmv_model_dimensions_y"
                    type="text"
                    value="<?php echo esc_attr($model_dimensions_y); ?>"
                />
            </div>

            <div class="u3dmv-flex-container">
                <label id="u3dmv_model_dimensions_z_label" for="u3dmv_model_dimensions_z"><?php echo esc_html__("Depth", "ultimate-3d-model-viewer");?></label>
                <input 
                    id="u3dmv_model_dimensions_z"
                    name="u3dmv_model_dimensions_z"
                    type="text"
                    value="<?php echo esc_attr($model_dimensions_z); ?>"
                />
            </div>
        </div>
    </details>

    <hr>

    <!-- POSTER OPTIONS ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('poster', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <?php if (u3mv_fs()->can_use_premium_code__premium_only()) : ?>
            <div id="u3dmv-poster">
                <label for="u3dmv_model_poster">
                    <?php echo esc_html__("Select a poster image (JPG or PNG)", "ultimate-3d-model-viewer"); ?>
                </label><br>

                <input
                    type="text"
                    id="u3dmv_model_poster"
                    name="u3dmv_model_poster"
                    readonly
                    value="<?php echo esc_attr($model_poster); ?>"
                />
                <br>

                <button type="button" class="button u3dmv-upload-btn" id="u3dmv_model_poster_upload">
                    <?php echo esc_html__('Select File', 'ultimate-3d-model-viewer'); ?>
                </button>

                <button type="button" class="button u3dmv-delete-btn" id="u3dmv_model_poster_delete">
                    <?php echo esc_html__("Delete File", "ultimate-3d-model-viewer"); ?>
                </button>
            </div>
        <?php else: ?>
            <!-- PREMIUM NOTICE -->
            <div class="u3dmv-metabox">
                <h4><?php echo esc_html__("Upgrade now to Pro to display a background poster while the model is loading", "ultimate-3d-model-viewer"); ?></h4>
                <a
                    class="button"
                    id="u3dmv_model_upgrade_pro"
                    href="<?php echo esc_url(u3mv_fs()->checkout_url()); ?>"
                    target="_blank"
                >
                    <?php echo esc_html__('Upgrade now', 'ultimate-3d-model-viewer'); ?>
                </a>
            </div>
        <?php endif; ?>
    </details>

    <hr>

    <!-- ENVIRONMENT ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('Environment', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <?php if (u3mv_fs()->can_use_premium_code__premium_only()) : ?>
            <div id="u3dmv-environment-selection">
                <p>
                    <label for="u3dmv_model_environment">
                        <?php echo esc_html__("Select an .hdr or .jpg environment image", "ultimate-3d-model-viewer"); ?>
                    </label>
                </p>

                <input
                    type="text"
                    id="u3dmv_model_env"
                    name="u3dmv_model_env"
                    readonly
                    value="<?php echo esc_attr($model_env); ?>"
                />
                <br>
                <button type="button" class="button u3dmv-upload-btn" id="u3dmv_model_env_upload">
                    <?php echo esc_html__('Select File', 'ultimate-3d-model-viewer'); ?>
                </button>

                <button type="button" class="button u3dmv-delete-btn" id="u3dmv_model_env_delete">
                    <?php echo esc_html__("Delete File", "ultimate-3d-model-viewer"); ?>
                </button>
            </div>
        <?php else: ?>
            <!-- PREMIUM NOTICE -->
            <div class="u3dmv-metabox">
                <h4><?php echo esc_html__("Upgrade now to Pro to select an environment image that affects the lighting reflections on your model.", "ultimate-3d-model-viewer"); ?></h4>
                <a
                    class="button"
                    id="u3dmv_model_upgrade_pro"
                    href="<?php echo esc_url(u3mv_fs()->checkout_url()); ?>"
                    target="_blank"
                >
                    <?php echo esc_html__('Upgrade now', 'ultimate-3d-model-viewer'); ?>
                </a>
            </div>
        <?php endif; ?>
    </details>

    <hr>

    <!-- TONE-MAPPING ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('tone mapping', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <?php if (u3mv_fs()->can_use_premium_code__premium_only()) : ?>
            <div id="u3dmv-tone-mapping-selection">
                <p><?php echo esc_html__("Select one of the available moods", "ultimate-3d-model-viewer"); ?></p>

                <select name="u3dmv_model_tone_mapping" id="u3dmv_model_tone_mapping">
                    <option value="neutral" <?php echo selected($model_tone_mapping, 'neutral', false); ?>><?php echo esc_html__('neutral', 'ultimate-3d-model-viewer'); ?></option>
                    <option value="aces" <?php echo selected($model_tone_mapping, 'aces', false); ?>><?php echo esc_html__('aces', 'ultimate-3d-model-viewer'); ?></option>
                    <option value="agx" <?php echo selected($model_tone_mapping, 'agx', false); ?>><?php echo esc_html__('agX', 'ultimate-3d-model-viewer'); ?></option>
                    <option value="reinhard" <?php echo selected($model_tone_mapping, 'reinhard', false); ?>><?php echo esc_html__('reinhard', 'ultimate-3d-model-viewer'); ?></option>
                    <option value="cineon" <?php echo selected($model_tone_mapping, 'cineon', false); ?>><?php echo esc_html__('cineon', 'ultimate-3d-model-viewer'); ?></option>
                    <option value="linear" <?php echo selected($model_tone_mapping, 'linear', false); ?>><?php echo esc_html__('linear', 'ultimate-3d-model-viewer'); ?></option>
                    <option value="none" <?php echo selected($model_tone_mapping, 'none', false); ?>><?php echo esc_html__('none', 'ultimate-3d-model-viewer'); ?></option>
                </select>
            </div>
        <?php else: ?>
            <!-- PREMIUM NOTICE -->
            <div class="u3dmv-metabox">
                <h4><?php echo esc_html__("Upgrade now to Pro to change the tone mapping of the 3D scene.", "ultimate-3d-model-viewer"); ?></h4>
                <a
                    class="button"
                    id="u3dmv_model_upgrade_pro"
                    href="<?php echo esc_url(u3mv_fs()->checkout_url()); ?>"
                    target="_blank"
                >
                    <?php echo esc_html__('Upgrade now', 'ultimate-3d-model-viewer'); ?>
                </a>
            </div>
        <?php endif; ?>
    </details>

    <hr>

    <!-- EXPOSURE ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('exposure', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <?php if (u3mv_fs()->can_use_premium_code__premium_only()) : ?>
            <div id="u3dmv-exposure-selection">
                <div class="u3dmv-flex-container">
                    <label id="u3dmv_model_exposure_label" for="u3dmv_model_exposure">5</label>
                    <input
                        id="u3dmv_model_exposure"
                        name="u3dmv_model_exposure"
                        type="range"
                        min="1"
                        max="10"
                        step="0.1"
                        value="<?php echo esc_attr($model_exposure) ?>"
                    />
                </div>
            </div>
        <?php else: ?>
             <!-- PREMIUM NOTICE -->
            <div class="u3dmv-metabox">
                <h4><?php echo esc_html__("Upgrade now to Pro to change the exposure of the 3D scene.", "ultimate-3d-model-viewer"); ?></h4>
                <a
                    class="button"
                    id="u3dmv_model_upgrade_pro"
                    href="<?php echo esc_url(u3mv_fs()->checkout_url()); ?>"
                    target="_blank"
                >
                    <?php echo esc_html__('Upgrade now', 'ultimate-3d-model-viewer'); ?>
                </a>
            </div>
        <?php endif; ?>
    </details>

    <hr>


    <!-- SHADOW ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('shadows', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <?php if (u3mv_fs()->can_use_premium_code__premium_only()) : ?>
            <div id="u3dmv-shadows-selection">
                <p><?php echo esc_html__("shadow intensity", "ultimate-3d-model-viewer")?></p>

                <div class="u3dmv-flex-container">
                    <label id="u3dmv_model_shadow_int_label" for="u3dmv_model_shadow_int">0.5</label>
                    <input
                        id="u3dmv_model_shadow_int"
                        name="u3dmv_model_shadow_int"
                        type="range"
                        min="0"
                        max="1"
                        step="0.01"
                        value="<?php echo esc_attr($model_shadow_int) ?>"
                    />
                </div>

                <br>

                <p><?php echo esc_html__("shadow softness", "ultimate-3d-model-viewer")?></p>

                <div class="u3dmv-flex-container">
                    <label id="u3dmv_model_shadow_soft_label" for="u3dmv_model_shadow_soft">0.5</label>
                    <input
                        id="u3dmv_model_shadow_soft"
                        name="u3dmv_model_shadow_soft"
                        type="range"
                        min="0"
                        max="1"
                        step="0.01"
                        value="<?php echo esc_attr($model_shadow_soft) ?>"
                    />
                </div>

            </div>
        <?php else: ?>
            <!-- PREMIUM NOTICE -->
            <div class="u3dmv-metabox">
                <h4><?php echo esc_html__("Upgrade now to Pro to customize shadows of the 3D scene.", "ultimate-3d-model-viewer"); ?></h4>
                <a
                    class="button"
                    id="u3dmv_model_upgrade_pro"
                    href="<?php echo esc_url(u3mv_fs()->checkout_url()); ?>"
                    target="_blank"
                >
                    <?php echo esc_html__('Upgrade now', 'ultimate-3d-model-viewer'); ?>
                </a>
            </div>
        <?php endif; ?>
    </details>

    <hr>

    <!-- CAMERA OPTIONS ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('camera options', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <?php if (u3mv_fs()->can_use_premium_code__premium_only()) : ?>
            <div id="u3dmv-camera-options">
                <p><?php echo esc_html__("Enter 3 value camera orbit (e.g., 0deg 75deg 105%)", "ultimate-3d-model-viewer"); ?></p>

                <div class="u3dmv-flex-container">
                    <label for="u3dmv_model_camera_orbit">Camera-Orbit</label>
                    <input
                        type="text"
                        id="u3dmv_model_camera_orbit"
                        name="u3dmv_model_camera_orbit"
                        placeholder="0deg 75deg 105%"
                        value="<?php echo esc_attr($model_camera_orbit) ?>"
                    />
                </div>

                <br>

                <p><?php echo esc_html__("Enter 3 value maximum camera orbit (e.g., Infinity 180deg auto)", "ultimate-3d-model-viewer"); ?></p>

                <div class="u3dmv-flex-container">
                    <label for="u3dmv_model_camera_orbit_max">Camera-Orbit-Max</label>
                    <input
                        type="text"
                        id="u3dmv_model_camera_orbit_max"
                        name="u3dmv_model_camera_orbit_max"
                        placeholder="Infinity 180deg auto"
                        value="<?php echo esc_attr($model_camera_orbit_max) ?>"
                    />
                </div>

                <br>

                <p><?php echo esc_html__("Enter 3 value minimum camera orbit (e.g., -Infinity 0deg auto)", "ultimate-3d-model-viewer"); ?></p>

                <div class="u3dmv-flex-container">
                    <label for="u3dmv_model_camera_orbit_min">Camera-Orbit-Min</label>
                    <input
                        type="text"
                        id="u3dmv_model_camera_orbit_min"
                        name="u3dmv_model_camera_orbit_min"
                        placeholder="-Infinity 0deg auto"
                        value="<?php echo esc_attr($model_camera_orbit_min) ?>"
                    />
                </div>

                <br>

                <p><?php echo esc_html__("Enter 3 value camera target (e.g., 0m 1.5m -0.5m)", "ultimate-3d-model-viewer"); ?></p>

                <div class="u3dmv-flex-container">
                    <label for="u3dmv_model_camera_target">Camera-Target</label>
                    <input
                        type="text"
                        id="u3dmv_model_camera_target"
                        name="u3dmv_model_camera_target"
                        placeholder="0m 1.5m -0.5m"
                        value="<?php echo esc_attr($model_camera_target) ?>"
                    />
                </div>

                <br>

                <p><?php echo esc_html__("Enter field of view (e.g., 30deg)", "ultimate-3d-model-viewer"); ?></p>

                <div class="u3dmv-flex-container">
                    <label for="u3dmv_model_camera_fov">Camera-Fov</label>
                    <input
                        type="text"
                        id="u3dmv_model_camera_fov"
                        name="u3dmv_model_camera_fov"
                        placeholder="30deg"
                        value="<?php echo esc_attr($model_camera_fov) ?>"
                    />
                </div>

                <br>

                <p><?php echo esc_html__("Enter maximum field of view (e.g., 30deg)", "ultimate-3d-model-viewer"); ?></p>

                <div class="u3dmv-flex-container">
                    <label for="u3dmv_model_camera_fov_max">Camera-Fov-Max</label>
                    <input
                        type="text"
                        id="u3dmv_model_camera_fov_max"
                        name="u3dmv_model_camera_fov_max"
                        placeholder="30deg"
                        value="<?php echo esc_attr($model_camera_fov_max) ?>"
                    />
                </div>

                <br>

                <p><?php echo esc_html__("Enter minimum field of view (e.g., 25deg)", "ultimate-3d-model-viewer"); ?></p>

                <div class="u3dmv-flex-container">
                    <label for="u3dmv_model_camera_fov_min">Camera-Fov-Min</label>
                    <input
                        type="text"
                        id="u3dmv_model_camera_fov_min"
                        name="u3dmv_model_camera_fov_min"
                        placeholder="25deg"
                        value="<?php echo esc_attr($model_camera_fov_min) ?>"
                    />
                </div>
            </div>
        <?php else: ?>
            <!-- PREMIUM NOTICE -->
            <div class="u3dmv-metabox">
                <h4><?php echo esc_html__("Upgrade now to Pro to customize camera options of the 3D scene", "ultimate-3d-model-viewer"); ?></h4>
                <a
                    class="button"
                    id="u3dmv_model_upgrade_pro"
                    href="<?php echo esc_url(u3mv_fs()->checkout_url()); ?>"
                    target="_blank"
                >
                    <?php echo esc_html__('Upgrade now', 'ultimate-3d-model-viewer'); ?>
                </a>
            </div>
        <?php endif; ?>
    </details>

    <hr>

    <!-- LOADING ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('loading', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <?php if (u3mv_fs()->can_use_premium_code__premium_only()) : ?>
            <div id="u3dmv-loading-selection">
                <p><?php echo esc_html__("loading strategy", "ultimate-3d-model-viewer"); ?></p>

                <select name="u3dmv_model_loading" id="u3dmv_model_loading">
                    <option value="auto" <?php echo selected($model_loading, 'auto', false); ?>><?php echo esc_html__('auto', 'ultimate-3d-model-viewer'); ?></option>
                    <option value="lazy" <?php echo selected($model_loading, 'lazy', false); ?>><?php echo esc_html__('lazy', 'ultimate-3d-model-viewer'); ?></option>
                    <option value="eager" <?php echo selected($model_loading, 'eager', false); ?>><?php echo esc_html__('eager', 'ultimate-3d-model-viewer'); ?></option>
                </select>
            </div>
        <?php else: ?>
            <!-- PREMIUM NOTICE -->
            <div class="u3dmv-metabox">
                <h4><?php echo esc_html__("Upgrade now to Pro to customize the loading strategy of the 3D model", "ultimate-3d-model-viewer"); ?></h4>
                <a
                    class="button"
                    id="u3dmv_model_upgrade_pro"
                    href="<?php echo esc_url(u3mv_fs()->checkout_url()); ?>"
                    target="_blank"
                >
                    <?php echo esc_html__('Upgrade now', 'ultimate-3d-model-viewer'); ?>
                </a>
            </div>
        <?php endif; ?>
    </details>

    <hr>

    <!-- ROTATION ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('auto rotate', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <?php if (u3mv_fs()->can_use_premium_code__premium_only()) : ?>
            <div id="u3dmv-rotation-selection">
                <p><?php echo esc_html__("Auto rotation", "ultimate-3d-model-viewer"); ?></p>

                <input
                    id="u3dmv_model_rotation"
                    name="u3dmv_model_rotation"
                    type="checkbox"
                    <?php checked($model_rotation, '1'); ?>
                />
            </div>
        <?php else: ?>
             <!-- PREMIUM NOTICE -->
            <div class="u3dmv-metabox">
                <h4><?php echo esc_html__("Upgrade now to Pro to enable auto rotation of the 3D model.", "ultimate-3d-model-viewer"); ?></h4>
                <a
                    class="button"
                    id="u3dmv_model_upgrade_pro"
                    href="<?php echo esc_url(u3mv_fs()->checkout_url()); ?>"
                    target="_blank"
                >
                    <?php echo esc_html__('Upgrade now', 'ultimate-3d-model-viewer'); ?>
                </a>
            </div>
        <?php endif; ?>
    </details>

    <hr>

    <!-- AR ACCORDION -->
    <details class="u3dmv-accordion">
        <summary><strong><?php echo esc_html__('augmented reality', 'ultimate-3d-model-viewer'); ?></strong></summary>
        <?php if (u3mv_fs()->can_use_premium_code__premium_only()) : ?>
            <div id="u3dmv-ar-selection">
                <p><?php echo esc_html__("Enable augmented reality", "ultimate-3d-model-viewer"); ?></p>

                <input
                    id="u3dmv_model_ar"
                    name="u3dmv_model_ar"
                    type="checkbox"
                    <?php checked($model_ar, '1'); ?>
                />

                <br>

                <p><?php echo esc_html__("IOS src model", "ultimate-3d-model-viewer") ?></p>
                <label for="u3dmv_model_ios_src"><?php echo esc_html__("Select a special ios usdz file for the model in ar mode", "ultimate-3d-model-viewer") ?></label><br>
                <input
                    type="text"
                    id="u3dmv_model_ios_src"
                    name="u3dmv_model_ios_src"
                    readonly
                    value="<?php echo esc_attr($model_ios_src); ?>"
                />
                
                <br>

                <button type="button" class="button u3dmv-upload-btn" id="u3dmv_model_ios_src_upload">
                    <?php echo esc_html__('Select File', 'ultimate-3d-model-viewer'); ?>
                </button>

                <button type="button" class="button u3dmv-delete-btn" id="u3dmv_model_ios_src_delete">
                    <?php echo esc_html__("Delete File", "ultimate-3d-model-viewer"); ?>
                </button>
            </div>
        <?php else: ?>
             <!-- PREMIUM NOTICE -->
            <div class="u3dmv-metabox">
                <h4><?php echo esc_html__("Upgrade now to Pro to enable augmented reality for mobile devices.", "ultimate-3d-model-viewer"); ?></h4>
                <a
                    class="button"
                    id="u3dmv_model_upgrade_pro"
                    href="<?php echo esc_url(u3mv_fs()->checkout_url()); ?>"
                    target="_blank"
                >
                    <?php echo esc_html__('Upgrade now', 'ultimate-3d-model-viewer'); ?>
                </a>
            </div>
        <?php endif; ?>
    </details>
</div>
