<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Contests Report</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            padding: 20px;
        }

        h2 {
            text-align: center;
            margin-bottom: 30px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
        }

        th, td {
            border: 1px solid #000;
            padding: 10px;
            text-align: left;
        }

        th {
            background-color: #f2f2f2;
        }
    </style>
</head>
<body>

    <h2>Contests Report</h2>

    <table>
        <thead>
            <tr>
                <th>Contest Title</th>
                <th>Participant Count</th>
                <th>Average Score</th>
                <th>Average Time Taken</th>
            </tr>
        </thead>
        <tbody>
            @foreach($data as $contest)
                <tr>
                    <td>{{ $contest->translation->title ?? 'N/A' }}</td>
                    <td>{{ $contest->participants_count ?? 0 }}</td>
                    <td>{{ number_format($contest->participants_avg_score, 2) ?? '0.00' }}</td>
                    <td>{{ gmdate('H:i:s', (int)($contest->participants_avg_time_taken ?? 0)) }}</td>
                </tr>
            @endforeach
        </tbody>
    </table>

</body>
</html>
