@php
    $socials = getSocials();
    if (!empty($socials) && count($socials)) {
        $socials = collect($socials)->sortBy('order')->toArray();
    }

    $siteName = $generalSettings['site_name'] ?? config('app.name');

    $footerQuickLinks = [
        ['label' => trans('home.premium_footer_link_courses'), 'url' => url('/classes')],
        ['label' => trans('home.premium_footer_link_teachers'), 'url' => url('/instructors')],
        ['label' => trans('home.premium_footer_link_blog'), 'url' => url('/blog')],
        ['label' => trans('home.premium_footer_link_faq'), 'url' => url('/montessori-membership')],
        ['label' => trans('home.premium_footer_link_contact'), 'url' => url('/contact')],
    ];

    $footerSupportLinks = [
        ['label' => trans('home.premium_footer_link_help'), 'url' => url('/contact')],
        ['label' => trans('home.premium_footer_link_privacy'), 'url' => url('/pages/privacy_policy')],
        ['label' => trans('home.premium_footer_link_terms'), 'url' => url('/pages/terms')],
        ['label' => trans('home.premium_footer_link_refund'), 'url' => url('/pages/refund_policy')],
    ];

    $footerFoundationLinks = [
        ['label' => trans('home.premium_footer_link_foundation_about'), 'url' => url('/pages/about')],
        ['label' => trans('home.premium_footer_link_foundation_diplomas'), 'url' => url('/classes')],
        ['label' => trans('home.premium_footer_link_foundation_schools'), 'url' => url('/organizations')],
        ['label' => trans('home.premium_footer_link_foundation_materials'), 'url' => url('/products/tools-and-printables')],
        ['label' => trans('home.premium_footer_link_foundation_contact'), 'url' => url('/contact')],
    ];
@endphp

<footer class="footer footer-premium footer-premium-home-mock footer-premium-visual bg-navy position-relative user-select-none">

    <div class="footer-premium-visual__main border-top footer-premium-visual__hairline pt-45 pt-lg-55 pb-20">
        <div class="container">
            <div class="footer-premium-visual__cols footer-premium-visual__cols-grid">
                {{-- العمود 1: الهوية (يمين المعاينة في RTL) --}}
                <div class="footer-premium-visual__col footer-premium-visual__brand footer-premium-visual__col--brand text-center mb-35 mb-xl-0">
                    <div class="footer-premium-visual__brand-row d-flex align-items-center justify-content-center flex-wrap flex-lg-nowrap mb-15">
                        <a href="/" class="footer-premium-visual__brand-link d-inline-flex align-items-center text-white text-decoration-none">
                            @if (!empty($generalSettings['footer_logo']))
                                <img src="{{ $generalSettings['footer_logo'] }}" class="img-fluid footer-premium-visual__crest" alt="{{ $siteName }}" loading="lazy" decoding="async">
                            @elseif (!empty($generalSettings['logo']))
                                <img src="{{ $generalSettings['logo'] }}" class="img-fluid footer-premium-visual__crest footer-premium-visual__crest--small" alt="{{ $siteName }}" loading="lazy" decoding="async">
                            @endif
                            <span class="footer-premium-visual__brand-name font-weight-bold font-22 text-wrap">{{ $siteName }}</span>
                        </a>
                    </div>
                    <p class="footer-premium-visual__tagline mb-12 font-weight-bold">{{ trans('home.premium_footer_brand_tagline') }}</p>
                    <p class="footer-premium-visual__lead text-white font-weight-bold font-15 mb-12">{{ trans('home.premium_footer_brand_subline') }}</p>
                    <p class="footer-premium-visual__lead footer-premium-visual__muted font-14 mb-20">{{ trans('home.premium_footer_brand_desc') }}</p>
                    @if (!empty($socials) && count($socials))
                        <div class="footer-premium-visual__social d-flex justify-content-center flex-wrap footer-premium-visual__social-list">
                            @foreach ($socials as $social)
                                <a href="{{ $social['link'] }}" rel="noopener noreferrer" target="_blank"
                                    class="footer-premium-visual__social-circle d-inline-flex align-items-center justify-content-center mb-10"
                                    aria-label="{{ $social['title'] ?? '' }}">
                                    <img src="{{ $social['image'] }}" alt="" class="img-fluid footer-premium-visual__social-icon" loading="lazy" decoding="async">
                                </a>
                            @endforeach
                        </div>
                    @endif
                </div>

                <div class="footer-premium-visual__col footer-premium-visual__col--links text-center mb-30 mb-xl-0">
                    <h3 class="footer-premium-visual__col-title text-white font-weight-bold mb-15">{{ trans('home.premium_footer_col_quick_title') }}</h3>
                    <ul class="footer-premium-visual__links list-unstyled mb-0">
                        @foreach ($footerQuickLinks as $item)
                            <li class="mb-10">
                                <a href="{{ $item['url'] }}" class="footer-premium-visual__link">{{ $item['label'] }}</a>
                            </li>
                        @endforeach
                    </ul>
                </div>

                <div class="footer-premium-visual__col footer-premium-visual__col--links text-center mb-30 mb-xl-0">
                    <h3 class="footer-premium-visual__col-title text-white font-weight-bold mb-15">{{ trans('home.premium_footer_col_support_title') }}</h3>
                    <ul class="footer-premium-visual__links list-unstyled mb-0">
                        @foreach ($footerSupportLinks as $item)
                            <li class="mb-10">
                                <a href="{{ $item['url'] }}" class="footer-premium-visual__link">{{ $item['label'] }}</a>
                            </li>
                        @endforeach
                    </ul>
                </div>

                <div class="footer-premium-visual__col footer-premium-visual__col--links text-center mb-30 mb-xl-0">
                    <h3 class="footer-premium-visual__col-title text-white font-weight-bold mb-15">{{ trans('home.premium_footer_col_foundation_title') }}</h3>
                    <ul class="footer-premium-visual__links list-unstyled mb-0">
                        @foreach ($footerFoundationLinks as $item)
                            <li class="mb-10">
                                <a href="{{ $item['url'] }}" class="footer-premium-visual__link">{{ $item['label'] }}</a>
                            </li>
                        @endforeach
                    </ul>
                </div>

                <div class="footer-premium-visual__col footer-premium-visual__newsletter-col footer-premium-visual__col--nl text-center">
                    <h3 class="footer-premium-visual__col-title text-white font-weight-bold mb-12">{{ trans('home.premium_footer_association_title') }}</h3>
                    <p class="footer-premium-visual__muted font-14 mb-10">{{ trans('home.premium_footer_association_lead') }}</p>
                    <p class="footer-premium-visual__muted font-14 mb-12">{{ trans('home.premium_footer_association_phone_prompt') }}</p>
                    <form action="{{ url('/newsletters') }}" method="post" class="m-0 footer-premium-visual__newsletter-form footer-premium-visual__association-form">
                        {{ csrf_field() }}
                        <input type="hidden" name="footer_association_join" value="1">
                        <label class="footer-premium-visual__association-phone-label d-block text-right font-14 mb-8" for="footer-premium-association-phone">{{ trans('home.premium_footer_association_phone_label') }}</label>
                        <input id="footer-premium-association-phone" type="tel" name="newsletter_whatsapp" inputmode="tel" autocomplete="tel"
                            class="footer-premium-visual__aside-input rounded-lg px-15 py-12 w-100"
                            placeholder="{{ trans('home.premium_footer_association_phone_placeholder') }}"
                            required maxlength="64"
                            value="">
                        <button type="submit" class="footer-premium-visual__aside-submit footer-premium-visual__association-submit rounded-lg py-12 font-weight-bold">{{ trans('home.premium_footer_association_submit') }}</button>
                    </form>
                </div>
            </div>

            <div class="footer-premium-visual__bar d-flex flex-wrap align-items-center justify-content-between pt-30 mt-35 footer-premium-visual__hairline border-top">
                <p class="text-white mb-0 font-14 footer-premium-home__rights order-2 order-md-1 mt-15 mt-md-0">
                    {{ trans('home.premium_footer_rights', ['year' => date('Y'), 'site' => $siteName]) }}
                </p>
                <a href="#app" class="footer-premium-visual__top-btn order-1 order-md-2 d-inline-flex align-items-center justify-content-center text-decoration-none" aria-label="{{ trans('home.premium_footer_back_top') }}">
                    <i class="fa fa-angle-up" aria-hidden="true"></i>
                </a>
            </div>
        </div>
    </div>
</footer>
