<?php
/**
 * Rosea Theme Functions
 *
 * @package Rosea
 * @author  nopStation
 * @version 1.0.0
 *
 * This file is part of the Rosea WordPress theme.
 *
 * Rosea WordPress Theme, Copyright 2026 nopStation
 * Rosea is distributed under the terms of the GNU General Public License v2 or later.
 *
 * @license GPL-2.0-or-later
 * @license URI: https://www.gnu.org/licenses/gpl-2.0.html
 */

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

/**
 * Theme Setup
 */
function rosea_setup()
{
	// Make theme available for translation
	load_theme_textdomain('rosea', get_template_directory() . '/languages');

	// Add default posts and comments RSS feed links to head
	add_theme_support('automatic-feed-links');

	// Let WordPress manage the document title
	add_theme_support('title-tag');

	// Enable support for Post Thumbnails
	add_theme_support('post-thumbnails');

	// Register navigation menus
	register_nav_menus(array(
		'primary' => esc_html__('Primary Menu', 'rosea'),
		'footer' => esc_html__('Footer Menu', 'rosea'),
	));

	// Add support for accessibility features
	add_theme_support('html5', array(
		'search-form',
		'comment-form',
		'comment-list',
		'gallery',
		'caption',
		'script',
		'style',
	));

	// Set up the WordPress core custom background feature
	add_theme_support('custom-background', apply_filters('rosea_custom_background_args', array(
		'default-color' => 'ffffff',
		'default-image' => '',
	)));

	// Add theme support for selective refresh for widgets
	add_theme_support('customize-selective-refresh-widgets');

	// Add support for core custom logo
	add_theme_support('custom-logo', array(
		'height' => 250,
		'width' => 250,
		'flex-width' => true,
		'flex-height' => true,
	));

	// Add support for custom header with flexible dimensions and no header text
	add_theme_support('custom-header', array(
		'width' => 1920,
		'height' => 500,
		'flex-width' => true,
		'flex-height' => true,
		'header-text' => false
	));


	// Add support for responsive embeds
	add_theme_support('responsive-embeds');

	// Add support for block styles
	add_theme_support('wp-block-styles');

	// Add support for wide and full alignments
	add_theme_support('align-wide');

	// Add support for editor styles
	add_theme_support('editor-styles');
}
add_action('after_setup_theme', 'rosea_setup');

/**
 * Enqueue editor styles
 */
function rosea_editor_styles()
{
	add_editor_style('assets/css/editor-style.css');
}
add_action('admin_init', 'rosea_editor_styles');

/**
 * Set the content width in pixels
 */
function rosea_content_width()
{
	$GLOBALS['content_width'] = apply_filters('rosea_content_width', 1200);
}
add_action('after_setup_theme', 'rosea_content_width', 0);

/**
 * Register widget area
 */
function rosea_widgets_init()
{
	// Main Sidebar
	register_sidebar(array(
		'name' => esc_html__('Sidebar', 'rosea'),
		'id' => 'sidebar-1',
		'description' => esc_html__('Add widgets here to appear in the sidebar.', 'rosea'),
		'before_widget' => '<div id="%1$s" class="widget %2$s sidebar-section">',
		'after_widget' => '</div>',
		'before_title' => '<h4 class="sidebar-title widget-title">',
		'after_title' => '</h4>',
	));

	// Footer Widget Areas
	for ($i = 1; $i <= 3; $i++) {
		register_sidebar(array(
			'name' => sprintf(esc_html__('Footer %d', 'rosea'), $i),
			'id' => 'footer-' . $i,
			'description' => sprintf(esc_html__('Add widgets here to appear in footer column %d.', 'rosea'), $i),
			'before_widget' => '<div id="%1$s" class="widget %2$s">',
			'after_widget' => '</div>',
			'before_title' => '<h5 class="footer-nav-header text-uppercase font-weight-bold">',
			'after_title' => '</h5>',
		));
	}
}
add_action('widgets_init', 'rosea_widgets_init');

/**
 * Default menu fallback
 */
function rosea_default_menu() {
	?>
	<ul class="m-auto text-uppercase navbar-nav">
		<li class="nav-item">
			<a class="nav-link" href="<?php echo esc_url( home_url('/') ); ?>">
				<?php esc_html_e('Home', 'rosea'); ?>
			</a>
		</li>

		<?php if ( get_option('page_for_posts') ) : ?>
			<li class="nav-item">
				<a class="nav-link" href="<?php echo esc_url( get_permalink( get_option('page_for_posts') ) ); ?>">
					<?php esc_html_e('Blog', 'rosea'); ?>
				</a>
			</li>
		<?php endif; ?>

		<li class="nav-item">
			<a class="nav-link" href="<?php echo esc_url( home_url('/?s=') ); ?>">
				<?php esc_html_e('Search', 'rosea'); ?>
			</a>
		</li>
	</ul>
	<?php
}

/**
 * Enqueue scripts and styles
 */
function rosea_scripts()
{
	$theme_version = wp_get_theme()->get('Version');
	$theme_uri = get_template_directory_uri();
	$theme_dir = get_template_directory();

	// CSS Files
	// Main stylesheet (must be in root for WordPress theme detection)
	wp_enqueue_style('rosea-style', get_stylesheet_uri(), array(), $theme_version);

	// Bootstrap CSS
	if (file_exists($theme_dir . '/assets/css/bootstrap.min.css')) {
		wp_enqueue_style('rosea-bootstrap', $theme_uri . '/assets/css/bootstrap.min.css', array(), $theme_version);
	}

	// Font Awesome CSS
	// Note: Font Awesome requires font files in assets/webfonts/ directory
	// If fonts are missing, icons will not display. Add Font Awesome webfonts to fix.
	if (file_exists($theme_dir . '/assets/font-awesome/css/fontawesome.all.min.css')) {
		wp_enqueue_style('rosea-fontawesome', $theme_uri . '/assets/font-awesome/css/fontawesome.all.min.css', array(), $theme_version);
	}



	// Icons CSS - Only enqueue if font files exist
	$icons_css_exists = file_exists($theme_dir . '/assets/css/icons.css');
	$icomoon_fonts_exist = file_exists($theme_dir . '/assets/fonts/icomoon.svg') ||
		file_exists($theme_dir . '/assets/fonts/icomoon.woff') ||
		file_exists($theme_dir . '/assets/fonts/icomoon.ttf');

	if ($icons_css_exists && $icomoon_fonts_exist) {
		wp_enqueue_style('rosea-icons', $theme_uri . '/assets/css/icons.css', array(), $theme_version);
	}

	// All Fonts CSS
	if (file_exists($theme_dir . '/assets/css/all-fonts.css')) {
		wp_enqueue_style('rosea-all-fonts', $theme_uri . '/assets/css/all-fonts.css', array(), $theme_version);
	}

	// Blog CSS
	if (file_exists($theme_dir . '/assets/css/blog.css')) {
		wp_enqueue_style('rosea-blog', $theme_uri . '/assets/css/blog.css', array(), $theme_version);
	}

	// Additional CSS files from assets folder
	if (file_exists($theme_dir . '/assets/css/main.css')) {
		wp_enqueue_style('rosea-main-style', $theme_uri . '/assets/css/main.css', array('rosea-style'), $theme_version);
	}

	if (file_exists($theme_dir . '/assets/css/blocks.css')) {
		wp_enqueue_style('rosea-blocks', $theme_uri . '/assets/css/blocks.css', array('rosea-style'), $theme_version);
	}

	if (file_exists($theme_dir . '/assets/css/extra.css')) {
		wp_enqueue_style('rosea-extra', $theme_uri . '/assets/css/extra.css', array('rosea-style'), $theme_version);
	}

	// Additional style.css from assets/css folder (if exists)
	if (file_exists($theme_dir . '/assets/css/style.css')) {
		wp_enqueue_style('rosea-assets-style', $theme_uri . '/assets/css/style.css', array('rosea-style'), $theme_version);
	}

	// JS Files
	// Use WordPress core jQuery (do not bundle jQuery)
	wp_enqueue_script('jquery');

	// Bootstrap JS
	if (file_exists($theme_dir . '/assets/js/bootstrap.min.js')) {
		wp_enqueue_script('rosea-bootstrap', $theme_uri . '/assets/js/bootstrap.min.js', array('jquery'), $theme_version, true);
	}

	// Custom JS (renamed with theme prefix)
	if (file_exists($theme_dir . '/assets/js/rosea-custom.js')) {
		wp_enqueue_script('rosea-custom', $theme_uri . '/assets/js/rosea-custom.js', array('jquery'), $theme_version, true);
	}

	// Navigation script (renamed with theme prefix)
	if (file_exists($theme_dir . '/assets/js/rosea-navigation.js')) {
		wp_enqueue_script('rosea-navigation', $theme_uri . '/assets/js/rosea-navigation.js', array('jquery'), $theme_version, true);
	}

	// Skip link focus fix (renamed with theme prefix)
	if (file_exists($theme_dir . '/assets/js/rosea-skip-link-focus-fix.js')) {
		wp_enqueue_script('rosea-skip-link-focus-fix', $theme_uri . '/assets/js/rosea-skip-link-focus-fix.js', array(), $theme_version, true);
	}

	// Comment reply script
	if (is_singular() && comments_open() && get_option('thread_comments')) {
		wp_enqueue_script('comment-reply');
	}


}
add_action('wp_enqueue_scripts', 'rosea_scripts');

/**
 * Register block styles
 */
function rosea_register_block_styles()
{
	// Register block styles for core blocks
	if (function_exists('register_block_style')) {
		// Button block styles
		register_block_style(
			'core/button',
			array(
				'name' => 'rosea-primary',
				'label' => esc_html__('Primary', 'rosea'),
				'inline_style' => '.wp-block-button.is-style-rosea-primary .wp-block-button__link { background-color: #333333; color: #fff; }',
			)
		);

		register_block_style(
			'core/button',
			array(
				'name' => 'rosea-outline',
				'label' => esc_html__('Outline', 'rosea'),
				'inline_style' => '.wp-block-button.is-style-rosea-outline .wp-block-button__link { border: 2px solid #333333; color: #333333; background-color: transparent; }',
			)
		);

		// Quote block styles
		register_block_style(
			'core/quote',
			array(
				'name' => 'rosea-quote',
				'label' => esc_html__('Rosea Style', 'rosea'),
				'inline_style' => '.wp-block-quote.is-style-rosea-quote { border-left: 4px solid #333333; padding-left: 20px; }',
			)
		);
	}
}
add_action('init', 'rosea_register_block_styles');

/**
 * Register block patterns
 */
function rosea_register_block_patterns()
{
	if (function_exists('register_block_pattern')) {
		// Hero section pattern
		register_block_pattern(
			'rosea/hero-section',
			array(
				'title' => esc_html__('Hero Section', 'rosea'),
				'description' => esc_html__('A hero section with title and description', 'rosea'),
				'content' => '<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"60px","bottom":"60px"}}},"backgroundColor":"base","textColor":"contrast"} -->
<div class="wp-block-group alignwide has-contrast-color has-base-background-color has-text-color has-background" style="padding-top:60px;padding-bottom:60px"><!-- wp:heading {"textAlign":"center","level":1} -->
<h1 class="has-text-align-center">' . esc_html__('Welcome to Rosea', 'rosea') . '</h1>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">' . esc_html__('A modern WordPress blog theme', 'rosea') . '</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->',
				'categories' => array('featured'),
			)
		);

		// Two column pattern
		register_block_pattern(
			'rosea/two-columns',
			array(
				'title' => esc_html__('Two Columns', 'rosea'),
				'description' => esc_html__('Two column layout with text', 'rosea'),
				'content' => '<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:paragraph -->
<p>' . esc_html__('Left column content', 'rosea') . '</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"><!-- wp:paragraph -->
<p>' . esc_html__('Right column content', 'rosea') . '</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->',
				'categories' => array('columns'),
			)
		);
	}
}
add_action('init', 'rosea_register_block_patterns');

/**
 * Theme Customizer additions
 */
function rosea_customize_register($wp_customize)
{
	// Add Theme Options Panel
	$wp_customize->add_panel('rosea_theme_options', array(
		'title' => esc_html__('Theme Options', 'rosea'),
		'priority' => 130,
	));

	// Colors Section
	$wp_customize->add_section('rosea_colors', array(
		'title' => esc_html__('Colors', 'rosea'),
		'panel' => 'rosea_theme_options',
		'priority' => 10,
	));

	// Primary Color
	$wp_customize->add_setting('rosea_primary_color', array(
		'default' => '#304dd0',
		'sanitize_callback' => 'sanitize_hex_color',
		'transport' => 'postMessage',
	));

	$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'rosea_primary_color', array(
		'label' => esc_html__('Primary Color', 'rosea'),
		'section' => 'rosea_colors',
		'settings' => 'rosea_primary_color',
	)));


	// Sidebar Background Color
	$wp_customize->add_setting('rosea_sidebar_bg_color', array(
		'default' => '#333333',
		'sanitize_callback' => 'sanitize_hex_color',
		'transport' => 'postMessage',
	));

	$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'rosea_sidebar_bg_color', array(
		'label' => esc_html__('Sidebar Background Color', 'rosea'),
		'section' => 'rosea_colors',
		'settings' => 'rosea_sidebar_bg_color',
	)));

	// Typography Section
	$wp_customize->add_section('rosea_typography', array(
		'title' => esc_html__('Typography', 'rosea'),
		'panel' => 'rosea_theme_options',
		'priority' => 20,
	));

	// Body Font Size
	$wp_customize->add_setting('rosea_body_font_size', array(
		'default' => '16',
		'sanitize_callback' => 'absint',
		'transport' => 'postMessage',
	));

	$wp_customize->add_control('rosea_body_font_size', array(
		'label' => esc_html__('Body Font Size (px)', 'rosea'),
		'section' => 'rosea_typography',
		'type' => 'number',
		'input_attrs' => array(
			'min' => 12,
			'max' => 24,
			'step' => 1,
		),
	));

	// Header Section
	$wp_customize->add_section('rosea_header', array(
		'title' => esc_html__('Header Settings', 'rosea'),
		'panel' => 'rosea_theme_options',
		'priority' => 25,
	));

	// remove core header text color control because theme doesn't use it
	$wp_customize->remove_control('header_textcolor');

	// Sticky Header option removed per user request

	// Social Media Links
	$social_networks = array(
		'facebook' => array('label' => 'Facebook', 'icon' => 'fab fa-facebook-f'),
		'twitter' => array('label' => 'Twitter', 'icon' => 'fab fa-twitter'),
		'instagram' => array('label' => 'Instagram', 'icon' => 'fab fa-instagram'),
		'linkedin' => array('label' => 'LinkedIn', 'icon' => 'fab fa-linkedin-in'),
		'pinterest' => array('label' => 'Pinterest', 'icon' => 'fab fa-pinterest-p'),
		'youtube' => array('label' => 'YouTube', 'icon' => 'fab fa-youtube'),
	);

	foreach ($social_networks as $key => $network) {
		$wp_customize->add_setting('rosea_social_' . $key, array(
			'default' => '',
			'sanitize_callback' => 'esc_url_raw',
			'transport' => 'refresh',
		));

		$wp_customize->add_control('rosea_social_' . $key, array(
			'label' => sprintf(esc_html__('%s URL', 'rosea'), $network['label']),
			'section' => 'rosea_header',
			'type' => 'url',
		));
	}

	// Layout Section
	$wp_customize->add_section('rosea_layout', array(
		'title' => esc_html__('Layout', 'rosea'),
		'panel' => 'rosea_theme_options',
		'priority' => 30,
	));

	// Container Width
	$wp_customize->add_setting('rosea_container_width', array(
		'default' => '1480',
		'sanitize_callback' => 'absint',
		'transport' => 'postMessage',
	));

	$wp_customize->add_control('rosea_container_width', array(
		'label' => esc_html__('Container Max Width (px)', 'rosea'),
		'section' => 'rosea_layout',
		'type' => 'number',
		'input_attrs' => array(
			'min' => 960,
			'max' => 1920,
			'step' => 20,
		),
	));

}
add_action('customize_register', 'rosea_customize_register');

/**
 * Enqueue customizer preview script for live updates
 */
function rosea_customize_preview_js()
{
	wp_enqueue_script(
		'rosea-customize-preview',
		get_template_directory_uri() . '/assets/js/customizer-preview.js',
		array('customize-preview', 'jquery'),
		wp_get_theme()->get('Version'),
		true
	);
}
add_action('customize_preview_init', 'rosea_customize_preview_js');

/**
 * Output customizer CSS
 */
function rosea_customizer_css()
{
	$primary_color = get_theme_mod('rosea_primary_color', '#304dd0');
	$sidebar_bg = get_theme_mod('rosea_sidebar_bg_color', '#333333');
	$body_font_size = get_theme_mod('rosea_body_font_size', '16');
	$container_width = get_theme_mod('rosea_container_width', '1480');

	// theme does not use header_textcolor; always fall back to primary color
	$logo_text_color = $primary_color;

	// Start building inline styles
	$css = ":root {\n";
	$css .= "		--rosea-primary-color: {$primary_color};\n";
	$css .= "		--rosea-sidebar-bg: {$sidebar_bg};\n";
	$css .= "}\n";
	$css .= "body {\n\tfont-size: {$body_font_size}px;\n}\n";

	// always use primary color for title text; hiding header text no longer supported
	$css .= ".site-logo-text, .navbar-brand.site-logo-text, .logo.site-logo-text {\n";
	$css .= "\tfont-size: 24px;\n";
	$css .= "\tfont-weight: bold;\n";
	$css .= "\tcolor: {$logo_text_color};\n";
	$css .= "}\n";

	$css .= "\n/* Custom Logo Image - Make White */\n";
	$css .= ".navbar-brand .custom-logo,\n";
	$css .= ".navbar-brand img,\n";
	$css .= ".logo img,\n";
	$css .= ".navbar-brand a img {\n";
	$css .= "\tfilter: brightness(0) invert(1);\n";
	$css .= "\t-webkit-filter: brightness(0) invert(1);\n";
	$css .= "}\n";
	$css .= ".blog-homepage-container,\n";
	$css .= ".blog-page-container {\n";
	$css .= "\tmax-width: {$container_width}px;\n";
	$css .= "}\n";
	$css .= ".blog-sidebar {\n";
	$css .= "\tbackground-color: {$sidebar_bg};\n";
	$css .= "}\n";
	$css .= ".global-header {\n";
	$css .= "\tbackground: linear-gradient(135deg, {$primary_color}, #6527a4);\n";
	$css .= "}\n";

	$css .= "a:hover {\n";
	$css .= "\tcolor: {$primary_color};\n";
	$css .= "}\n";

	$css .= ".blog-card-readmore {\n";
	$css .= "\tcolor: {$primary_color};\n";
	$css .= "}\n";

	$css .= ".blog-pagination .current,\n";
	$css .= ".blog-pagination span.current {\n";
	$css .= "\tborder-color: {$primary_color};\n";
	$css .= "\tbackground: {$primary_color};\n";
	$css .= "}\n";
	$css .= ".form-submit:hover {\n";
	$css .= "\tbackground-color: {$primary_color};\n";
	$css .= "}\n";

	$css .= ".blog-post .post-meta a {\n";
	$css .= "\tcolor: {$primary_color};\n";
	$css .= "}\n";

	$css .= ".post-navigation .nav-next i {\n";
	$css .= "\tcolor: {$primary_color};\n";
	$css .= "}\n";

	$css .= ".post-navigation .nav-previous a, .post-navigation .nav-previous i {\n";
$css .= "\tcolor: {$primary_color};\n";
$css .= "}\n";

$css .= ".blog-post h2 a:hover {\n";
$css .= "\tcolor: {$primary_color};\n";
$css .= "}\n"; // <-- Added closing brace

$css .= ".blog-card h3 a:hover {\n";
$css .= "\tcolor: {$primary_color};\n";
$css .= "}\n";

	// Add inline style to both main stylesheet and assets stylesheet to ensure it overrides
	// Add inline style to both stylesheets to ensure it overrides hardcoded CSS
	wp_add_inline_style('rosea-style', $css);

	// Also add to assets stylesheet if it exists (loads after main style, so will override)
	$theme_dir = get_template_directory();
	if (file_exists($theme_dir . '/assets/css/style.css')) {
		wp_add_inline_style('rosea-assets-style', $css);
	}
}
add_action('wp_enqueue_scripts', 'rosea_customizer_css', 25);


/**
 * Template Tags
 */

/**
 * Prints HTML with meta information for the current post-date/time
 */
function rosea_posted_on()
{
	$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
	if (get_the_time('U') !== get_the_modified_time('U')) {
		$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
	}

	$time_string = sprintf(
		$time_string,
		esc_attr(get_the_date(DATE_W3C)),
		esc_html(get_the_date()),
		esc_attr(get_the_modified_date(DATE_W3C)),
		esc_html(get_the_modified_date())
	);

	$posted_on = sprintf(
		/* translators: %s: post date. */
		esc_html_x('Posted on %s', 'post date', 'rosea'),
		'<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>'
	);

	echo '<span class="posted-on">' . $posted_on . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}

/**
 * Prints HTML with meta information for the current author
 */
function rosea_posted_by()
{
	$byline = sprintf(
		/* translators: %s: post author. */
		esc_html_x('by %s', 'post author', 'rosea'),
		'<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>'
	);

	echo '<span class="byline"> ' . $byline . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}

/**
 * Custom comment callback
 */
function rosea_comment($comment, $args, $depth)
{
	if ('div' === $args['style']) {
		$tag = 'div';
		$add_below = 'comment';
	} else {
		$tag = 'li';
		$add_below = 'div-comment';
	}
	?>
	<<?php echo esc_attr($tag); ?> 	<?php comment_class(empty($args['has_children']) ? '' : 'parent'); ?>
		id="comment-<?php comment_ID(); ?>">
		<div class="comment">
			<div class="comment-author vcard">
				<?php echo get_avatar($comment, 32); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
				<cite class="fn author-name">
					<?php
					printf(
						/* translators: %s: comment author link. */
						'<span class="fn">%s</span> <span class="says">%s</span>',
						get_comment_author_link(),
						esc_html__('says:', 'rosea')
					);
					?>
				</cite>
			</div>
			<div class="comment-meta commentmetadata">
				<a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?>">
					<?php
					echo esc_html(get_comment_date());
					echo ' ' . esc_html__('at', 'rosea') . ' ';
					echo esc_html(get_comment_time());
					?>
				</a>
				<?php edit_comment_link(esc_html__('(Edit)', 'rosea'), '  ', ''); ?>
			</div>
			<div class="comment-content">
				<?php comment_text(); ?>
			</div>
			<div class="reply">
				<?php
				comment_reply_link(
					array_merge(
						$args,
						array(
							'add_below' => $add_below,
							'depth' => $depth,
							'max_depth' => $args['max_depth'],
							'reply_text' => esc_html__('Reply', 'rosea'),
						)
					)
				);
				?>
			</div>
		</div>
		<?php
}

/**
 * Customize comment form fields
 */
function rosea_comment_form_defaults($defaults)
{
	$defaults['title_reply'] = __('Leave a Comment', 'rosea');
	$defaults['label_submit'] = __('Post Comment', 'rosea');
	return $defaults;
}
add_filter('comment_form_defaults', 'rosea_comment_form_defaults');

/**
 * Get social media links from customizer
 */
function rosea_get_social_links()
{
	$social_networks = array(
		'facebook' => array('label' => 'Facebook', 'icon' => 'fab fa-facebook-f'),
		'twitter' => array('label' => 'Twitter', 'icon' => 'fab fa-twitter'),
		'instagram' => array('label' => 'Instagram', 'icon' => 'fab fa-instagram'),
		'linkedin' => array('label' => 'LinkedIn', 'icon' => 'fab fa-linkedin-in'),
		'pinterest' => array('label' => 'Pinterest', 'icon' => 'fab fa-pinterest-p'),
		'youtube' => array('label' => 'YouTube', 'icon' => 'fab fa-youtube'),
	);

	$social_links = array();
	foreach ($social_networks as $key => $network) {
		$url = get_theme_mod('rosea_social_' . $key, '');
		if (!empty($url)) {
			$social_links[] = array(
				'icon' => $network['icon'],
				'url' => $url,
				'label' => $network['label'],
			);
		}
	}

	// If no customizer links set, return empty array (don't show icons without valid URLs)
	if (empty($social_links)) {
		return array();
	}

	return $social_links;
}



