<x-filament-widgets::widget>
    @php
        // Inline Lucide-style icons (brand icon system; no emoji, no component
        // resolution so Filament's icon middleware can't interfere).
        $icons = [
            'calendar' => '<rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/>',
            'mail'     => '<rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-10 6L2 7"/>',
            'external' => '<path d="M7 17 17 7M8 7h9v9"/>',
            'pen'      => '<path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/>',
            'cap'      => '<path d="M22 10 12 5 2 10l10 5 10-5Z"/><path d="M6 12.5V17c0 1.1 2.7 3 6 3s6-1.9 6-3v-4.5"/>',
        ];
        $svg = fn (string $name, float $size = 1) =>
            '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="width:'.$size.'rem;height:'.$size.'rem;flex:none">'.$icons[$name].'</svg>';
    @endphp

    <div
        class="mw-welcome"
        style="
            position: relative; overflow: hidden; border-radius: 1.5rem; color: #fff;
            padding: 1.75rem 2rem;
            background:
                radial-gradient(40rem 30rem at 100% -20%, rgba(88,185,230,0.35), transparent 60%),
                linear-gradient(120deg, #0d142e 0%, #15204a 55%, #1d4c66 100%);
            box-shadow: 0 24px 60px -28px rgba(13,20,46,0.6);
        "
    >
        <div style="position:absolute; inset:0; opacity:0.06; background:url('{{ asset('images/pattern-kitenge.svg') }}'); background-size:340px;"></div>

        <div style="position:relative; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:1.25rem;">
            <div>
                <p style="font-size:0.78rem; font-weight:700; letter-spacing:0.16em; text-transform:uppercase; color:#8ed4f2;">{{ $today }}</p>
                <h2 style="margin-top:0.35rem; font-family:'Sora',sans-serif; font-size:1.65rem; font-weight:800; line-height:1.15; letter-spacing:-0.02em;">
                    {{ $greeting }}, {{ \Illuminate\Support\Str::of($name)->before(' ') ?: $name }}
                </h2>
                <p style="margin-top:0.4rem; max-width:34rem; color:#b9c6e7; font-size:0.92rem; line-height:1.5;">
                    Here&rsquo;s what&rsquo;s happening across Money-Wise. Manage your content, watch the community grow, and keep every member&rsquo;s journey on track.
                </p>

                <div style="margin-top:1.1rem; display:flex; flex-wrap:wrap; gap:0.6rem;">
                    <a href="{{ \App\Filament\Resources\Consultations\ConsultationResource::getUrl() }}"
                       style="display:inline-flex; align-items:center; gap:0.5rem; border-radius:9999px; background:rgba(255,255,255,0.1); border:1px solid rgba(255,255,255,0.16); padding:0.45rem 0.95rem; font-size:0.85rem; font-weight:700; color:#fff; text-decoration:none;">
                        {!! $svg('calendar', 0.95) !!} {{ $openConsultations }} new consultation{{ $openConsultations === 1 ? '' : 's' }}
                    </a>
                    <a href="{{ \App\Filament\Resources\Inquiries\InquiryResource::getUrl() }}"
                       style="display:inline-flex; align-items:center; gap:0.5rem; border-radius:9999px; background:rgba(255,255,255,0.1); border:1px solid rgba(255,255,255,0.16); padding:0.45rem 0.95rem; font-size:0.85rem; font-weight:700; color:#fff; text-decoration:none;">
                        {!! $svg('mail', 0.95) !!} {{ $openInquiries }} open inquir{{ $openInquiries === 1 ? 'y' : 'ies' }}
                    </a>
                    <a href="{{ url('/') }}" target="_blank" rel="noopener"
                       style="display:inline-flex; align-items:center; gap:0.5rem; border-radius:9999px; background:#58b9e6; padding:0.45rem 1.05rem; font-size:0.85rem; font-weight:800; color:#0d142e; text-decoration:none;">
                        View live site {!! $svg('external', 0.95) !!}
                    </a>
                </div>
            </div>

            <div style="display:flex; gap:0.6rem;">
                <a href="{{ \App\Filament\Resources\Posts\PostResource::getUrl('create') }}"
                   style="display:flex; flex-direction:column; gap:0.3rem; min-width:8.5rem; border-radius:1rem; background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.14); padding:0.9rem 1rem; color:#fff; text-decoration:none;">
                    <span style="color:#8ed4f2;">{!! $svg('pen', 1.3) !!}</span>
                    <span style="font-family:'Sora',sans-serif; font-weight:700; font-size:0.92rem;">Write a post</span>
                    <span style="color:#8ed4f2; font-size:0.75rem; font-weight:600;">New article</span>
                </a>
                <a href="{{ \App\Filament\Resources\Courses\CourseResource::getUrl('create') }}"
                   style="display:flex; flex-direction:column; gap:0.3rem; min-width:8.5rem; border-radius:1rem; background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.14); padding:0.9rem 1rem; color:#fff; text-decoration:none;">
                    <span style="color:#8ed4f2;">{!! $svg('cap', 1.3) !!}</span>
                    <span style="font-family:'Sora',sans-serif; font-weight:700; font-size:0.92rem;">Add a course</span>
                    <span style="color:#8ed4f2; font-size:0.75rem; font-weight:600;">Grow the academy</span>
                </a>
            </div>
        </div>
    </div>
</x-filament-widgets::widget>
