<?php
/**
 * Status Card Partial
 *
 * Renders a status card for the debug page.
 *
 * @package FreeFacTu
 * @since   1.0.0
 * 
 * @var string $title       Card title
 * @var bool   $is_success  Whether the status is successful
 * @var string $value_text  Main value text to display
 * @var string $detail_text Optional detail/subtitle text
 * @var string $detail_code Optional code value to display
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$freefactu_status_class = $is_success ? 'status-yes' : 'status-no';
$freefactu_icon         = $is_success ? '<span class="dashicons dashicons-yes-alt"></span>' : '<span class="dashicons dashicons-no-alt"></span>';
?>

<div class="freefactu-status-card">
	<h3><?php echo esc_html( $title ); ?></h3>
	<div class="freefactu-status-card__value <?php echo esc_attr( $freefactu_status_class ); ?>">
		<?php echo esc_html( $freefactu_icon . ' ' . $value_text ); ?>
	</div>
	<?php if ( ! empty( $detail_text ) ) : ?>
		<small>
			<?php echo esc_html( $detail_text ); ?>
			<?php if ( ! empty( $detail_code ) ) : ?>
				<code><?php echo esc_html( $detail_code ); ?></code>
			<?php endif; ?>
		</small>
	<?php endif; ?>
</div>
