<?php
/**
 * Template View: Phone Button
 *
 * Click-to-call phone button.
 *
 * @package    BoostBot
 * @subpackage Templates/Views
 * @since      1.6.0
 *
 * @var string $phone Phone number.
 * @var string $text  Button text (optional).
 * @var string $style Style: 'default', 'minimal', 'prominent'.
 */

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

// Clean phone number for href
$clean_phone = preg_replace( '/[^0-9+]/', '', $phone );
$text = $text ?? $phone;
$style = $style ?? 'default';
$style_class = 'bb-phone-' . sanitize_html_class( $style );
?>

<a href="tel:<?php echo esc_attr( $clean_phone ); ?>" class="bb-phone-button <?php echo esc_attr( $style_class ); ?>">
    <span class="bb-phone-icon">📞</span>
    <span class="bb-phone-text"><?php echo esc_html( $text ); ?></span>
</a>
