<?php
/**
 * Settings Section Partial
 *
 * Renders a styled section container for grouping settings fields.
 * Matches the section styling pattern used in SIF and Numbering tabs.
 *
 * @package FreeFacTu
 * @since   1.0.0
 * 
 * @var string $freefactu_section_id   Unique ID for the section
 * @var string $freefactu_icon         Emoji or dashicon class for section icon
 * @var string $freefactu_title        Section title
 * @var string $freefactu_description  Optional section description
 * @var string $freefactu_variant      Optional variant: 'default', 'warning', 'info' (affects border color)
 */

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

// Set defaults
$freefactu_section_id   = isset( $section_id ) ? $section_id : '';
$freefactu_icon         = isset( $icon ) ? $icon : '';
$freefactu_title        = isset( $title ) ? $title : '';
$freefactu_description  = isset( $description ) ? $description : '';
$freefactu_variant      = isset( $variant ) ? $variant : 'default';

// Build section classes with BEM modifiers
$freefactu_section_classes = array( 'freefactu-settings-section' );
if ( 'default' !== $freefactu_variant ) {
	$freefactu_section_classes[] = 'freefactu-settings-section--' . $freefactu_variant;
}
?>

<div id="<?php echo esc_attr( $freefactu_section_id ); ?>" class="<?php echo esc_attr( implode( ' ', $freefactu_section_classes ) ); ?>">
	<h2 class="freefactu-settings-section__header">
		<?php if ( ! empty( $freefactu_icon ) ) : ?>
			<?php if ( strpos( $freefactu_icon, 'dashicons-' ) === 0 ) : ?>
				<span class="dashicons <?php echo esc_attr( $freefactu_icon ); ?> freefactu-settings-section__icon"></span>
			<?php else : ?>
				<span class="freefactu-settings-section__icon"><?php echo esc_html( $freefactu_icon ); ?></span>
			<?php endif; ?>
		<?php endif; ?>
		<?php echo esc_html( $freefactu_title ); ?>
	</h2>
	
	<?php if ( ! empty( $freefactu_description ) ) : ?>
		<p class="description freefactu-settings-section__description">
			<?php echo wp_kses_post( $freefactu_description ); ?>
		</p>
	<?php endif; ?>
	
	<div class="freefactu-settings-section__content">
		<!-- Content will be rendered by the calling code -->

