@extends('admin.layouts.app')

@section('title', 'Dashboard')

@section('content')
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <h1 class="h3 mb-4">Dashboard</h1>
            </div>
        </div>

        <!-- Statistics Cards -->
        <div class="row mb-4">
            <div class="col-md-3">
                <div class="card bg-primary text-white">
                    <div class="card-body">
                        <div class="d-flex justify-content-between">
                            <div>
                                <h4 class="card-title">{{ $stats['content_sections'] }}</h4>
                                <p class="card-text">Content Sections</p>
                            </div>
                            <div class="align-self-center">
                                <i class="bi bi-file-text fs-2"></i>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer">
                        <a href="{{ route('admin.content-sections.index') }}" class="text-white text-decoration-none">
                            <small>View all <i class="bi bi-arrow-right"></i></small>
                        </a>
                    </div>
                </div>
            </div>

            <div class="col-md-3">
                <div class="card bg-success text-white">
                    <div class="card-body">
                        <div class="d-flex justify-content-between">
                            <div>
                                <h4 class="card-title">{{ $stats['statistics'] }}</h4>
                                <p class="card-text">Statistics</p>
                            </div>
                            <div class="align-self-center">
                                <i class="bi bi-graph-up fs-2"></i>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer">
                        <a href="{{ route('admin.statistics.index') }}" class="text-white text-decoration-none">
                            <small>View all <i class="bi bi-arrow-right"></i></small>
                        </a>
                    </div>
                </div>
            </div>

            <div class="col-md-3">
                <div class="card bg-info text-white">
                    <div class="card-body">
                        <div class="d-flex justify-content-between">
                            <div>
                                <h4 class="card-title">{{ $stats['admin_users'] }}</h4>
                                <p class="card-text">Admin Users</p>
                            </div>
                            <div class="align-self-center">
                                <i class="bi bi-people fs-2"></i>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer">
                        <small class="text-white">System administrators</small>
                    </div>
                </div>
            </div>

            <div class="col-md-3">
                <div class="card bg-warning text-dark">
                    <div class="card-body">
                        <div class="d-flex justify-content-between">
                            <div>
                                <h4 class="card-title">{{ $stats['active_sections'] }}</h4>
                                <p class="card-text">Active Sections</p>
                            </div>
                            <div class="align-self-center">
                                <i class="bi bi-check-circle fs-2"></i>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer">
                        <small>Currently published</small>
                    </div>
                </div>
            </div>
        </div>

        <!-- Recent Content Sections -->
        {{-- <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header d-flex justify-content-between align-items-center">
                    <h5 class="mb-0">Active Content Sections</h5>
                    <a href="{{ route('admin.content-sections.create') }}" class="btn btn-primary btn-sm">
                        <i class="bi bi-plus"></i> Add New
                    </a>
                </div>
                <div class="card-body">
                    @if ($activeContentSections->count() > 0)
                        <div class="table-responsive">
                            <table class="table table-hover">
                                <thead>
                                    <tr>
                                        <th>Section Key</th>
                                        <th>Title</th>
                                        <th>Sort Order</th>
                                        <th>Last Updated</th>
                                        <th>Actions</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach ($activeContentSections as $section)
                                        <tr>
                                            <td>
                                                <span class="badge bg-secondary">{{ $section->section_key }}</span>
                                            </td>
                                            <td>{{ Str::limit($section->title, 50) }}</td>
                                            <td>
                                                <span class="badge bg-light text-dark">{{ $section->sort_order }}</span>
                                            </td>
                                            <td>{{ $section->updated_at->format('M d, Y H:i') }}</td>
                                            <td>
                                                <div class="btn-group btn-group-sm" role="group">
                                                    <a href="{{ route('admin.content-sections.show', $section) }}"
                                                       class="btn btn-outline-primary" title="View">
                                                        <i class="bi bi-eye"></i>
                                                    </a>
                                                    <a href="{{ route('admin.content-sections.edit', $section) }}"
                                                       class="btn btn-outline-secondary" title="Edit">
                                                        <i class="bi bi-pencil"></i>
                                                    </a>
                                                </div>
                                            </td>
                                        </tr>
                                    @endforeach
                                </tbody>
                            </table>
                        </div>
                    @else
                        <div class="text-center py-4">
                            <i class="bi bi-file-text text-muted" style="font-size: 3rem;"></i>
                            <p class="text-muted mt-2">No active content sections found.</p>
                            <a href="{{ route('admin.content-sections.create') }}" class="btn btn-primary">
                                <i class="bi bi-plus"></i> Create First Section
                            </a>
                        </div>
                    @endif
                </div>
            </div>
        </div>
    </div> --}}
    </div>
@endsection
