<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <title>Bolsas {{ $orden->folio_unico }}</title>
    <style>
        @page { margin: 0; }
        body { font-family: DejaVu Sans, sans-serif; font-size: 9px; margin: 0; padding: 0; color: #000; }
        .label {
            width: 219pt;
            max-width: 219pt;
            margin: 0 auto;
            padding: 10pt 8pt 14pt;
            page-break-after: always;
            border-bottom: 0.3pt dashed #ccc;
            box-sizing: border-box;
            text-align: center;
        }
        .label:last-child { page-break-after: auto; border-bottom: none; }
        .cliente {
            font-weight: bold;
            font-size: 11px;
            line-height: 1.2;
            margin: 0 0 6px;
            word-wrap: break-word;
            text-transform: uppercase;
        }
        .meta {
            font-size: 8px;
            line-height: 1.35;
            margin: 0 0 3px;
            color: #222;
        }
        .bag-meta { font-size: 9px; font-weight: bold; margin: 6px 0 8px; }
        .codigo-txt { font-size: 8px; letter-spacing: 0.04em; margin-top: 4px; }
        .barcode-wrap { text-align: center; margin: 4px auto; }
        .barcode-wrap img { max-width: 200pt; height: auto; }
        .hint { font-size: 7px; color: #444; margin-top: 6px; }
    </style>
</head>
<body>
@foreach ($etiquetas as $row)
    <div class="label">
        <div class="cliente">{{ $labelMeta['cliente'] ?? $orden->cliente_nombre }}</div>
        <div class="meta">Entrega: {{ $labelMeta['fecha_entrega'] ?? '—' }}</div>
        <div class="meta">Servicio: {{ $labelMeta['tipo_servicio'] ?? 'NORMAL' }}</div>
        <div class="bag-meta">Bolsa {{ $row['indice'] }} de {{ $row['total_bolsas'] }}</div>
        @if(!empty($row['barcode_data_uri']))
            <div class="barcode-wrap">
                <img src="{{ $row['barcode_data_uri'] }}" alt="" />
            </div>
        @endif
        <div class="codigo-txt">{{ $row['barcode_display'] ?? $row['codigo'] }}</div>
        <div class="hint">Pegar en la bolsa · escanear en Lavandería</div>
    </div>
@endforeach
</body>
</html>
