<?php
/**
 * Template View: Stats Row
 *
 * Display key statistics in a row.
 *
 * @package    BoostBot
 * @subpackage Templates/Views
 * @since      1.6.0
 *
 * @var array $stats Array of stat objects with value, label, and optional icon.
 */

// phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-scope variables set by the includer, not true globals.

// Prevent direct access
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

// Validate required data
if ( empty( $stats ) || ! is_array( $stats ) ) {
    return;
}
?>

<div class="bb-stats-row">
    <?php foreach ( $stats as $stat ) : 
        if ( ! isset( $stat['value'] ) || empty( $stat['label'] ) ) {
            continue;
        }
    ?>
        <div class="bb-stat-item">
            <?php if ( ! empty( $stat['icon'] ) ) : ?>
                <span class="bb-stat-icon"><?php echo esc_html( $stat['icon'] ); ?></span>
            <?php endif; ?>
            <span class="bb-stat-value"><?php echo esc_html( $stat['value'] ); ?></span>
            <span class="bb-stat-label"><?php echo esc_html( $stat['label'] ); ?></span>
        </div>
    <?php endforeach; ?>
</div>
