@props([
    'record' => [],
    'guidanceBlocks' => [],
    'settingsBlocks' => [],
    'fullSettingsUrl' => null,
])

<div x-data="{ activeTab: 'overview' }" class="space-y-5">
    <x-filament::tabs contained :label="__('dberp.plugin_center.details.navigation_label')">
        <x-filament::tabs.item
            alpine-active="activeTab === 'overview'"
            x-on:click="activeTab = 'overview'"
            x-bind:aria-selected="activeTab === 'overview'"
            icon="heroicon-o-information-circle"
        >
            {{ __('dberp.plugin_center.details.tabs.overview') }}
        </x-filament::tabs.item>

        <x-filament::tabs.item
            alpine-active="activeTab === 'guidance'"
            x-on:click="activeTab = 'guidance'"
            x-bind:aria-selected="activeTab === 'guidance'"
            icon="heroicon-o-book-open"
        >
            {{ __('dberp.plugin_center.details.tabs.guidance') }}
        </x-filament::tabs.item>

        <x-filament::tabs.item
            alpine-active="activeTab === 'settings'"
            x-on:click="activeTab = 'settings'"
            x-bind:aria-selected="activeTab === 'settings'"
            icon="heroicon-o-cog-6-tooth"
        >
            {{ __('dberp.plugin_center.details.tabs.settings') }}
        </x-filament::tabs.item>
    </x-filament::tabs>

    <div x-show="activeTab === 'overview'" x-cloak class="space-y-4">
        @if (filled($record['last_error'] ?? null))
            <x-filament::callout
                color="danger"
                :heading="__('dberp.plugin_center.details.last_error')"
                :description="$record['last_error']"
            />
        @endif

        <dl class="grid gap-3 sm:grid-cols-2">
            <div class="rounded-xl bg-gray-50 px-4 py-3 dark:bg-white/5">
                <dt class="text-xs text-gray-500 dark:text-gray-400">
                    {{ __('dberp.plugin_center.installed.columns.status') }}
                </dt>
                <dd class="mt-2">
                    <x-filament::badge :color="$record['status_color'] ?? 'gray'">
                        {{ $record['status_label'] ?? '—' }}
                    </x-filament::badge>
                </dd>
            </div>

            <div class="rounded-xl bg-gray-50 px-4 py-3 dark:bg-white/5">
                <dt class="text-xs text-gray-500 dark:text-gray-400">
                    {{ __('dberp.plugin_center.installed.columns.version') }}
                </dt>
                <dd class="mt-1 text-sm font-medium text-gray-950 dark:text-white">
                    {{ $record['version'] ?? '—' }}
                </dd>
            </div>

            <div class="rounded-xl bg-gray-50 px-4 py-3 dark:bg-white/5">
                <dt class="text-xs text-gray-500 dark:text-gray-400">
                    {{ __('dberp.plugin_center.installed.columns.update_status') }}
                </dt>
                <dd class="mt-2">
                    <x-filament::badge :color="$record['update_status_color'] ?? 'gray'">
                        {{ $record['update_status_label'] ?? '—' }}
                    </x-filament::badge>
                </dd>
            </div>

            <div class="rounded-xl bg-gray-50 px-4 py-3 dark:bg-white/5">
                <dt class="text-xs text-gray-500 dark:text-gray-400">
                    {{ __('dberp.plugin_center.installed.columns.installed_at') }}
                </dt>
                <dd class="mt-1 text-sm font-medium text-gray-950 dark:text-white">
                    {{ $record['installed_at_label'] ?? __('dberp.plugin_center.installed.installed_at_unknown') }}
                </dd>
            </div>
        </dl>

        <div class="rounded-xl border border-gray-200 px-4 py-3 dark:border-white/10">
            <p class="text-xs text-gray-500 dark:text-gray-400">
                {{ __('dberp.plugin_center.installed.columns.identifier') }}
            </p>
            <p class="mt-1 break-all font-mono text-sm text-gray-950 dark:text-white">
                {{ $record['identifier'] ?? '—' }}
            </p>
        </div>
    </div>

    <div x-show="activeTab === 'guidance'" x-cloak>
        @if ($guidanceBlocks !== [])
            @include('filament.host-plugin-center.usage-guidance-panel', ['blocks' => $guidanceBlocks])
        @else
            <p class="text-sm text-gray-500 dark:text-gray-400">
                {{ __('dberp.plugin_center.details.empty_guidance') }}
            </p>
        @endif
    </div>

    <div x-show="activeTab === 'settings'" x-cloak>
        @include('filament.host-plugin-center.settings-panel', [
            'blocks' => $settingsBlocks,
            'fullSettingsUrl' => $fullSettingsUrl,
        ])
    </div>
</div>
