@php
    $ts = themeService()->boot();
    $footerSettings = $ts->settings('footer');

    $description = $ts->trans('footer', 'footer_description');
    $copyright = $ts->trans('footer', 'copyright_text', null, '©' . date('Y') . ' All rights reserved');
    $address = $ts->config('footer', 'footer_address', '');
    $email = $ts->config('footer', 'footer_email', '');
    $phone = $ts->config('footer', 'footer_phone', '');
    $hotline = $ts->config('footer', 'footer_hotline', '');

    // Social links
    $socials = [
        'facebook' => $ts->config('footer', 'social_facebook', ''),
        'instagram' => $ts->config('footer', 'social_instagram', ''),
        'twitter' => $ts->config('footer', 'social_twitter', ''),
        'linkedin' => $ts->config('footer', 'social_linkedin', ''),
        'youtube' => $ts->config('footer', 'social_youtube', ''),
        'tiktok' => $ts->config('footer', 'social_tiktok', ''),
    ];

    // Menu tags for footer columns
    $footerMenu1Tag = $ts->menuTag('footer_1');
    $footerMenu2Tag = $ts->menuTag('footer_2');
    $footerMenu3Tag = $ts->menuTag('footer_3');
    // Translatable labels
    $sectionConfigs = [];
    $sectionConfigs['footer_contact_title'] = $ts->trans('footer', 'footer_contact_title', null, __('globals.contact_us'));
    $sectionConfigs['footer_hotline_label'] = $ts->trans('footer', 'footer_hotline_label', null, __('globals.hotline'));
    $sectionConfigs['footer_email_label'] = $ts->trans('footer', 'footer_email_label', null, __('globals.email'));
    $sectionConfigs['footer_social_label'] = $ts->trans('footer', 'footer_social_label', null, __('globals.stay_connected'));
    $sectionConfigs['footer_menu1_title'] = $ts->trans('footer', 'footer_menu1_title', null, __('globals.categories'));
    $sectionConfigs['footer_menu2_title'] = $ts->trans('footer', 'footer_menu2_title', null, __('globals.useful_links'));
    $sectionConfigs['footer_menu3_title'] = $ts->trans('footer', 'footer_menu3_title', null, __('globals.help_center'));
@endphp

<footer class="section-t-space">
    {{-- Benefits bar inside footer --}}
    @include('florial::sections.benefits')

    <div class="container-fluid-lg">

        <div class="main-footer section-b-space section-t-space">
            <div class="row g-md-4 g-3">

                {{-- Column 1: Logo + description + contacts --}}
                <div class="col-xl-3 col-lg-4 col-sm-6">
                    <div class="footer-logo">
                        <div class="theme-logo">
                            <a href="{{ Route::localeSlug() }}">
                                <img src="{{ theme()->publicPath('images/florial/logo_florial_main.svg') }}" class="blur-up lazyload" alt="">
                            </a>
                        </div>
                        <div class="footer-logo-contain">
                            @if($description)
                                <p>{{ $description }}</p>
                            @endif
                            <ul class="address">
                                @if($address)
                                <li>
                                    <i data-feather="home"></i>
                                    <a href="javascript:void(0)">{{ $address }}</a>
                                </li>
                                @endif
                                @if($email)
                                <li>
                                    <i data-feather="mail"></i>
                                    <a href="mailto:{{ $email }}">{{ $email }}</a>
                                </li>
                                @endif
                            </ul>
                        </div>
                    </div>
                </div>

                {{-- Footer menu columns --}}
                @if($footerMenu1Tag)
                <div class="col-xl-2 col-lg-3 col-md-4 col-sm-6">
                    <div class="footer-title">
                        <h4>{{ $sectionConfigs['footer_menu1_title'] ?? __('globals.categories') }}</h4>
                    </div>
                    {!! menu($footerMenu1Tag) !!}
                </div>
                @endif

                @if($footerMenu2Tag)
                <div class="col-xl col-lg-2 col-sm-3">
                    <div class="footer-title">
                        <h4>{{ $sectionConfigs['footer_menu2_title'] ?? __('globals.useful_links') }}</h4>
                    </div>
                    {!! menu($footerMenu2Tag) !!}
                </div>
                @endif

                @if($footerMenu3Tag)
                <div class="col-xl-2 col-sm-3">
                    <div class="footer-title">
                        <h4>{{ $sectionConfigs['footer_menu3_title'] ?? __('globals.help_center') }}</h4>
                    </div>
                    {!! menu($footerMenu3Tag) !!}
                </div>
                @endif

                {{-- Contact column --}}
                <div class="col-xl-3 col-lg-4 col-sm-6">
                    <div class="footer-title">
                        <h4>{{ $sectionConfigs['footer_contact_title'] ?? __('globals.contact_us') }}</h4>
                    </div>
                    <div class="footer-contact">
                        <ul>
                            @if($hotline)
                            <li>
                                <div class="footer-number">
                                    <i data-feather="phone"></i>
                                    <div class="contact-number">
                                        <h6 class="text-content">{{ $sectionConfigs['footer_hotline_label'] ?? __('globals.hotline') }} :</h6>
                                        <h5>{{ $hotline }}</h5>
                                    </div>
                                </div>
                            </li>
                            @endif

                            @if($email)
                            <li>
                                <div class="footer-number">
                                    <i data-feather="mail"></i>
                                    <div class="contact-number">
                                        <h6 class="text-content">{{ $sectionConfigs['footer_email_label'] ?? __('globals.email') }} :</h6>
                                        <h5>{{ $email }}</h5>
                                    </div>
                                </div>
                            </li>
                            @endif
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        {{-- Sub footer --}}
        <div class="sub-footer section-small-space">
            <div class="reserve">
                <h6 class="text-content">{{ $copyright }}</h6>
            </div>

            @if($footerSettings['show_payment_icons'] ?? true)
            <div class="payment">
                <img src="{{ theme()->publicPath('images/payment/1.png') }}" class="blur-up lazyload" alt="">
            </div>
            @endif

            @if($footerSettings['show_social'] ?? true)
            <div class="social-link">
                <h6 class="text-content">{{ $sectionConfigs['footer_social_label'] ?? __('globals.stay_connected') }} :</h6>
                <ul>
                    @foreach($socials as $network => $url)
                        @if($url)
                        <li>
                            <a href="{{ $url }}" target="_blank">
                                <i class="fa-brands fa-{{ $network === 'twitter' ? 'x-twitter' : $network }}"></i>
                            </a>
                        </li>
                        @endif
                    @endforeach
                </ul>
            </div>
            @endif
        </div>
    </div>
</footer>
