<?php
defined('ABSPATH') || exit;
$iv1wpt_has_pro = iv1wpt_has_pro();
?>
<h2><span class="dashicons dashicons-format-image"></span>&nbsp;<?php esc_html_e('Find Unused Images', 'iv1-wp-tools'); ?></h2>
<p class="description"><?php esc_html_e('Scans the media library against posts, custom fields, WooCommerce, and Elementor.', 'iv1-wp-tools'); ?></p>
<div id="iv1wpt-images-result" style="margin:15px 0;"></div>
<p style="display:flex;gap:12px;align-items:center;flex-wrap:wrap;">
    <button type="button" id="iv1wpt-images-scan" class="button button-primary"><?php esc_html_e('Scan images', 'iv1-wp-tools'); ?></button>
    <?php if ( $iv1wpt_has_pro ) : ?>
    <button type="button" id="iv1wpt-images-delete-selected" class="button" style="color:#b32d2e;" disabled><?php esc_html_e('Delete selected', 'iv1-wp-tools'); ?></button>
    <?php endif; ?>
    <span id="iv1wpt-images-progress" style="display:none;color:#666;font-size:13px;"><span class="spinner is-active" style="float:none;margin:0 6px 0 0;"></span><span id="iv1wpt-images-progress-text"><?php esc_html_e('Scanning...', 'iv1-wp-tools'); ?></span></span>
</p>
<div id="iv1wpt-images-stats" style="display:none;margin:15px 0;">
    <div style="display:flex;gap:16px;flex-wrap:wrap;">
        <div class="iv1wpt-stat-card"><span class="iv1wpt-stat-num" id="iv1wpt-stat-total">0</span><span class="iv1wpt-stat-label"><?php esc_html_e('Total', 'iv1-wp-tools'); ?></span></div>
        <div class="iv1wpt-stat-card"><span class="iv1wpt-stat-num iv1wpt-stat-used" id="iv1wpt-stat-used">0</span><span class="iv1wpt-stat-label"><?php esc_html_e('Used', 'iv1-wp-tools'); ?></span></div>
        <div class="iv1wpt-stat-card"><span class="iv1wpt-stat-num iv1wpt-stat-unused" id="iv1wpt-stat-unused">0</span><span class="iv1wpt-stat-label"><?php esc_html_e('Unused', 'iv1-wp-tools'); ?></span></div>
        <div class="iv1wpt-stat-card"><span class="iv1wpt-stat-num iv1wpt-stat-size" id="iv1wpt-stat-size">0 B</span><span class="iv1wpt-stat-label"><?php esc_html_e('Space to free', 'iv1-wp-tools'); ?></span></div>
    </div>
</div>
<div id="iv1wpt-images-filter" style="display:none;margin:10px 0;">
    <label><?php esc_html_e('Show:', 'iv1-wp-tools'); ?>
        <select id="iv1wpt-images-filter-select">
            <option value="unused"><?php esc_html_e('Unused only', 'iv1-wp-tools'); ?></option>
            <option value="all"><?php esc_html_e('All', 'iv1-wp-tools'); ?></option>
            <option value="used"><?php esc_html_e('Used only', 'iv1-wp-tools'); ?></option>
        </select>
    </label>
</div>
<div id="iv1wpt-images-list"></div>
