@extends('admin.layouts.app')

@section('title', '仪表盘')

@section('content')
    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
        <div class="bg-white rounded-xl shadow-sm p-6 border border-gray-100">
            <h3 class="text-gray-500 text-sm font-medium mb-1">总计注册用户数</h3>
            <p class="text-3xl font-bold text-gray-800">{{ $stats['total_users'] }}</p>
        </div>

        <div class="bg-white rounded-xl shadow-sm p-6 border border-gray-100">
            <h3 class="text-gray-500 text-sm font-medium mb-1">总计聊天频道数</h3>
            <p class="text-3xl font-bold text-gray-800">{{ $stats['total_rooms'] }}</p>
        </div>

        <div class="bg-white rounded-xl shadow-sm p-6 border border-gray-100">
            <h3 class="text-gray-500 text-sm font-medium mb-1">当前在线人数</h3>
            <p class="text-3xl font-bold text-emerald-600">{{ $stats['online_users'] }}</p>
            <p class="mt-2 text-xs text-gray-400">按 Redis 在线心跳实时去重统计</p>
        </div>
    </div>

    <div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
        <div class="p-6 border-b border-gray-100 flex justify-between items-center">
            <h2 class="text-lg font-bold text-gray-800">系统信息摘要</h2>
        </div>
        <div class="p-6">
            <ul class="space-y-3">
                <li class="flex items-center font-mono text-sm">
                    <span class="w-32 text-gray-500 inline-block font-sans">Laravel 版本：</span>
                    <span class="text-indigo-600">{{ app()->version() }}</span>
                </li>
                <li class="flex items-center font-mono text-sm">
                    <span class="w-32 text-gray-500 inline-block font-sans">PHP 版本：</span>
                    <span class="text-indigo-600">{{ PHP_VERSION }}</span>
                </li>
                <li class="flex items-center text-sm font-mono mt-4 pt-4 border-t">
                    <span class="mr-4 text-gray-500 inline-block font-sans items-center flex">队列监控面板</span>
                    <!-- Laravel Horizon 的默认路由前缀由开发者确认或自己改。这里默认是 /horizon -->
                    <a href="{{ url('/horizon') }}" target="_blank"
                        class="text-blue-600 hover:text-blue-800 hover:underline flex items-center">
                        <span>打开 Horizon 控制台</span>
                        <svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path>
                        </svg>
                    </a>
                </li>
            </ul>
        </div>
    </div>
@endsection
