<?php
/**
 * Import Wizard - Step 8 (Run Import).
 *
 * @package PrimeLink
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

$import_id = isset( $_GET['import_id'] ) ? absint( $_GET['import_id'] ) : 0;
?>

<div class="mt_primelink-step mt_primelink-import-step-8" data-import-id="<?php echo esc_attr( $import_id ); ?>">

    <section class="mt_primelink-card mt_primelink-card--glass">
        <div class="mt_primelink-card-header">
            <h3><?php esc_html_e( 'Run Import', 'primelink' ); ?></h3>
        </div>

        <div class="mt_primelink-card-body">

            <div class="mt_primelink-run-header">
                <div>
                    <div class="mt_primelink-summary-eyebrow"><?php esc_html_e( 'Status', 'primelink' ); ?></div>
                    <div class="mt_primelink-run-status" id="mt_primelink-run-status-pill"><?php esc_html_e( 'Idle', 'primelink' ); ?></div>
                </div>
                <div class="mt_primelink-run-actions">
                    <button type="button" class="button button-primary" id="mt_primelink-start-import">
                        <?php esc_html_e( 'Start Import', 'primelink' ); ?>
                    </button>
                    <button type="button" class="button" id="mt_primelink-start-import-bg">
                        <?php esc_html_e( 'Run in Background', 'primelink' ); ?>
                    </button>
                    <button type="button" class="button" id="mt_primelink-schedule-import">
                        <?php esc_html_e( 'Schedule', 'primelink' ); ?>
                    </button>
                    <button type="button" class="button" id="mt_primelink-pause-import" disabled>
                        <?php esc_html_e( 'Pause', 'primelink' ); ?>
                    </button>
                    <button type="button" class="button" id="mt_primelink-resume-import" disabled>
                        <?php esc_html_e( 'Resume', 'primelink' ); ?>
                    </button>
                    <button type="button" class="button button-secondary" id="mt_primelink-review-anomalies" style="display:none;">
                        <?php esc_html_e( 'Review Anomalies', 'primelink' ); ?>
                    </button>
                </div>
            </div>

            <label class="mt_primelink-check" style="margin:6px 0 12px;">
                <input type="checkbox" id="mt_primelink-run-bg-notify" checked>
                <?php esc_html_e( 'Show a quick toast when background run starts', 'primelink' ); ?>
            </label>
            <div class="muted" id="mt_primelink-run-bg-note" style="margin-bottom:12px; display:none;">
                <?php esc_html_e( 'Running in background. You can navigate away; progress will continue.', 'primelink' ); ?>
            </div>

            <div class="mt_primelink-run-shell">
                <div class="mt_primelink-progress-wrap">
                    <div class="mt_primelink-progress-bar">
                        <div class="mt_primelink-progress-bar__inner" style="width:0%;"></div>
                    </div>
                    <div class="mt_primelink-progress-meta">
                        <span class="mt_primelink-progress-pill" id="mt_primelink-progress-text">0%</span>
                        <span class="mt_primelink-progress-pill" id="mt_primelink-progress-count">0 / 0</span>
                        <span class="mt_primelink-progress-pill" id="mt_primelink-progress-status"><?php esc_html_e( 'Idle', 'primelink' ); ?></span>
                    </div>
                </div>

                <div class="mt_primelink-run-stats">
                    <div class="mt_primelink-run-stat">
                        <div class="mt_primelink-stat-label"><?php esc_html_e( 'Total items', 'primelink' ); ?></div>
                        <div class="mt_primelink-stat-value" id="mt_primelink-run-total">0</div>
                    </div>
                    <div class="mt_primelink-run-stat">
                        <div class="mt_primelink-stat-label"><?php esc_html_e( 'Processed', 'primelink' ); ?></div>
                        <div class="mt_primelink-stat-value" id="mt_primelink-run-current">0</div>
                    </div>
                </div>
            </div>

            <div class="mt_primelink-run-log glass" id="mt_primelink-run-log">
                <div class="mt_primelink-run-log__placeholder"><?php esc_html_e( 'Logs will appear here as the import runs.', 'primelink' ); ?></div>
            </div>

        </div>
    </section>
</div>

