<?php
/**
 * Template View: Feature List
 *
 * Displays a list of features with checkmarks.
 *
 * @package    BoostBot
 * @subpackage Templates/Views
 * @since      1.6.0
 *
 * @var array  $features List of feature strings.
 * @var string $title    Optional title.
 */

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

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

if ( empty( $features ) || ! is_array( $features ) ) {
    return;
}
?>

<div class="bb-feature-list">
    <?php if ( ! empty( $title ) ) : ?>
        <h4 class="bb-feature-list-title"><?php echo esc_html( $title ); ?></h4>
    <?php endif; ?>

    <ul class="bb-feature-list-items">
        <?php foreach ( $features as $feature ) : 
            $feature_text    = is_array( $feature ) ? ( $feature['text'] ?? '' ) : $feature;
            $feature_included = is_array( $feature ) ? ( $feature['included'] ?? true ) : true;
        ?>
            <li class="bb-feature-list-item <?php echo $feature_included ? 'bb-fl-included' : 'bb-fl-excluded'; ?>">
                <span class="bb-fl-icon"><?php echo $feature_included ? '✓' : '✗'; ?></span>
                <span class="bb-fl-text"><?php echo esc_html( $feature_text ); ?></span>
            </li>
        <?php endforeach; ?>
    </ul>
</div>
