<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>
<div class="wrap smc-wrap">
	<h1><?php esc_html_e( 'Smart Media Cleanup — Settings', 'smart-media-cleanup' ); ?></h1>

	<div class="smc-notice smc-notice--warning">
		<span class="dashicons dashicons-warning"></span>
		<div>
			<strong><?php esc_html_e( 'Important: media deletions are permanent.', 'smart-media-cleanup' ); ?></strong>
			<?php esc_html_e( 'When this plugin deletes an attachment, the file is removed from the server and cannot be recovered. Make sure you have a backup before enabling automatic cleanup.', 'smart-media-cleanup' ); ?>
		</div>
	</div>

	<?php if ( ! empty( $auto_detected ) ) : ?>
	<div class="smc-notice smc-notice--info">
		<span class="dashicons dashicons-yes-alt"></span>
		<div>
			<strong><?php esc_html_e( 'Auto-detected plugins — images are protected automatically:', 'smart-media-cleanup' ); ?></strong>
			<ul style="margin:6px 0 0 0;padding:0;list-style:none;">
				<?php foreach ( $auto_detected as $plugin ) : ?>
				<li style="margin-top:4px;">
					<strong><?php echo esc_html( $plugin['name'] ); ?></strong> —
					<?php foreach ( $plugin['keys'] as $smc_key ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
						<code><?php echo esc_html( $smc_key ); ?></code>
					<?php endforeach; ?>
				</li>
				<?php endforeach; ?>
			</ul>
			<p style="margin:6px 0 0;color:#646970;font-size:12px;">
				<?php esc_html_e( 'No manual configuration needed for these plugins. Images used in their SEO settings are automatically protected from deletion.', 'smart-media-cleanup' ); ?>
			</p>
		</div>
	</div>
	<?php endif; ?>

	<form method="post" action="options.php">
		<?php
		settings_fields( 'smc_settings_group' );
		do_settings_sections( 'smart-media-cleanup' );
		submit_button( esc_html__( 'Save Settings', 'smart-media-cleanup' ) );
		?>
	</form>
</div>
