<?php
/**
 * MenuX Free — Footer Builder Defaults
 * Default content structure and style settings for the footer.
 * @package MenuX
 */

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

/**
 * Default footer content: enabled flag, columns (sections) and bottom bar.
 * Column types: about | links | contact | social | hours | html
 */
function menux_footer_defaults() {
    return array(
        'enabled'       => '0',
        'placement'     => 'manual',   // manual (shortcode/block) | auto (injected at wp_footer)
        'auto_priority' => '100',      // wp_footer hook priority when placement = auto
        'layout'        => 'wide-first', // equal | wide-first | centered
        'columns'       => array(),
        'bottom'  => array(
            'copyright'   => '© {year} Your Company. All rights reserved.',
            'links'       => array(),  // array of {label, url}
            'show_social' => '0',      // show social icons in the bottom bar
            'networks'    => array(),  // fallback networks when no social column exists
        ),
    );
}

function menux_footer_style_defaults() {
    return array(
        'theme'             => 'midnight',
        // Colors (match the refined "Midnight" theme out of the box)
        'bg'                => '#0f172a',
        'bg_gradient'       => 'linear-gradient(180deg,#13203b,#0b1426)',
        'heading_color'     => '#f8fafc',
        'text_color'        => '#94a3b8',
        'link_color'        => '#cbd5e1',
        'link_hover_color'  => '#ffffff',
        'accent_color'      => '#6366f1',
        // Accent bar (thin colored line on top of the footer)
        'accent_bar'        => '1',
        'accent_height'     => '3',
        // Layout
        'padding_y'         => '56',
        'padding_x'         => '24',
        'col_gap'           => '48',
        'max_width'         => '1180',
        'link_gap'          => '12',
        'mobile_align'      => 'left', // left | center
        // Typography
        'heading_size'      => '14',
        'heading_weight'    => '700',
        'heading_transform' => 'uppercase', // uppercase | none
        'font_size'         => '14',
        'link_hover_effect' => 'slide',     // none | underline | slide
        // Social icons
        'social_style'      => 'circle',    // plain | circle | square
        'social_size'       => '16',
        // Bottom bar
        'bottom_bg'         => '#0a101f',
        'bottom_text_color' => '#64748b',
        'bottom_divider'    => '1',
        // Scroll-to-top button
        'scroll_top'        => '0',
        // Advanced
        'custom_css'        => '',
    );
}

/**
 * Supported social networks → Font Awesome 6 brand icon classes.
 * Single source of truth shared by renderer and admin UI.
 */
function menux_footer_social_networks() {
    return array(
        'facebook'  => array( 'label' => 'Facebook',  'icon' => 'fa-brands fa-facebook-f' ),
        'instagram' => array( 'label' => 'Instagram', 'icon' => 'fa-brands fa-instagram' ),
        'x'         => array( 'label' => 'X (Twitter)', 'icon' => 'fa-brands fa-x-twitter' ),
        'linkedin'  => array( 'label' => 'LinkedIn',  'icon' => 'fa-brands fa-linkedin-in' ),
        'youtube'   => array( 'label' => 'YouTube',   'icon' => 'fa-brands fa-youtube' ),
        'tiktok'    => array( 'label' => 'TikTok',    'icon' => 'fa-brands fa-tiktok' ),
        'pinterest' => array( 'label' => 'Pinterest', 'icon' => 'fa-brands fa-pinterest-p' ),
        'github'    => array( 'label' => 'GitHub',    'icon' => 'fa-brands fa-github' ),
        'whatsapp'  => array( 'label' => 'WhatsApp',  'icon' => 'fa-brands fa-whatsapp' ),
        'telegram'  => array( 'label' => 'Telegram',  'icon' => 'fa-brands fa-telegram' ),
        'discord'   => array( 'label' => 'Discord',   'icon' => 'fa-brands fa-discord' ),
        'spotify'   => array( 'label' => 'Spotify',   'icon' => 'fa-brands fa-spotify' ),
        'threads'   => array( 'label' => 'Threads',   'icon' => 'fa-brands fa-threads' ),
        'email'     => array( 'label' => 'Email',     'icon' => 'fa-solid fa-envelope' ),
    );
}

/**
 * Sanitizes a CSS gradient/background value.
 * Single source of truth used by both the save path and the CSS generator.
 */
function menux_sanitize_bg_gradient( $value ) {
    if ( empty( $value ) ) {
        return '';
    }
    return str_replace( array( ';', '{', '}' ), '', wp_strip_all_tags( $value ) );
}
