@php
    $c = (array) ($site->contact ?? []);
    $social = (array) ($site->social ?? []);
    $hours = (array) ($site->hours ?? []);
    $navPages = $navPages ?? collect();
@endphp
<footer class="vs-footer">
    <div class="vs-container vs-footer-grid">
        <div class="vs-footer-col">
            <a href="/" class="vs-logo vs-footer-logo">
                @if($site->logoUrl())<img src="{{ $site->logoUrl() }}" alt="{{ $site->name }}">@else<span class="vs-logo-mark"><i class="fas fa-stethoscope"></i></span>@endif
                <span class="vs-logo-text">{{ $site->name }}</span>
            </a>
            @if($site->tagline)<p class="vs-footer-about">{{ $site->tagline }}</p>@endif
            @if($social)
                <div class="vs-social">
                    @foreach(['facebook','instagram','twitter','tiktok','youtube','linkedin'] as $net)
                        @if(!empty($social[$net]))
                            <a href="{{ $social[$net] }}" target="_blank" rel="noopener" aria-label="{{ $net }}"><i class="fab fa-{{ $net }}"></i></a>
                        @endif
                    @endforeach
                </div>
            @endif
        </div>

        <div class="vs-footer-col">
            <h4>Explore</h4>
            <ul>
                @foreach($navPages as $p)
                    <li><a href="{{ $p->is_home ? '/' : '/' . $p->slug }}">{{ $p->title }}</a></li>
                @endforeach
                <li><a href="/portal">Client Portal</a></li>
            </ul>
        </div>

        <div class="vs-footer-col">
            <h4>Contact</h4>
            <ul class="vs-footer-contact">
                @if(!empty($c['address']))<li><i class="fas fa-location-dot"></i> {{ $c['address'] }}</li>@endif
                @if(!empty($c['phone']))<li><i class="fas fa-phone"></i> <a href="tel:{{ preg_replace('/[^0-9+]/','',$c['phone']) }}">{{ $c['phone'] }}</a></li>@endif
                @if(!empty($c['email']))<li><i class="fas fa-envelope"></i> <a href="mailto:{{ $c['email'] }}">{{ $c['email'] }}</a></li>@endif
            </ul>
        </div>

        @if($hours)
        <div class="vs-footer-col">
            <h4>Hours</h4>
            <ul class="vs-footer-hours">
                @foreach($hours as $row)
                    <li><span>{{ $row['day'] ?? '' }}</span><span>{{ $row['time'] ?? '' }}</span></li>
                @endforeach
            </ul>
        </div>
        @endif
    </div>
    <div class="vs-footer-bar">
        <div class="vs-container">
            <span>© {{ now()->year }} {{ $site->name }}. All rights reserved.</span>
            <span class="vs-footer-powered">Powered by Shifa One</span>
        </div>
    </div>
</footer>
