// lib/remote/url_utils.dart
Uri buildAbsoluteUri(String baseUrl, String relativePath) {
  final base = Uri.parse(baseUrl.endsWith('/') ? baseUrl : '$baseUrl/');
  final cleaned = relativePath.startsWith('/') ? relativePath.substring(1) : relativePath;
  final segments = cleaned.split('/').where((s) => s.isNotEmpty).toList();
  return base.replace(pathSegments: [...base.pathSegments, ...segments]);
}
