{{--
    文件功能：婚礼红包领取明细页

    @author   ChatRoom Laravel
    @version  1.0.0
--}}

@extends('admin.layouts.app')

@section('title', '婚礼红包明细')

@section('content')
    @php require resource_path('views/admin/partials/list-theme.php'); @endphp

    <div class="{{ $adminListPageClass }}">
        <div class="{{ $adminListHeaderCardClass }}">
            <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
                <div>
                    <h2 class="{{ $adminListHeaderTitleClass }}">🎁 红包领取明细</h2>
                    <p class="{{ $adminListHeaderSubtitleClass }}">
                        {{ $ceremony->marriage?->user?->username }} × {{ $ceremony->marriage?->partner?->username }}
                        — {{ $ceremony->tier?->icon }} {{ $ceremony->tier?->name ?? '婚礼' }}
                        · 总额 <strong class="text-amber-600">{{ number_format($ceremony->total_amount) }} 金</strong>
                    </p>
                </div>
                <a href="{{ route('admin.marriages.ceremonies') }}" class="{{ $adminListSecondaryButtonClass }}">返回婚礼列表</a>
            </div>
        </div>

        <div class="grid grid-cols-1 gap-4 md:grid-cols-3">
            <div class="{{ $adminListCardClass }} p-4 text-center">
                <div class="text-2xl font-bold text-indigo-600">{{ $ceremony->online_count ?? 0 }}</div>
                <div class="mt-1 text-xs text-gray-500">在线人数</div>
            </div>
            <div class="{{ $adminListCardClass }} p-4 text-center">
                <div class="text-2xl font-bold text-green-600">{{ $ceremony->claimed_count }}</div>
                <div class="mt-1 text-xs text-gray-500">已领取人数</div>
            </div>
            <div class="{{ $adminListCardClass }} p-4 text-center">
                <div class="text-2xl font-bold text-amber-600">{{ number_format($ceremony->claimed_amount) }}</div>
                <div class="mt-1 text-xs text-gray-500">已领取金额</div>
            </div>
        </div>

        <div class="{{ $adminListCardClass }}">
            <div class="{{ $adminListSectionHeadClass }}">
                <div>
                    <h3 class="{{ $adminListSectionTitleClass }}">领取明细</h3>
                    <p class="{{ $adminListSectionDescClass }}">明细表头、正文、状态徽章与分页统一到后台列表页样式。</p>
                </div>
            </div>
            <div class="{{ $adminListTableWrapClass }}">
                <table class="{{ $adminListTableClass }}">
                    <thead>
                        <tr class="{{ $adminListTableHeadRowClass }}">
                            <th class="{{ $adminListTableHeadCellClass }}">用户</th>
                            <th class="{{ $adminListTableHeadCellClass }} text-center">分配金额</th>
                            <th class="{{ $adminListTableHeadCellClass }} text-center">状态</th>
                            <th class="{{ $adminListTableHeadCellClass }}">领取时间</th>
                        </tr>
                    </thead>
                    <tbody class="{{ $adminListTableBodyClass }}">
                        @forelse ($claims as $claim)
                            <tr class="{{ $adminListTableRowClass }}">
                                <td class="px-4 py-3 {{ $adminListPrimaryTextClass }}">{{ $claim->user?->username }}</td>
                                <td class="px-4 py-3 text-center font-semibold text-amber-600">
                                    {{ number_format($claim->amount) }} 金
                                </td>
                                <td class="px-4 py-3 text-center">
                                    @if ($claim->claimed)
                                        <span class="{{ $adminListBadgeBaseClass }} border-green-200 bg-green-100 text-green-700">✅ 已领取</span>
                                    @else
                                        <span class="{{ $adminListBadgeBaseClass }} border-gray-200 bg-gray-100 text-gray-500">未领取</span>
                                    @endif
                                </td>
                                <td class="px-4 py-3 {{ $adminListSecondaryTextClass }}">
                                    {{ $claim->claimed_at?->format('H:i:s') ?? '—' }}
                                </td>
                            </tr>
                        @empty
                            <tr>
                                <td colspan="4" class="{{ $adminListEmptyClass }}">暂无领取记录</td>
                            </tr>
                        @endforelse
                    </tbody>
                </table>
            </div>
            @if ($claims->hasPages())
                <div class="{{ $adminListPaginationClass }}">{{ $claims->links() }}</div>
            @endif
        </div>
    </div>

@endsection
