<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>{{ $taskName }}</title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; color: #16212e; margin: 0; padding: 24px;">
    <h2 style="margin: 0 0 8px;">{{ $taskName }}</h2>
    <p style="margin: 0 0 20px; color: #4c5a67;">Scheduled task summary, {{ now()->format('d/m/Y H:i') }}</p>

    @if (count($chainResults))
        <table cellpadding="8" cellspacing="0" style="border-collapse: collapse; font-size: 14px;">
            <thead>
                <tr>
                    <th align="left" style="border-bottom: 2px solid #e1e7ee;">Step</th>
                    <th align="left" style="border-bottom: 2px solid #e1e7ee;">Status</th>
                    <th align="left" style="border-bottom: 2px solid #e1e7ee;">Details</th>
                </tr>
            </thead>
            <tbody>
                @foreach ($chainResults as $result)
                    <tr>
                        <td style="border-bottom: 1px solid #e1e7ee;">{{ $result['action'] }}</td>
                        <td style="border-bottom: 1px solid #e1e7ee;">
                            <strong style="color: {{ $result['status'] === 'completed' ? '#2e7d57' : ($result['status'] === 'failed' ? '#b23b3b' : '#78848f') }};">
                                {{ ucfirst($result['status']) }}
                            </strong>
                        </td>
                        <td style="border-bottom: 1px solid #e1e7ee;">{{ $result['message'] }}</td>
                    </tr>
                @endforeach
            </tbody>
        </table>
    @else
        <p>The task has finished. Full details are available in the admin under Scheduled tasks.</p>
    @endif
</body>
</html>
