<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    @php
        $pageWebsite = \App\Models\WebsiteSetting::current();
    @endphp
    <title>{{ $title ?? $pageWebsite->website_name }}</title>
    @if($pageWebsite->favicon)<link rel="icon" href="{{ asset('storage/'.$pageWebsite->favicon) }}">@endif
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Poppins:wght@500;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="{{ asset('css/app.css') }}">
</head>
@php
    $theme = in_array(\App\Models\Setting::valueFor('theme_preset', 'sky-sun'), ['sky-sun','cloud','lemon','glass'], true) ? \App\Models\Setting::valueFor('theme_preset', 'sky-sun') : 'sky-sun';
    $font = \App\Models\Setting::valueFor('font_preset', 'studio');
    $cardFinish = \App\Models\Setting::valueFor('card_finish', 'gloss');
    $website = \App\Models\WebsiteSetting::current();
    $brandTheme = \App\Models\BrandSetting::current();
    $gtsEnabled = \App\Models\Setting::valueFor('gts_landing_enabled', '1') === '1';
    $registrationEnabled = \App\Models\Setting::enabled('client_registration_enabled', false);
@endphp
<body data-theme="{{ $theme }}" data-font="{{ $font }}" data-card-finish="{{ $cardFinish }}" @class(['animations-off' => ! $brandTheme->animations_enabled, 'gradients-off' => ! $brandTheme->gradient_enabled]) style="--brand-primary:{{ $brandTheme->primary_color }};--brand-secondary:{{ $brandTheme->secondary_color }};--brand-bg:{{ $brandTheme->background_color }};--brand-text:{{ $brandTheme->text_color }};--brand-button-radius:{{ $brandTheme->button_radius }}px;--brand-card-radius:{{ $brandTheme->card_radius }}px;--brand-font:{{ $brandTheme->font_family }};">
    <header class="topbar public-header slim-header">
        <a class="brand header-brand" href="{{ route('home') }}">
            @if($website->logo)
                <img class="brand-logo" src="{{ asset('storage/'.$website->logo) }}" alt="{{ $website->agency_name }}">
            @else
                <span class="brand-mark">MGG</span>
            @endif
            <span><strong>{{ $website->agency_name }}</strong></span>
        </a>
        <button class="public-menu-toggle" type="button" aria-label="Toggle navigation" aria-controls="public-nav" aria-expanded="false" onclick="togglePublicNav(this)">
            <span></span><span></span><span></span>
        </button>
        <nav class="nav public-nav" id="public-nav">
            <a href="{{ route('home') }}">Home</a>
            <a href="{{ route('about') }}">About</a>
            <a href="{{ route('services') }}">Services</a>
            <a href="{{ route('portfolio') }}">Portfolio</a>
            <a href="{{ route('pricing') }}">Pricing</a>
            @if($gtsEnabled)<a href="{{ route('gts') }}">GTS</a>@endif
            <a href="{{ route('contact') }}">Contact</a>
            @auth
                <a class="btn small" href="{{ route(auth()->user()->portalRole().'.dashboard') }}">Dashboard</a>
            @else
                <a href="{{ route('login') }}">Login</a>
                @if($registrationEnabled)<a href="{{ route('register') }}">Register</a>@endif
                <a class="btn small" href="{{ route('service.order') }}">Get Started</a>
            @endauth
        </nav>
    </header>
    @if (session('status'))<div class="flash">{{ session('status') }}</div>@endif
    @if ($errors->any())<div class="flash error">{{ $errors->first() }}</div>@endif
    {{ $slot }}
    <footer class="site-footer">
        <div class="footer-brand"><a class="brand" href="{{ route('home') }}">@if($website->logo)<img class="brand-logo" src="{{ asset('storage/'.$website->logo) }}" alt="{{ $website->agency_name }}">@else<span class="brand-mark">MGG</span>@endif<span><strong>{{ $website->agency_name }}</strong><small>{{ $website->tagline ?: 'Premium digital agency system' }}</small></span></a><p>{{ $website->footer_text ?: 'Design production, client portals, plan tracking, payments, and delivery in one light modern workflow.' }}</p></div>
        <div><h2>Quick Links</h2><a href="{{ route('about') }}">About</a><a href="{{ route('portfolio') }}">Portfolio</a><a href="{{ route('pricing') }}">Pricing</a>@if($gtsEnabled)<a href="{{ route('gts') }}">GTS Seller</a>@endif<a href="{{ route('login') }}">Login</a></div>
        <div><h2>Services</h2><a href="{{ route('services') }}">Social Media Design</a><a href="{{ route('services') }}">Branding</a><a href="{{ route('services') }}">Meta Ads</a><a href="{{ route('services') }}">Websites</a></div>
        <div><h2>Contact</h2><a href="mailto:{{ $website->email ?: 'hello@mghaffargraphics.com' }}">{{ $website->email ?: 'hello@mghaffargraphics.com' }}</a><a href="tel:{{ preg_replace('/\D+/', '', $website->contact_number ?: '03068665907') }}">{{ $website->contact_number ?: '03068665907' }}</a><span>{{ $website->address ?: 'Pakistan' }}</span><span class="social-links"><a href="{{ $website->facebook ?: '#' }}">FB</a><a href="{{ $website->instagram ?: '#' }}">IG</a><a href="{{ $website->whatsapp_number ? 'https://wa.me/'.preg_replace('/\D+/', '', $website->whatsapp_number) : 'https://wa.me/923068665907' }}">WA</a></span></div>
        <div class="footer-legal"><span>&copy; {{ now()->year }} {{ $website->agency_name }}</span><a href="#">Terms</a><a href="#">Privacy</a></div>
    </footer>
    <script>
        function togglePublicNav(button) {
            const nav = document.getElementById('public-nav');
            const open = nav.classList.toggle('open');
            button.setAttribute('aria-expanded', open ? 'true' : 'false');
        }
    </script>
</body>
</html>
