@extends('layouts.panel')

@section('title', 'Search')

@section('content')
    <section class="card">
        <p class="eyebrow">Global Search</p>
        <h1>Results for "{{ $term ?: '...' }}"</h1>
        <p class="muted">Search spans connected websites and recent audit activity.</p>
    </section>

    <section class="two-column">
        <article class="card">
            <div class="page-header">
                <p class="eyebrow">Websites</p>
                <h1>Matching properties</h1>
            </div>

            <div class="summary-list">
                @forelse ($websites as $website)
                    <div class="summary-row">
                        <div>
                            <strong>{{ $website->name }}</strong>
                            <p class="muted">{{ $website->domain }}</p>
                        </div>
                        <a class="button ghost" href="{{ route('websites.show', $website) }}">Open</a>
                    </div>
                @empty
                    <p class="muted">No websites matched.</p>
                @endforelse
            </div>
        </article>

        <article class="card">
            <div class="page-header">
                <p class="eyebrow">Activity</p>
                <h1>Audit log matches</h1>
            </div>

            <div class="summary-list">
                @forelse ($activity as $log)
                    <div class="summary-row">
                        <div>
                            <strong>{{ str($log->action)->headline() }}</strong>
                            <p class="muted">{{ $log->description }}</p>
                        </div>
                        <span class="muted">{{ $log->occurred_at->diffForHumans() }}</span>
                    </div>
                @empty
                    <p class="muted">No activity matched.</p>
                @endforelse
            </div>
        </article>
    </section>
@endsection
