<layout name="admin" />

<!-- Breadcrumbs -->
<x-breadcrumbs items='[{"url": "/admin", "text": "Dashboard"}]' />

<!-- Dashboard Content -->
<div class="admin-content__header admin-content__header--with-actions">
    <div class="admin-content__title-group">
        <h1 class="admin-content__title">Admin Dashboard</h1>
        <p class="admin-content__description">System overview and quick actions</p>
    </div>
</div>

<!-- System Stats Grid -->
<div class="admin-grid admin-grid--3-col">
    <div class="admin-card">
        <div class="admin-card__header">
            <h3 class="admin-card__title">System Status</h3>
        </div>
        <div class="admin-card__content">
            <div class="admin-stat-list">
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Status</span>
                    <span class="admin-badge admin-badge--success">Online</span>
                </div>
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Uptime</span>
                    <span class="admin-stat-list__value">{{ uptime_formatted }}</span>
                </div>
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Version</span>
                    <span class="admin-stat-list__value">{{ $framework_version }}</span>
                </div>
            </div>
        </div>
    </div>

    <div class="admin-card">
        <div class="admin-card__header">
            <h3 class="admin-card__title">Performance</h3>
        </div>
        <div class="admin-card__content">
            <div class="admin-stat-list">
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Memory Usage</span>
                    <span class="admin-stat-list__value">{{ memory_usage_formatted }}</span>
                </div>
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Peak Memory</span>
                    <span class="admin-stat-list__value">{{ peak_memory_formatted }}</span>
                </div>
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Load Average</span>
                    <span class="admin-stat-list__value">{{ load_average }}</span>
                </div>
            </div>
        </div>
    </div>

    <div class="admin-card">
        <div class="admin-card__header">
            <h3 class="admin-card__title">Database</h3>
        </div>
        <div class="admin-card__content">
            <div class="admin-stat-list">
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Connection</span>
                    <span class="admin-badge admin-badge--success">Connected</span>
                </div>
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Pool Size</span>
                    <span class="admin-stat-list__value">{{ db_pool_size }}</span>
                </div>
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Active Connections</span>
                    <span class="admin-stat-list__value">{{ db_active_connections }}</span>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Additional Stats Grid -->
<div class="admin-grid admin-grid--3-col" style="margin-top: var(--admin-spacing-xl);">
    <div class="admin-card">
        <div class="admin-card__header">
            <h3 class="admin-card__title">Cache Performance</h3>
        </div>
        <div class="admin-card__content">
            <div class="admin-stat-list">
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Hit Rate</span>
                    <span class="admin-stat-list__value">{{ cache_hit_rate }}</span>
                </div>
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Total Operations</span>
                    <span class="admin-stat-list__value">{{ cache_total_operations }}</span>
                </div>
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Status</span>
                    <span class="admin-badge admin-badge--success">Running</span>
                </div>
            </div>
        </div>
    </div>

    <div class="admin-card">
        <div class="admin-card__header">
            <h3 class="admin-card__title">Recent Activity</h3>
        </div>
        <div class="admin-card__content">
            <div class="admin-stat-list">
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Requests Today</span>
                    <span class="admin-stat-list__value">{{ requests_today }}</span>
                </div>
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Errors</span>
                    <span class="admin-stat-list__value">{{ errors_today }}</span>
                </div>
                <div class="admin-stat-list__item">
                    <span class="admin-stat-list__label">Last Deployment</span>
                    <span class="admin-stat-list__value">{{ last_deployment }}</span>
                </div>
            </div>
        </div>
    </div>

    <div class="admin-card">
        <div class="admin-card__header">
            <h3 class="admin-card__title">Quick Actions</h3>
        </div>
        <div class="admin-card__content">
            <div class="admin-cluster">
                <x-a href="{{ clear_cache_url }}" class="admin-btn admin-btn--primary">Clear Cache</x-a>
                <x-a href="{{ logs_url }}" class="admin-btn admin-btn--secondary">View Logs</x-a>
                <x-a href="{{ migrations_url }}" class="admin-btn admin-btn--accent">Migrations</x-a>
            </div>
        </div>
    </div>
</div>
