<!DOCTYPE html>
<html dir="{{ \App\Helpers\TranslationHelper::getCurrentLanguage() == 'ar' ? 'rtl' : 'ltr' }}" lang="{{ \App\Helpers\TranslationHelper::getCurrentLanguage() }}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.ListReport', __('Customers List')) }}</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            font-family: 'Arial', sans-serif;
            font-size: 11px;
            line-height: 1.4;
            color: #333;
        }
        .container {
            padding: 20px;
            max-width: 100%;
        }
        .header {
            text-align: center;
            margin-bottom: 30px;
            border-bottom: 2px solid #333;
            padding-bottom: 15px;
        }
        .header h1 {
            font-size: 24px;
            color: #1e40af;
            margin-bottom: 5px;
        }
        .header p {
            font-size: 12px;
            color: #666;
            margin-bottom: 5px;
        }
        .export-date {
            text-align: {{ \App\Helpers\TranslationHelper::getCurrentLanguage() == 'ar' ? 'left' : 'right' }};
            font-size: 10px;
            color: #999;
            margin-bottom: 20px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
        }
        thead {
            background-color: #1e40af;
            color: white;
        }
        th {
            padding: 10px;
            text-align: {{ \App\Helpers\TranslationHelper::getCurrentLanguage() == 'ar' ? 'right' : 'left' }};
            border: 1px solid #ddd;
            font-weight: bold;
            font-size: 10px;
        }
        td {
            padding: 8px 10px;
            border: 1px solid #ddd;
            text-align: {{ \App\Helpers\TranslationHelper::getCurrentLanguage() == 'ar' ? 'right' : 'left' }};
            font-size: 10px;
        }
        tbody tr:nth-child(even) {
            background-color: #f5f5f5;
        }
        tbody tr:hover {
            background-color: #e8f0ff;
        }
        .status-active {
            color: green;
            font-weight: bold;
        }
        .status-inactive {
            color: red;
            font-weight: bold;
        }
        .type-individual {
            color: #0066cc;
        }
        .type-company {
            color: #9933cc;
        }
        .footer {
            margin-top: 30px;
            padding-top: 15px;
            border-top: 2px solid #333;
            text-align: center;
            font-size: 10px;
            color: #666;
        }
        .summary {
            margin-top: 20px;
            padding: 10px;
            background-color: #f0f0f0;
            border-radius: 5px;
            text-align: center;
            font-weight: bold;
            color: #333;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.ListReport', __('Customers List')) }}</h1>
            <p>{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.ReportDescription', __('Comprehensive report of all registered customers')) }}</p>
        </div>

        <div class="export-date">
            <strong>{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.ExportDate', __('Export Date')) }}:</strong> {{ date('Y-m-d H:i:s') }}
        </div>

        <table>
            <thead>
                <tr>
                    <th style="width: 5%;">#</th>
                    <th style="width: 15%;">{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.Name', __('Customer Name')) }}</th>
                    <th style="width: 12%;">{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.ContactPerson', __('Contact Person')) }}</th>
                    <th style="width: 15%;">{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.Email', __('Email')) }}</th>
                    <th style="width: 12%;">{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.Phone', __('Phone')) }}</th>
                    <th style="width: 12%;">{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.Mobile', __('Mobile')) }}</th>
                    <th style="width: 10%;">{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.Type', __('Type')) }}</th>
                    <th style="width: 10%;">{{ \App\Helpers\TranslationHelper::transFromDatabase('General.Status', __('Status')) }}</th>
                    <th style="width: 10%;">{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.CreditLimit', __('Credit Limit')) }}</th>
                </tr>
            </thead>
            <tbody>
                @forelse($customers as $index => $customer)
                <tr>
                    <td>{{ $index + 1 }}</td>
                    <td><strong>{{ $customer->name }}</strong></td>
                    <td>{{ $customer->contact_person ?? '-' }}</td>
                    <td>{{ $customer->email ?? '-' }}</td>
                    <td>{{ $customer->phone ?? '-' }}</td>
                    <td>{{ $customer->mobile ?? '-' }}</td>
                    <td>
                        @if($customer->customer_type == 'individual')
                            <span class="type-individual">{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.Individual', __('Individual')) }}</span>
                        @else
                            <span class="type-company">{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.Company', __('Company')) }}</span>
                        @endif
                    </td>
                    <td>
                        @if($customer->status == 'active')
                            <span class="status-active">{{ \App\Helpers\TranslationHelper::transFromDatabase('Status.Active', __('Active')) }}</span>
                        @else
                            <span class="status-inactive">{{ \App\Helpers\TranslationHelper::transFromDatabase('Status.Inactive', __('Inactive')) }}</span>
                        @endif
                    </td>
                    <td>{{ number_format($customer->credit_limit, 2) }}</td>
                </tr>
                @empty
                <tr>
                    <td colspan="9" style="text-align: center; padding: 20px;">{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.NoData', __('No data to display')) }}</td>
                </tr>
                @endforelse
            </tbody>
        </table>

        <div class="summary">
            {{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.TotalCount', __('Total Customers')) }}: <strong>{{ $customers->count() }}</strong>
        </div>

        <div class="footer">
            <p>{{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.AutoGeneratedReport', __('This report was generated automatically from the Customer Management System')) }}</p>
            <p style="margin-top: 10px; color: #999;">© {{ \App\Helpers\TranslationHelper::transFromDatabase('Customers.AllRightsReserved', __('All Rights Reserved')) }}</p>
        </div>
    </div>
</body>
</html>
