<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Export Data Laundry</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            background: #f5f5f5;
        }
        .print-info {
            background: #e3f2fd;
            border: 1px solid #2196f3;
            border-radius: 5px;
            padding: 15px;
            margin-bottom: 20px;
            text-align: center;
        }
        .print-info strong {
            color: #1976d2;
        }
        @media print {
            .print-info {
                display: none;
            }
            body {
                background: white;
                padding: 0;
            }
        }
        .container {
            background: white;
            padding: 30px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        .header {
            text-align: center;
            margin-bottom: 30px;
            border-bottom: 3px solid #f5576c;
            padding-bottom: 20px;
        }
        .header h1 {
            color: #f5576c;
            margin: 0 0 10px 0;
            font-size: 24px;
        }
        .header p {
            color: #666;
            margin: 0;
            font-size: 12px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }
        table thead {
            background: #f5576c;
            color: white;
        }
        table th {
            padding: 12px;
            text-align: left;
            font-weight: bold;
            font-size: 11px;
        }
        table td {
            padding: 10px 12px;
            border-bottom: 1px solid #ddd;
            font-size: 10px;
        }
        table tbody tr:nth-child(even) {
            background: #f9f9f9;
        }
        .footer {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #ddd;
            text-align: center;
            color: #666;
            font-size: 10px;
        }
    </style>
</head>
<body>
    <div class="print-info">
        <strong>📄 Cara Mengubah ke PDF:</strong> Tekan <kbd>Ctrl+P</kbd> atau klik Print, lalu pilih "Save as PDF" sebagai printer.
    </div>
    
    <div class="container">
        <div class="header">
            <h1>🧺 Data Laundry</h1>
            <p>Laporan Lengkap Data Layanan Laundry yang Tersedia</p>
            <p>Dicetak pada: {{ now()->format('d M Y H:i:s') }}</p>
        </div>

        <table>
            <thead>
                <tr>
                    <th>No.</th>
                    <th>Nama Laundry</th>
                    <th>Alamat</th>
                    <th>Fasilitas</th>
                    <th>Layanan & Harga</th>
                    <th>No. WhatsApp</th>
                </tr>
            </thead>
            <tbody>
                @foreach($laundry as $key => $item)
                <tr>
                    <td>{{ $key + 1 }}</td>
                    <td><strong>{{ $item->nama }}</strong></td>
                    <td>{{ $item->alamat ?? '-' }}</td>
                    <td>{{ $item->fasilitas ?? '-' }}</td>
                    <td>
                        @if($item->layanan && $item->layanan->count() > 0)
                            @foreach($item->layanan as $svc)
                                <div style="margin-bottom: 3px;">
                                    <span style="display: inline-block; background: #f5576c; color: white; padding: 2px 6px; border-radius: 3px; font-size: 9px;">
                                        {{ ucfirst($svc->jenis_layanan) }}
                                    </span>
                                    <span style="font-size: 9px;">
                                        Rp {{ number_format($svc->harga, 0, ',', '.') }} / {{ $svc->kecepatan }} {{ $svc->satuan_kecepatan }}
                                    </span>
                                </div>
                            @endforeach
                        @else
                            <span style="color: #999;">Belum ada layanan</span>
                        @endif
                    </td>
                    <td>{{ $item->no_whatsapp ?? '-' }}</td>
                </tr>
                @endforeach
            </tbody>
        </table>

        <div class="footer">
            <p>📊 Total Data: <strong>{{ count($laundry) }}</strong> laundry</p>
            <p>Generated by SPK Kontrakan System</p>
        </div>
    </div>
</body>
</html>
