<?php

/**
 * Generic notification email template.
 * Fallback for events without a specific template.
 *
 * Variables via $data array:
 * - $data['site_name'], $data['site_url'], $data['label']
 * - $data['message'] (string, optional - custom message body)
 * - $data['details'] (array, optional - key-value pairs to display)
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}
?>
<h1><?php echo esc_html( $data['label'] ?? 'Security Notification' ); ?></h1>

<?php if ( ! empty( $data['message'] ) ) : ?>
<p><?php echo esc_html( $data['message'] ); ?></p>
<?php endif; ?>

<div class="detail-box">
    <strong>Site:</strong> <?php echo esc_html( $data['site_url'] ?? '' ); ?><br>
    <?php if ( ! empty( $data['details'] ) && is_array( $data['details'] ) ) : ?>
        <?php foreach ( $data['details'] as $sitefort_key => $sitefort_value ) : ?>
        <strong><?php echo esc_html( ucfirst( str_replace( '_', ' ', $sitefort_key ) ) ); ?>:</strong>
        <?php echo esc_html( is_scalar( $sitefort_value ) ? (string) $sitefort_value : wp_json_encode( $sitefort_value ) ); ?><br>
        <?php endforeach; ?>
    <?php endif; ?>
</div>
