<?php
/**
 * Template View: Info Box
 *
 * Highlighted information box.
 *
 * @package    BoostBot
 * @subpackage Templates/Views
 * @since      1.6.0
 *
 * @var string $type    Box type: 'info', 'success', 'warning', 'error', 'tip'.
 * @var string $title   Optional title.
 * @var string $content Box content.
 * @var string $icon    Optional custom icon (emoji).
 */

// 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( $content ) ) {
    return;
}

$type = $type ?? 'info';
$type_class = 'bb-info-' . sanitize_html_class( $type );

// Default icons by type
$default_icons = array(
    'info'    => 'ℹ️',
    'success' => '✅',
    'warning' => '⚠️',
    'error'   => '❌',
    'tip'     => '💡',
);
$icon = $icon ?? ( $default_icons[ $type ] ?? 'ℹ️' );
?>

<div class="bb-info-box <?php echo esc_attr( $type_class ); ?>">
    <div class="bb-info-icon"><?php echo esc_html( $icon ); ?></div>
    <div class="bb-info-content">
        <?php if ( ! empty( $title ) ) : ?>
            <div class="bb-info-title"><?php echo esc_html( $title ); ?></div>
        <?php endif; ?>
        <div class="bb-info-text"><?php echo wp_kses_post( $content ); ?></div>
    </div>
</div>
