<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Client Groups Report</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            font-size: 12px;
            line-height: 1.4;
            margin: 20px;
        }
        .header {
            text-align: center;
            margin-bottom: 30px;
            border-bottom: 2px solid #333;
            padding-bottom: 10px;
        }
        .header h1 {
            margin: 0;
            font-size: 24px;
            color: #333;
        }
        .header p {
            margin: 5px 0;
            color: #666;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
            vertical-align: top;
        }
        th {
            background-color: #f5f5f5;
            font-weight: bold;
        }
        .text-right {
            text-align: right;
        }
        .text-center {
            text-align: center;
        }
        .footer {
            margin-top: 30px;
            text-align: center;
            font-size: 10px;
            color: #666;
            border-top: 1px solid #ddd;
            padding-top: 10px;
        }
        @media print {
            body { margin: 0; }
            .no-print { display: none; }
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>Client Groups Report</h1>
        <p>Generated on {{ now()->format('F d, Y H:i') }}</p>
    </div>

    <table>
        <thead>
            <tr>
                <th>Group Code</th>
                <th>Group Name</th>
                <th>Description</th>
                <th>Status</th>
                <th>Minimum Savings</th>
                <th>Active Members</th>
                <th>Created Date</th>
            </tr>
        </thead>
        <tbody>
            @forelse($groups as $group)
            <tr>
                <td>{{ $group->code }}</td>
                <td>{{ $group->name }}</td>
                <td>{{ $group->description ?? 'N/A' }}</td>
                <td class="text-center">{{ ucfirst($group->status) }}</td>
                <td class="text-right">${{ number_format($group->minimum_savings, 2) }}</td>
                <td class="text-center">{{ $group->active_members_count }}</td>
                <td>{{ $group->created_at->format('M d, Y') }}</td>
            </tr>
            @empty
            <tr>
                <td colspan="7" class="text-center">No client groups found.</td>
            </tr>
            @endforelse
        </tbody>
    </table>

    <div class="footer">
        <p>Report generated by Credora System</p>
        <p>© {{ date('Y') }} All rights reserved</p>
    </div>
</body>
</html>
